32 const std::vector<double> &err,
unsigned int maxcalls)
const
39 const std::vector<double> &
cov,
unsigned int maxcalls)
const
73 for (
unsigned int i = 0; i <
n; i++)
107 if (
st.Gradient().IsAnalytical()) {
119 unsigned int n =
st.Parameters().Vec().size();
126 std::unique_ptr<AnalyticalGradientCalculator>
hc;
130 hc = std::make_unique<AnalyticalGradientCalculator>(
fcn,
trafo);
135 print.
Error(
"Error computing analytical Hessian. MnHesse fails and will return a null matrix");
140 for (
unsigned int i = 0; i <
n; i++)
157 print.
Warn(
"Matrix inversion fails; will return diagonal matrix");
160 for (
unsigned int j = 0;
j <
n;
j++) {
170 if (
tmpErr.IsMadePosDef()) {
172 double edm =
estim.Estimate(
gr, err);
179 double edm =
estim.Estimate(
gr, err);
181 print.
Debug(
"Hessian is ACCURATE. New state:",
"\n First derivative:",
st.Gradient().Grad(),
182 "\n Covariance matrix:",
vhmat,
"\n Edm:", edm);
202 unsigned int n =
st.Parameters().Vec().size();
215 if (
st.Gradient().IsAnalytical()) {
216 print.
Info(
"Using analytical gradient but a numerical Hessian calculator - it could be not optimal");
223 print.
Warn(
"Analytical calculator ",
grd,
" numerical ",tmp.Grad(),
" g2 ",
g2);
228 print.
Debug(
"Gradient is",
st.Gradient().IsAnalytical() ?
"analytical" :
"numerical",
"\n point:",
x,
229 "\n fcn :",
amin,
"\n grad :",
grd,
"\n step :",
gst,
"\n g2 :",
g2);
231 for (
unsigned int i = 0; i <
n; i++) {
235 double d = std::fabs(
gst(i));
239 print.
Debug(
"Derivative parameter", i,
"d =",
d,
"dmin =",
dmin);
258 if (
trafo.Parameter(i).HasLimits()) {
272 print.
Warn(
"2nd derivative zero for parameter",
trafo.Name(
trafo.ExtOfInt(i)),
273 "; MnHesse fails and will return diagonal matrix");
275 for (
unsigned int j = 0;
j <
n;
j++) {
276 double tmp =
g2(
j) <
prec.Eps2() ? 1. : 1. /
g2(
j);
291 d = std::sqrt(2. *
aimsag / std::fabs(
g2(i)));
292 if (
trafo.Parameter(i).HasLimits())
293 d = std::min(0.5,
d);
297 print.
Debug(
"g1 =",
grd(i),
"g2 =",
g2(i),
"step =",
gst(i),
"d =",
d,
"diffd =", std::fabs(
d -
dlast) /
d,
298 "diffg2 =", std::fabs(
g2(i) -
g2bfor) /
g2(i));
312 print.
Warn(
"Maximum number of allowed function calls exhausted; will return diagonal matrix");
314 for (
unsigned int j = 0;
j <
n;
j++) {
315 double tmp =
g2(
j) <
prec.Eps2() ? 1. : 1. /
g2(
j);
320 st.Edm(),
mfcn.NumOfCalls());
324 print.
Debug(
"Second derivatives",
g2);
400 print.
Warn(
"Matrix inversion fails; will return diagonal matrix");
403 for (
unsigned int j = 0;
j <
n;
j++) {
404 double tmp =
g2(
j) <
prec.Eps2() ? 1. : 1. /
g2(
j);
416 if (
tmpErr.IsMadePosDef()) {
418 double edm =
estim.Estimate(
gr, err);
424 double edm =
estim.Estimate(
gr, err);
426 print.
Debug(
"Hessian is ACCURATE. New state:",
"\n First derivative:",
grd,
"\n Second derivative:",
g2,
427 "\n Gradient step:",
gst,
"\n Covariance matrix:",
vhmat,
"\n Edm:", edm);
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void gc
Similar to the AnalyticalGradientCalculator, the ExternalInternalGradientCalculator supplies Minuit w...
Interface (abstract class) defining the function to be minimized, which has to be implemented by the ...
class holding the full result of the minimization; both internal and external (MnUserParameterState) ...
HessianGradientCalculator: class to calculate Gradient for Hessian.
Class describing a symmetric matrix of size n.
MinimumError keeps the inv.
MinimumState keeps the information (position, Gradient, 2nd deriv, etc) after one minimization step (...
Wrapper class to FCNBase interface used internally by Minuit.
unsigned int Ncycles() const
forward interface of MnStrategy
MnUserParameterState operator()(const FCNBase &, const std::vector< double > &, const std::vector< double > &, unsigned int maxcalls=0) const
low-level API
MinimumState ComputeNumerical(const MnFcn &, const MinimumState &, const MnUserTransformation &, unsigned int maxcalls) const
internal function to compute the Hessian using numerical derivative computation
MinimumState ComputeAnalytical(const FCNGradientBase &, const MinimumState &, const MnUserTransformation &) const
internal function to compute the Hessian using an analytical computation or externally provided in th...
Sets the relative floating point (double) arithmetic precision.
Force the covariance matrix to be positive defined by adding extra terms in the diagonal.
void Debug(const Ts &... args)
void Error(const Ts &... args)
void Info(const Ts &... args)
void Warn(const Ts &... args)
unsigned int Strategy() const
unsigned int HessianCentralFDMixedDerivatives() const
unsigned int HessianForcePosDef() const
Class containing the covariance matrix data represented as a vector of size n*(n+1)/2 Used to hide in...
Wrapper used by Minuit of FCN interface containing a reference to the transformation object.
class which holds the external user and/or internal Minuit representation of the parameters and error...
unsigned int NFcn() const
unsigned int VariableParameters() const
const std::vector< double > & IntParameters() const
const MnUserTransformation & Trafo() const
API class for the user interaction with the parameters; serves as input to the minimizer as well as o...
class performing the numerical gradient calculation
int Invert(LASymMatrix &)
LASymMatrix MnAlgebraicSymMatrix
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...