35 MnPrint print(
"NegativeG2LineSearch");
45 unsigned int iter = 0;
48 for (
unsigned int i = 0; i <
n; i++) {
50 print.
Debug(
"negative G2 - iter", iter,
"param", i, pa.
Vec()(i),
"grad2", dgrad.
G2()(i),
"grad",
51 dgrad.
Vec()(i),
"grad step", dgrad.
Gstep()(i),
"step size", pa.
Dirin()(i));
53 if (dgrad.
G2()(i) <= 0) {
57 if (std::fabs(dgrad.
Vec()(i)) < prec.
Eps() && std::fabs(dgrad.
G2()(i)) < prec.
Eps())
64 if (dgrad.
Vec()(i) < 0)
65 step(i) = dgrad.
Gstep()(i);
67 step(i) = -dgrad.
Gstep()(i);
69 double gdel = step(i) * dgrad.
Vec()(i);
74 print.
Debug(
"step(i)", step(i),
"gdel", gdel);
79 print.
Debug(
"Line search result", pp.
X(),
"f(0)", pa.
Fval(),
"f(1)", pp.
Y());
84 dgrad = gc(pa, dgrad);
86 print.
Debug(
"Line search - iter", iter,
"param", i, pa.
Vec()(i),
"step", step(i),
"new grad2",
87 dgrad.
G2()(i),
"new grad", dgrad.
Vec()(i),
"grad step", dgrad.
Gstep()(i));
96 for (
unsigned int i = 0; i <
n; i++)
97 mat(i, i) = (std::fabs(dgrad.
G2()(i)) > prec.
Eps2() ? 1. / dgrad.
G2()(i) : 1.);
113 for (
unsigned int i = 0; i < grad.
Vec().
size(); i++)
115 if (grad.
G2()(i) <= 0) {
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
const MnAlgebraicVector & Gstep() const
const MnAlgebraicVector & Vec() const
const MnAlgebraicVector & G2() const
interface class for gradient calculators
Class describing a symmetric matrix of size n.
unsigned int size() const
MinimumError keeps the inv.
const MnAlgebraicVector & Dirin() const
const MnAlgebraicVector & Vec() const
MinimumState keeps the information (position, Gradient, 2nd deriv, etc) after one minimization step (...
const MinimumParameters & Parameters() const
const FunctionGradient & Gradient() const
Wrapper class to FCNBase interface used internally by Minuit.
unsigned int NumOfCalls() const
Implements a 1-dimensional minimization along a given direction (i.e.
Sets the relative floating point (double) arithmetic precision.
double Eps() const
eps returns the smallest possible number so that 1.+eps > 1.
double Eps2() const
eps2 returns 2*sqrt(eps)
double Y() const
Accessor to the y (second) coordinate.
double X() const
Accessor to the x (first) coordinate.
void Debug(const Ts &... args)
bool HasNegativeG2(const FunctionGradient &, const MnMachinePrecision &) const
MinimumState operator()(const MnFcn &, const MinimumState &, const GradientCalculator &, const MnMachinePrecision &) const
double Estimate(const FunctionGradient &, const MinimumError &) const
int iterate(rng_state_t *X)
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...