MultiNumGradFunction class to wrap a normal function in a gradient function using numerical gradient calculation provided by the class Derivator (based on GSL numerical derivation).
Definition at line 49 of file MultiNumGradFunction.h.
Public Types | |
| typedef double | BackendType |
| typedef IBaseFunctionMultiDimTempl< double > | BaseFunc |
Public Member Functions | |
| MultiNumGradFunction (const IMultiGenFunction &f) | |
| Constructor from a IMultiGenFunction interface. | |
| template<class FuncType> | |
| MultiNumGradFunction (FuncType f, int n) | |
| Constructor from a generic function (pointer or reference) and number of dimension implementing operator () (double * x). | |
| ~MultiNumGradFunction () override | |
| Destructor (no operations). | |
| IMultiGenFunction * | Clone () const override |
| Clone a function. | |
| double | Derivative (const double *x, unsigned int icoord, double *previous_grad, double *previous_g2, double *previous_gstep) const |
| In some cases, the derivative algorithm will use information from the previous step, these can be passed in with this overload. | |
| double | Derivative (const double *x, unsigned int icoord=0) const |
| Return the partial derivative with respect to the passed coordinate. | |
| virtual void | FdF (const double *x, double &f, double *df) const |
| Optimized method to evaluate at the same time the function value and derivative at a point x. | |
| virtual void | Gradient (const double *x, double *grad) const |
| Evaluate all the vector of function derivatives (gradient) at a point x. | |
| bool | HasGradient () const override |
| unsigned int | NCalls () const |
| unsigned int | NDim () const override |
| Retrieve the dimension of the function. | |
| double | operator() (const double *x) const |
| Evaluate the function at a point x[]. | |
| void | SetOwnership (bool on=true) |
Static Public Member Functions | |
| static double | GetDerivPrecision () |
| get precision value used for calculating the derivative step-size | |
| static void | SetDerivPrecision (double eps) |
| precision value used for calculating the derivative step-size h = eps * |x|. | |
Private Member Functions | |
| double | DoDerivative (const double *x, unsigned int icoord) const override |
| Function to evaluate the derivative with respect each coordinate. To be implemented by the derived class. | |
| virtual double | DoDerivativeWithPrevResult (const double *x, unsigned int icoord, double *, double *, double *) const |
| In some cases, the derivative algorithm will use information from the previous step, these can be passed in with this overload. | |
| double | DoEval (const double *x) const override |
| Implementation of the evaluation function. Must be implemented by derived classes. | |
Private Attributes | |
| unsigned int | fDim |
| const IMultiGenFunction * | fFunc |
| unsigned int | fNCalls |
| bool | fOwner |
Static Private Attributes | |
| static double | fgEps = 0.001 |
#include <Math/MultiNumGradFunction.h>
|
inherited |
Definition at line 67 of file IFunction.h.
|
inherited |
Definition at line 68 of file IFunction.h.
|
inline |
Constructor from a IMultiGenFunction interface.
Definition at line 57 of file MultiNumGradFunction.h.
|
inline |
Constructor from a generic function (pointer or reference) and number of dimension implementing operator () (double * x).
Definition at line 70 of file MultiNumGradFunction.h.
|
inlineoverride |
Destructor (no operations).
Definition at line 82 of file MultiNumGradFunction.h.
|
inlineoverridevirtual |
Clone a function.
Each derived class must implement their version of the Clone method.
Implements ROOT::Math::IBaseFunctionMultiDimTempl< double >.
Definition at line 93 of file MultiNumGradFunction.h.
|
inlineinherited |
In some cases, the derivative algorithm will use information from the previous step, these can be passed in with this overload.
The previous_* arrays can also be used to return second derivative and step size so that these can be passed forward again as well at the call site, if necessary.
Definition at line 120 of file IFunction.h.
|
inlineinherited |
Return the partial derivative with respect to the passed coordinate.
Definition at line 115 of file IFunction.h.
|
overrideprivatevirtual |
Function to evaluate the derivative with respect each coordinate. To be implemented by the derived class.
Reimplemented from ROOT::Math::IBaseFunctionMultiDimTempl< double >.
Definition at line 42 of file MultiNumGradFunction.cxx.
|
inlineprivatevirtualinherited |
In some cases, the derivative algorithm will use information from the previous step, these can be passed in with this overload.
The previous_* arrays can also be used to return second derivative and step size so that these can be passed forward again as well at the call site, if necessary.
Definition at line 136 of file IFunction.h.
|
inlineoverrideprivatevirtual |
Implementation of the evaluation function. Must be implemented by derived classes.
Implements ROOT::Math::IBaseFunctionMultiDimTempl< double >.
Definition at line 118 of file MultiNumGradFunction.h.
|
inlinevirtualinherited |
Optimized method to evaluate at the same time the function value and derivative at a point x.
Often both value and derivatives are needed and it is often more efficient to compute them at the same time. Derived class should implement this method if performances play an important role and if it is faster to evaluate value and derivative at the same time
Definition at line 108 of file IFunction.h.
|
static |
get precision value used for calculating the derivative step-size
Definition at line 56 of file MultiNumGradFunction.cxx.
|
inlinevirtualinherited |
Evaluate all the vector of function derivatives (gradient) at a point x.
Derived classes must re-implement it if more efficient than evaluating one at a time
Definition at line 96 of file IFunction.h.
|
inlineoverridevirtualinherited |
Reimplemented from ROOT::Math::IBaseFunctionMultiDimTempl< double >.
Definition at line 243 of file IFunction.h.
|
inline |
Definition at line 91 of file MultiNumGradFunction.h.
|
inlineoverridevirtual |
Retrieve the dimension of the function.
Implements ROOT::Math::IBaseFunctionMultiDimTempl< double >.
Definition at line 89 of file MultiNumGradFunction.h.
|
inlineinherited |
Evaluate the function at a point x[].
Use the pure virtual private method DoEval which must be implemented by the sub-classes.
Definition at line 81 of file IFunction.h.
|
static |
precision value used for calculating the derivative step-size h = eps * |x|.
The default is 0.001, give a smaller in case function chanes rapidly
Definition at line 54 of file MultiNumGradFunction.cxx.
|
inline |
Definition at line 105 of file MultiNumGradFunction.h.
|
private |
Definition at line 128 of file MultiNumGradFunction.h.
|
private |
Definition at line 127 of file MultiNumGradFunction.h.
|
staticprivate |
Definition at line 132 of file MultiNumGradFunction.h.
|
mutableprivate |
Definition at line 129 of file MultiNumGradFunction.h.
|
private |
Definition at line 130 of file MultiNumGradFunction.h.