10#ifndef ROOT_Minuit2_FCNGradAdapter
11#define ROOT_Minuit2_FCNGradAdapter
34template <
class Function>
42 double operator()(
const std::vector<double> &
v)
const override {
return fFunc.operator()(&
v[0]); }
45 double Up()
const override {
return fUp; }
47 std::vector<double>
Gradient(
const std::vector<double> &
v)
const override
53 double *previous_gstep)
const override
55 fFunc.GradientWithPrevResult(&
v[0], &
fGrad[0], previous_grad, previous_g2, previous_gstep);
63 if (
fFunc.returnsInMinuit2ParameterSpace()) {
71 std::vector<double>
G2(
const std::vector<double> &
x)
const override {
75 unsigned int n =
fFunc.NDim();
81 for (
unsigned int i = 0; i <
n; i++)
92 std::vector<double>
Hessian(
const std::vector<double> &
x )
const override {
93 unsigned int n =
fFunc.NDim();
130 std::function<std::vector<double>(
const std::vector<double> &)>
fG2Func;
Double_t(* Function)(Double_t)
template wrapped class for adapting to FCNBase signature a IGradFunction
double Up() const override
Error definition of the function.
FCNGradAdapter(const Function &f, double up=1.)
~FCNGradAdapter() override
GradientParameterSpace gradParameterSpace() const override
double operator()(const double *v) const
void SetG2Function(Func f)
std::function< std::vector< double >(const std::vector< double > &)> fG2Func
void SetHessianFunction(Func f)
std::vector< double > Gradient(const std::vector< double > &v) const override
std::vector< double > Hessian(const std::vector< double > &x) const override
compute Hessian. Return Hessian as a std::vector of size(n*n)
std::vector< double > fG2Vec
bool CheckGradient() const override
std::function< bool(const std::vector< double > &, double *)> fHessianFunc
std::vector< double > GradientWithPrevResult(const std::vector< double > &v, double *previous_grad, double *previous_g2, double *previous_gstep) const override
bool HasG2() const override
double operator()(const std::vector< double > &v) const override
The meaning of the vector of parameters is of course defined by the user, who uses the values of thos...
void SetErrorDef(double up) override
add interface to set dynamically a new error definition Re-implement this function if needed.
bool HasHessian() const override
std::vector< double > G2(const std::vector< double > &x) const override
return second derivatives (diagonal of the Hessian matrix)
std::vector< double > fHessian
std::vector< double > fGrad
GradientParameterSpace
Extension of the FCNBase for providing the analytical Gradient of the function.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...