42 MnPrint print(
"FumiliGradientCalculator");
55 const std::vector<double> &fcn_gradient =
fFcn.
Gradient();
56 assert(fcn_gradient.size() == extParam.size());
59 std::vector<double> deriv(nvar);
60 std::vector<unsigned int> extIndex(nvar);
61 for (
int i = 0; i < nvar; ++i) {
67 v(i) = fcn_gradient[extIndex[i]] * deriv[i];
69 for (
int j = 0; j <= i; ++j) {
70 h(i, j) = deriv[i] * deriv[j] *
fFcn.
Hessian(extIndex[i], extIndex[j]);
75 print.
Debug([&](std::ostream &os) {
77 os <<
"Comparison of Fumili Gradient and standard (numerical) Minuit Gradient (done only when debugging enabled)" << std::endl;
81 os <<
"Fumili Gradient:" <<
v << std::endl;
82 os <<
"Minuit Gradient" << grd2.Vec() << std::endl;
83 os <<
"Fumili Hessian: " <<
h << std::endl;
84 os <<
"Numerical g2 " << grd2.G2() << std::endl;
110 for (
unsigned int i = 0; i <
n ; i++) {
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void gc
const MnUserTransformation & fTransformation
Extension of the FCNBase for the Fumili method.
std::vector< double > Hessian(std::vector< double > const &) const override
Return Value of the i-th j-th element of the Hessian matrix estimated previously using the FumiliFCNB...
virtual const std::vector< double > & Gradient() const
Return cached Value of function Gradient estimated previously using the FumiliFCNBase::EvaluateAll me...
virtual void EvaluateAll(std::vector< double > const &par)=0
Evaluate function Value, Gradient and Hessian using Fumili approximation, for values of parameters p ...
bool G2(const MinimumParameters &, MnAlgebraicVector &) const override
compute second derivatives (diagonal of Hessian)
MnAlgebraicSymMatrix fHessian
FumiliGradientCalculator(const FumiliFCNBase &fcn, const MnUserTransformation &trafo, int n)
FunctionGradient operator()(const MinimumParameters &) const override
bool Hessian(const MinimumParameters &, MnAlgebraicSymMatrix &) const override
compute Hessian matrix
const FumiliFCNBase & fFcn
Class describing a symmetric matrix of size n.
unsigned int Nrow() const
unsigned int size() const
const MnAlgebraicVector & Vec() const
Wrapper class to FCNBase interface used internally by Minuit.
void Debug(const Ts &... args)
static int SetGlobalLevel(int level)
API class for defining four levels of strategies: low (0), medium (1), high (2), very high (>=3); act...
class performing the numerical gradient calculation