56 std::cout<<
"FumiliBuilder convergence when edm < "<<edmval<<std::endl;
71 MN_INFO_MSG(
"FumiliBuilder: initial matrix not pos.def.");
76 std::vector<MinimumState>
result;
80 result.push_back( seed.
State() );
84 std::cout <<
"Fumili: start iterating until Edm is < " << edmval << std::endl;
95 int maxfcn_eff = int(0.5*maxfcn);
102 min =
Minimum(fcn, gc, seed, result, maxfcn_eff, edmval);
109 MN_INFO_MSG(
"FumiliBuilder: FunctionMinimum is invalid.");
116 edm = result.back().Edm();
119 std::cout <<
"approximate edm is " << edm << std::endl;
120 std::cout <<
"npass is " << ipass << std::endl;
126 std::cout <<
"FumiliBuilder will verify convergence and Error matrix. " << std::endl;
127 std::cout <<
"dcov is = "<<
min.Error().Dcovar() << std::endl;
136 result.push_back( st );
138 if (printLevel > 1) {
147 std::cout <<
"edm after Hesse calculation " << edm << std::endl;
148 std::cout <<
"state after Hessian calculation " << st << std::endl;
152 if (ipass > 0 && edm >= edmprev) {
154 MN_INFO_MSG(
"FumiliBuilder: Exit iterations, no improvements after Hesse ");
162 std::cout <<
"FumiliBuilder: Tolerance is not sufficient - edm is " << edm <<
" requested " << edmval
163 <<
" continue the minimization" << std::endl;
169 if (
min.IsAboveMaxEdm() ) {
182 if (ipass == 0) maxfcn_eff = maxfcn;
186 }
while (edm > edmval );
191 min.Add( result.back() );
234 double edm = initialState.
Edm();
238 std::cout <<
"\n\nDEBUG FUMILI Builder \nInitial State: "
239 <<
" Parameter " << initialState.
Vec()
242 <<
" edm = " << initialState.
Edm()
243 <<
" maxfcn = " << maxfcn
244 <<
" tolerance = " << edmval
254 double lambda = 0.001;
266 std::cout <<
"\n\n---> Iteration - " << result.size()
267 <<
"\nFval = " << s0.
Fval() <<
" numOfCall = " << fcn.
NumOfCalls()
268 <<
"\nInternal Parameter values " << s0.
Vec()
269 <<
" Newton step " << step << std::endl;
275 MN_INFO_MSG(
"FumiliBuilder: matrix not pos.def, gdel > 0");
286 result.push_back(s0);
322 std::cout <<
"Before Gradient " << fcn.
NumOfCalls() << std::endl;
328 std::cout <<
"After Gradient " << fcn.
NumOfCalls() << std::endl;
343 std::cout <<
"Updated new point: \n "
344 <<
" FVAL " << p.
Fval()
345 <<
" Parameter " << p.
Vec()
346 <<
" Gradient " << g.
Vec()
347 <<
" InvHessian " << e.
Matrix()
349 <<
" edm = " << edm << std::endl << std::endl;
354 MN_INFO_MSG(
"FumiliBuilder: matrix not pos.def., edm < 0");
360 result.push_back(s0);
373 if ( edm < 0.1 )
break;
377 std::cout <<
" finish iteration- " << result.size() <<
" lambda = " << lambda <<
" f1 = " << p.
Fval() <<
" f0 = " << s0.
Fval() <<
" num of calls = " << fcn.
NumOfCalls() <<
" edm " << edm << std::endl;
383 if (printLevel > 1) {
388 edm *= (1. + 3.*e.
Dcovar());
391 }
while(edm > edmval && fcn.
NumOfCalls() < maxfcn);
397 MN_INFO_MSG(
"FumiliBuilder: call limit exceeded.");
403 if(edm <
fabs(prec.
Eps2()*result.back().Fval())) {
405 MN_INFO_MSG(
"FumiliBuilder: machine accuracy limits further improvement.");
408 }
else if(edm < 10.*edmval) {
412 MN_INFO_MSG(
"FumiliBuilder: finishes without convergence.");
422 std::cout <<
"Exiting successfully FumiliBuilder \n"
424 <<
"\nFval = " << result.back().Fval()
425 <<
"\nedm = " << edm <<
" requested = " << edmval << std::endl;
#define MN_INFO_VAL2(loc, x)
static Vc_ALWAYS_INLINE int_v min(const int_v &x, const int_v &y)
void fcn(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
const MinimumParameters & Parameters() const
const MnMachinePrecision & Precision() const
const VariableMetricEDMEstimator & Estimator() const
Accessor to the EDM (expected vertical distance to the Minimum) estimator.
Force the covariance matrix to be positive defined by adding extra terms in the diagonal.
unsigned int size() const
MinimumSeed contains the starting values for the minimization produced by the SeedGenerator.
double X() const
Accessor to the x (first) coordinate.
double inner_product(const LAVector &, const LAVector &)
const MinimumState & State() const
const FumiliErrorUpdator & ErrorUpdator() const
Accessor to the Error updator of the builder.
determines the relative floating point arithmetic precision.
const FunctionGradient & Gradient() const
const MinimumError & Error() const
double Y() const
Accessor to the y (second) coordinate.
class holding the full result of the minimization; both internal and external (MnUserParameterState) ...
const MnAlgebraicVector & Vec() const
API class for calculating the numerical covariance matrix (== 2x Inverse Hessian == 2x Inverse 2nd de...
virtual FunctionMinimum Minimum(const MnFcn &fMnFcn, const GradientCalculator &fGradienCalculator, const MinimumSeed &fMinimumSeed, const MnStrategy &fMnStrategy, unsigned int maxfcn, double edmval) const
Class the member function calculating the Minimum and verifies the result depending on the strategy...
static void PrintState(std::ostream &os, const MinimumState &state, const char *msg, int iter=-1)
Wrapper class to FCNBase interface used internally by Minuit.
const MnAlgebraicVector & Vec() const
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
MnAlgebraicSymMatrix Hessian() const
double Eps2() const
eps2 returns 2*sqrt(eps)
double Estimate(const FunctionGradient &, const MinimumError &) const
MnAlgebraicSymMatrix Matrix() const
const MnAlgebraicSymMatrix & InvHessian() const
const MinimumParameters & Parameters() const
double Eps() const
eps returns the smallest possible number so that 1.+eps > 1.
const MnAlgebraicVector & Grad() const
void TraceIteration(int iter, const MinimumState &state) const
MinimumError keeps the inv.
unsigned int NumOfCalls() const
virtual MinimumError Update(const MinimumState &fMinimumState, const MinimumParameters &fMinimumParameters, const GradientCalculator &fGradientCalculator, double lambda) const
Member function that calculates the Error matrix (or the Hessian matrix containing the (approximate) ...
MinimumState keeps the information (position, Gradient, 2nd deriv, etc) after one minimization step (...
const MnAlgebraicVector & Vec() const
API class for defining three levels of strategies: low (0), medium (1), high (>=2); acts on: Migrad (...
Implements a 1-dimensional minimization along a given direction (i.e.
interface class for gradient calculators