47 unsigned int iter = 0;
50 for(
unsigned int i = 0; i <
n; i++) {
53 std::cout <<
"negative G2 - iter " << iter <<
" param " << i <<
" " << pa.
Vec()(i) <<
" grad2 " << dgrad.
G2()(i) <<
" grad " << dgrad.
Vec()(i)
54 <<
" grad step " << dgrad.
Gstep()(i) <<
" step size " << pa.
Dirin()(i) << std::endl;
56 if(dgrad.
G2()(i) <= 0) {
66 if ( dgrad.
Vec()(i) < 0)
67 step(i) = dgrad.
Gstep()(i);
69 step(i) = - dgrad.
Gstep()(i);
71 double gdel = step(i)*dgrad.
Vec()(i);
78 std::cout <<
"step(i) " << step(i) <<
" gdel " << gdel << std::endl;
87 std::cout <<
"\nLine search result " << pp.
X() <<
" f(0) " << pa.
Fval() <<
" f(1) " << pp.
Y() << std::endl;
93 dgrad = gc(pa, dgrad);
96 std::cout <<
"Line search - iter" << iter <<
" param " << i <<
" " << pa.
Vec()(i) <<
" step " << step(i) <<
" new grad2 " << dgrad.G2()(i) <<
" new grad " << dgrad.
Vec()(i) <<
" grad step " << dgrad.Gstep()(i) << std::endl;
103 }
while(iter++ < 2*n && iterate);
106 for(
unsigned int i = 0; i <
n; i++)
107 mat(i,i) = (
fabs(dgrad.
G2()(i)) > prec.
Eps2() ? 1./dgrad.
G2()(i) : 1.);
118 for(
unsigned int i = 0; i < grad.
Vec().
size(); i++)
120 if(grad.
G2()(i) <= 0 ) {
void fcn(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
unsigned int size() const
double X() const
Accessor to the x (first) coordinate.
Class describing a symmetric matrix of size n.
determines the relative floating point arithmetic precision.
const FunctionGradient & Gradient() const
std::map< std::string, std::string >::const_iterator iter
double Y() const
Accessor to the y (second) coordinate.
const MnAlgebraicVector & Vec() const
Wrapper class to FCNBase interface used internally by Minuit.
MinimumState operator()(const MnFcn &, const MinimumState &, const GradientCalculator &, const MnMachinePrecision &) const
const MnAlgebraicVector & Dirin() const
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
double Eps2() const
eps2 returns 2*sqrt(eps)
double Estimate(const FunctionGradient &, const MinimumError &) const
bool HasNegativeG2(const FunctionGradient &, const MnMachinePrecision &) const
const MnAlgebraicVector & Gstep() const
const MinimumParameters & Parameters() const
double Eps() const
eps returns the smallest possible number so that 1.+eps > 1.
MinimumError keeps the inv.
unsigned int NumOfCalls() const
int iterate(rng_state_t *X)
MinimumState keeps the information (position, Gradient, 2nd deriv, etc) after one minimization step (...
const MnAlgebraicVector & Vec() const
Implements a 1-dimensional minimization along a given direction (i.e.
const MnAlgebraicVector & G2() const
interface class for gradient calculators