13#ifndef ROOT_Math_FitMethodFunction
14#define ROOT_Math_FitMethodFunction
37template<
class FunctionType>
63 unsigned int NDim()
const override {
return fNDim; }
73 virtual double DataElement(
const double *
x,
unsigned int i,
double *
g =
nullptr,
double *
h =
nullptr,
bool fullHessian =
false)
const = 0;
81 virtual bool Hessian(
const double *
x,
double * hess)
const {
84 unsigned int ndim =
NDim();
85 unsigned int nh = ndim*(ndim+1)/2;
86 for (
unsigned int k = 0; k < nh; ++k) {
89 std::vector<double>
g(
np);
90 std::vector<double>
h(nh);
91 for (
unsigned int i = 0; i <
np; i++) {
93 if (
f == std::numeric_limits<double>::quiet_NaN() )
return false;
94 for (
unsigned int j = 0; j < nh; j++) {
104 virtual bool G2(
const double * ,
double * )
const {
return false; }
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t np
FitMethodFunction class Interface for objective functions (like chi2 and likelihood used in the fit) ...
virtual Type_t Type() const
return the type of method, override if needed
Type_t
enumeration specifying the possible fit method types
BasicFitMethodFunction(int dim, int npoint)
virtual bool Hessian(const double *x, double *hess) const
Computes the full Hessian.
virtual double DataElement(const double *x, unsigned int i, double *g=nullptr, double *h=nullptr, bool fullHessian=false) const =0
method returning the data i-th contribution to the fit objective function For example the residual fo...
virtual bool G2(const double *, double *) const
Computes the Second derivatives.
virtual unsigned int NPoints() const
return the number of data points used in evaluating the function
virtual bool HasHessian() const
~BasicFitMethodFunction() override
Virtual Destructor (no operations)
unsigned int NDim() const override
Number of dimension (parameters) .
static bool IsAGradFCN()
Static function to indicate if a function is supporting gradient.
virtual void ResetNCalls()
reset number of function calls
virtual unsigned int NCalls() const
return the total number of function calls (override if needed)
FunctionType::BaseFunc BaseFunction
virtual void UpdateNCalls() const
update number of calls
Namespace for new Math classes and functions.
BasicFitMethodFunction< ROOT::Math::IMultiGenFunction > FitMethodFunction
BasicFitMethodFunction< ROOT::Math::IMultiGradFunction > FitMethodGradFunction
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.