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 ) {
double Y() const
Accessor to the y (second) coordinate.
int iterate(rng_state_t *X)
double Estimate(const FunctionGradient &, const MinimumError &) const
Namespace for new ROOT classes and functions.
const MnAlgebraicVector & Vec() const
double Eps() const
eps returns the smallest possible number so that 1.+eps > 1.
bool HasNegativeG2(const FunctionGradient &, const MnMachinePrecision &) const
Class describing a symmetric matrix of size n.
const MnAlgebraicVector & Vec() const
determines the relative floating point arithmetic precision.
unsigned int NumOfCalls() const
const FunctionGradient & Gradient() const
const MnAlgebraicVector & G2() const
Wrapper class to FCNBase interface used internally by Minuit.
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
double X() const
Accessor to the x (first) coordinate.
unsigned int size() const
const MnAlgebraicVector & Gstep() const
const MinimumParameters & Parameters() const
double Eps2() const
eps2 returns 2*sqrt(eps)
MinimumError keeps the inv.
const MnAlgebraicVector & Dirin() const
MinimumState keeps the information (position, Gradient, 2nd deriv, etc) after one minimization step (...
MinimumState operator()(const MnFcn &, const MinimumState &, const GradientCalculator &, const MnMachinePrecision &) const
Implements a 1-dimensional minimization along a given direction (i.e.
interface class for gradient calculators