10#ifndef ROOT_Minuit2_FCNAdapter
11#define ROOT_Minuit2_FCNAdapter
71 double Up()
const override {
return fUp; }
77 std::vector<double>
Gradient(std::vector<double>
const &
v)
const override
79 std::vector<double>
output(
v.size());
91 std::vector<double>
G2(std::vector<double>
const &
x)
const override
93 std::vector<double>
output;
97 std::size_t
n =
x.size();
104 for (
unsigned int i = 0; i <
n; i++)
118 std::vector<double>
Hessian(std::vector<double>
const &
x)
const override
120 std::vector<double>
output;
122 std::size_t
n =
x.size();
166 using G2Function = std::function<std::vector<double>(std::vector<double>
const &)>;
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Adapter class to wrap user-provided functions into the FCNBase interface.
std::vector< double > G2(std::vector< double > const &x) const override
Return the diagonal elements of the Hessian (second derivatives).
FCNAdapter(std::function< double(double const *)> f, double up=1.)
Construct an adapter around a user-provided function.
Function fFunc
Wrapped function to minimize.
GradFunction fGradFunc
Optional gradient function.
void SetGradientFunction(std::function< void(double const *, double *)> f)
Set the analytic gradient function.
void SetHessianFunction(std::function< bool(std::vector< double > const &, double *)> f)
Set the function providing the full Hessian matrix.
std::function< void(double const *, double *)> GradFunction
std::function< bool(std::vector< double > const &, double *)> HessianFunction
double operator()(std::vector< double > const &v) const override
Evaluate the function at the given parameter vector.
std::vector< double > Hessian(std::vector< double > const &x) const override
Return the full Hessian matrix.
bool HasHessian() const override
Indicate whether an analytic Hessian has been provided.
void SetErrorDef(double up) override
Update the error definition parameter.
std::vector< double > Gradient(std::vector< double > const &v) const override
Evaluate the gradient of the function at the given parameter vector.
G2Function fG2Func
Optional diagonal second-derivative function.
bool HasG2() const override
Indicate whether analytic second derivatives (diagonal of the Hessian) are available.
void SetG2Function(std::function< std::vector< double >(std::vector< double > const &)> f)
Set the function providing diagonal second derivatives (G2).
std::function< double(double const *)> Function
double fUp
Error definition parameter.
HessianFunction fHessianFunc
Optional Hessian function.
double Up() const override
Return the error definition parameter (up).
std::function< std::vector< double >(std::vector< double > const &)> G2Function
bool HasGradient() const override
Indicate whether an analytic gradient has been provided.
std::vector< double > fHessian
Storage for intermediate Hessian values.
Interface (abstract class) defining the function to be minimized, which has to be implemented by the ...