BornAgain
1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
|
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 T | BackendType |
typedef IBaseFunctionMultiDimTempl< T > | BaseFunc |
typedef IGradientMultiDimTempl< T > | BaseGrad |
Public Member Functions | |
MultiNumGradFunction (const IMultiGenFunction &f) | |
template<class FuncType > | |
MultiNumGradFunction (FuncType f, int n) | |
~MultiNumGradFunction () | |
IMultiGenFunction * | Clone () const |
T | Derivative (const T *x, unsigned int icoord=0) const |
virtual void | FdF (const T *x, T &f, T *df) const |
virtual void | Gradient (const T *x, T *grad) const |
unsigned int | NCalls () const |
unsigned int | NDim () const |
virtual unsigned int | NDim () const=0 |
T | operator() (const T *x) const |
void | SetOwnership (bool on=true) |
Static Public Member Functions | |
static double | GetDerivPrecision () |
get precision value used for calculating the derivative step-size More... | |
static void | SetDerivPrecision (double eps) |
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 More... | |
Private Member Functions | |
double | DoDerivative (const double *x, unsigned int icoord) const |
double | DoEval (const double *x) const |
Private Attributes | |
unsigned int | fDim |
const IMultiGenFunction * | fFunc |
unsigned int | fNCalls |
bool | fOwner |
Static Private Attributes | |
static double | fgEps |
|
inherited |
Definition at line 66 of file IFunction.h.
|
inherited |
Definition at line 330 of file IFunction.h.
|
inherited |
Definition at line 331 of file IFunction.h.
|
inline |
Constructor from a IMultiGenFunction interface
Definition at line 57 of file MultiNumGradFunction.h.
Referenced by Clone().
|
inline |
Constructor from a generic function (pointer or reference) and number of dimension implementiong operator () (double * x)
Definition at line 70 of file MultiNumGradFunction.h.
References fFunc.
|
inline |
|
inlinevirtual |
Clone a function. Each derived class must implement their version of the Clone method
Implements ROOT::Math::IBaseFunctionMultiDimTempl< T >.
Definition at line 93 of file MultiNumGradFunction.h.
References MultiNumGradFunction(), ROOT::Math::IBaseFunctionMultiDimTempl< T >::Clone(), fFunc, and fOwner.
|
inlineinherited |
Return the partial derivative with respect to the passed coordinate
Definition at line 217 of file IFunction.h.
References ROOT::Math::IGradientMultiDimTempl< T >::DoDerivative().
Referenced by ROOT::Math::MinimTransformFunction::DoDerivative(), and ROOT::Math::IGradientFunctionMultiDimTempl< T >::Gradient().
|
private |
|
inlineprivate |
|
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
Implements ROOT::Math::IGradientMultiDimTempl< T >.
Definition at line 357 of file IFunction.h.
References ROOT::Math::IGradientFunctionMultiDimTempl< T >::Gradient(), and ROOT::Math::IBaseFunctionMultiDimTempl< T >::operator()().
|
static |
get precision value used for calculating the derivative step-size
|
inlinevirtualinherited |
Evaluate all the vector of function derivatives (gradient) at a point x. Derived classes must re-implement it if more efficient than evaluting one at a time
Implements ROOT::Math::IGradientMultiDimTempl< T >.
Definition at line 342 of file IFunction.h.
References ROOT::Math::IGradientMultiDimTempl< T >::Derivative(), and ROOT::Math::IGradientFunctionMultiDimTempl< T >::NDim().
Referenced by ROOT::Math::IGradientFunctionMultiDimTempl< T >::FdF().
|
inline |
|
inlinevirtual |
Retrieve the dimension of the function
Implements ROOT::Math::IBaseFunctionMultiDimTempl< T >.
Definition at line 89 of file MultiNumGradFunction.h.
References fDim.
|
inherited |
Retrieve the dimension of the function
Referenced by ROOT::Math::IGradientFunctionMultiDimTempl< T >::Gradient(), ROOT::Math::MinimTransformFunction::NTot(), and ROOT::Math::GSLMultiMinimizer::Set().
|
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 92 of file IFunction.h.
References ROOT::Math::IBaseFunctionMultiDimTempl< T >::DoEval().
Referenced by ROOT::Math::IGradientFunctionMultiDimTempl< T >::FdF().
|
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
|
inline |
|
private |
Definition at line 128 of file MultiNumGradFunction.h.
Referenced by NDim().
|
private |
Definition at line 127 of file MultiNumGradFunction.h.
Referenced by MultiNumGradFunction(), ~MultiNumGradFunction(), Clone(), and DoEval().
|
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.
Referenced by ~MultiNumGradFunction(), Clone(), and SetOwnership().