WrappedParamFunction class to wrap any multi-dimensional function object implementing the operator()(const double * x, const double * p) in an interface-like IParamFunction with a vector storing and caching internally the parameter values.
Definition at line 44 of file WrappedParamFunction.h.
Public Types | |
| typedef double | BackendType |
| typedef IBaseFunctionMultiDimTempl< double > | BaseFunc |
Public Member Functions | |
| template<class Iterator> | |
| WrappedParamFunction (FuncPtr func, unsigned int dim, Iterator begin, Iterator end) | |
| Constructor a wrapped function from a non-const pointer to a callable object, the function dimension and number of parameters which are set to zero by default This constructor is needed in the case FuncPtr is a std::unique_ptr which has a copy ctor taking non const objects. | |
| WrappedParamFunction (FuncPtr func, unsigned int dim=1, unsigned int npar=0, double *par=nullptr) | |
| Constructor a wrapped function from a pointer to a callable object, the function dimension and number of parameters which are set to zero by default. | |
| IMultiGenFunction * | Clone () const override |
| Constructor a wrapped function from a non - const pointer to a callable object, the function dimension and an iterator specifying begin and end of parameters. | |
| 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. | |
| virtual bool | HasGradient () const |
| unsigned int | NDim () const override |
| Retrieve the dimension of the function. | |
| unsigned int | NPar () const override |
| Return the number of Parameters. | |
| double | operator() (const double *x) const |
| double | operator() (const double *x, const double *p) const |
| Evaluate function at a point x and for given parameters p. | |
| virtual std::string | ParameterName (unsigned int i) const |
| Return the name of the i-th parameter (starting from zero) Overwrite if want to avoid the default name ("Par_0, Par_1, ..."). | |
| const double * | Parameters () const override |
| Access the parameter values. | |
| void | SetParameters (const double *p) override |
| Set the parameter values. | |
Private Member Functions | |
| virtual double | DoDerivative (const double *, unsigned int) const |
| 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 |
| Implement the ROOT::Math::IBaseFunctionMultiDim interface DoEval(x) using the cached parameter values. | |
| double | DoEvalPar (const double *x, const double *p) const override |
| evaluate the function given values and parameters (requested interface) | |
Private Attributes | |
| unsigned int | fDim |
| FuncPtr | fFunc |
| std::vector< double > | fParams |
#include <Math/WrappedParamFunction.h>
|
inherited |
Definition at line 67 of file IFunction.h.
|
inherited |
Definition at line 111 of file IParamFunction.h.
|
inline |
Constructor a wrapped function from a pointer to a callable object, the function dimension and number of parameters which are set to zero by default.
Definition at line 52 of file WrappedParamFunction.h.
|
inline |
Constructor a wrapped function from a non-const pointer to a callable object, the function dimension and number of parameters which are set to zero by default This constructor is needed in the case FuncPtr is a std::unique_ptr which has a copy ctor taking non const objects.
Constructor a wrapped function from a pointer to a callable object, the function dimension and an iterator specifying begin and end of parameters
Definition at line 78 of file WrappedParamFunction.h.
|
inlineoverridevirtual |
Constructor a wrapped function from a non - const pointer to a callable object, the function dimension and an iterator specifying begin and end of parameters.
This constructor is needed in the case FuncPtr is a std::unique_ptr which has a copy ctor taking non const objects clone the function
Implements ROOT::Math::IBaseFunctionMultiDimTempl< double >.
Definition at line 96 of file WrappedParamFunction.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.
|
inlineprivatevirtualinherited |
Function to evaluate the derivative with respect each coordinate. To be implemented by the derived class.
Definition at line 131 of file IFunction.h.
|
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.
|
inlineoverrideprivatevirtualinherited |
Implement the ROOT::Math::IBaseFunctionMultiDim interface DoEval(x) using the cached parameter values.
Implements ROOT::Math::IBaseFunctionMultiDimTempl< double >.
Reimplemented in ROOT::Math::IParametricGradFunctionMultiDimTempl< double >, ROOT::Math::WrappedMultiTF1Templ< double >, and ROOT::Math::WrappedParamFunctionGen< FuncPtr >.
Definition at line 143 of file IParamFunction.h.
|
inlineoverrideprivatevirtual |
evaluate the function given values and parameters (requested interface)
Implements ROOT::Math::IParametricFunctionMultiDimTempl< double >.
Definition at line 116 of file WrappedParamFunction.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.
|
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.
|
inlinevirtualinherited |
Definition at line 92 of file IFunction.h.
|
inlineoverridevirtual |
Retrieve the dimension of the function.
Implements ROOT::Math::IBaseFunctionMultiDimTempl< double >.
Definition at line 110 of file WrappedParamFunction.h.
|
inlineoverridevirtual |
Return the number of Parameters.
Implements ROOT::Math::IBaseParam.
Definition at line 108 of file WrappedParamFunction.h.
|
inlineinherited |
Definition at line 128 of file IParamFunction.h.
|
inlineinherited |
Evaluate function at a point x and for given parameters p.
This method does not change the internal status of the function (internal parameter values). If for some reason one prefers caching the parameter values, SetParameters(p) and then operator()(x) should be called. Use the pure virtual function DoEvalPar to implement it
Definition at line 123 of file IParamFunction.h.
|
inlinevirtualinherited |
Return the name of the i-th parameter (starting from zero) Overwrite if want to avoid the default name ("Par_0, Par_1, ...").
Definition at line 86 of file IParamFunction.h.
|
inlineoverridevirtual |
Access the parameter values.
Implements ROOT::Math::IBaseParam.
Definition at line 100 of file WrappedParamFunction.h.
|
inlineoverridevirtual |
Set the parameter values.
| p | vector of doubles containing the parameter values. |
to be defined: can user change number of params ? At the moment no.
Implements ROOT::Math::IBaseParam.
Definition at line 104 of file WrappedParamFunction.h.
|
private |
Definition at line 122 of file WrappedParamFunction.h.
|
private |
Definition at line 121 of file WrappedParamFunction.h.
|
private |
Definition at line 123 of file WrappedParamFunction.h.