ROOT   Reference Guide
Searching...
No Matches
ROOT::Math::IGradientFunctionMultiDimTempl< T > Class Template Referenceabstract
template<class T>

Interface (abstract class) for multi-dimensional functions providing a gradient calculation.

The method ROOT::Math::IFunction::Gradient calculates the full gradient vector, ROOT::Math::IFunction::Derivative calculates the partial derivative for each coordinate and ROOT::Math::Fdf calculates the gradient and the function value at the same time. The pure private virtual method DoDerivative() must be implemented by the derived classes, while Gradient and FdF are by default implemented using DoDerivative, butthey can be overloaded by the derived classes to improve the efficiency in the derivative calculation.

Gradient interface (abstract class) defining the signature for calculating the gradient of a multi-dimensional function. Three methods are provided:

• Gradient(const double *x, double * grad) evaluate the full gradient vector at the vector value x
• Derivative(const double * x, int icoord) evaluate the partial derivative for the icoord coordinate
• FdF(const double *x, double &f, double * g) evaluate at the same time gradient and function/

Definition at line 168 of file IFunction.h.

Public Types

typedef IBaseFunctionMultiDimTempl< T > BaseFunc

Public Types inherited from ROOT::Math::IBaseFunctionMultiDimTempl< T >
typedef T BackendType

typedef IBaseFunctionMultiDimTempl< T > BaseFunc

Public Member Functions

Derivative (const T *x, unsigned int icoord, T *previous_grad, T *previous_g2, T *previous_gstep) const
In some cases, the derivative algorithm will use information from the previous step, these can be passed in with this overload.

Derivative (const T *x, unsigned int icoord=0) const
Return the partial derivative with respect to the passed coordinate.

virtual void FdF (const T *x, T &f, T *df) const
Optimized method to evaluate at the same time the function value and derivative at a point x.

Evaluate all the vector of function derivatives (gradient) at a point x.

In some cases, the gradient algorithm will use information from the previous step, these can be passed in with this overload.

virtual unsigned int NDim () const=0
Retrieve the dimension of the function.

virtual bool returnsInMinuit2ParameterSpace () const

Public Member Functions inherited from ROOT::Math::IBaseFunctionMultiDimTempl< T >
virtual ~IBaseFunctionMultiDimTempl ()=default

virtual IBaseFunctionMultiDimTempl< T > * Clone () const =0
Clone a function.

operator() (const T *x) const
Evaluate the function at a point x[].

Private Member Functions

virtual T DoDerivative (const T *x, unsigned int icoord) const =0
Function to evaluate the derivative with respect each coordinate. To be implemented by the derived class.

virtual T DoDerivativeWithPrevResult (const T *x, unsigned int icoord, T *, T *, T *) const
In some cases, the derivative algorithm will use information from the previous step, these can be passed in with this overload.

#include <Math/IFunction.h>

Inheritance diagram for ROOT::Math::IGradientFunctionMultiDimTempl< T >:
[legend]

◆ BaseFunc

template<class T >

Definition at line 171 of file IFunction.h.

template<class T >

Definition at line 172 of file IFunction.h.

◆ Derivative() [1/2]

template<class T >
 T ROOT::Math::IGradientFunctionMultiDimTempl< T >::Derivative ( const T * x, unsigned int icoord, T * previous_grad, T * previous_g2, T * previous_gstep ) const
inline

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 214 of file IFunction.h.

◆ Derivative() [2/2]

template<class T >
 T ROOT::Math::IGradientFunctionMultiDimTempl< T >::Derivative ( const T * x, unsigned int icoord = 0 ) const
inline

Return the partial derivative with respect to the passed coordinate.

Definition at line 209 of file IFunction.h.

◆ DoDerivative()

template<class T >
 virtual T ROOT::Math::IGradientFunctionMultiDimTempl< T >::DoDerivative ( const T * x, unsigned int icoord ) const
privatepure virtual

Function to evaluate the derivative with respect each coordinate. To be implemented by the derived class.

◆ DoDerivativeWithPrevResult()

template<class T >
 virtual T ROOT::Math::IGradientFunctionMultiDimTempl< T >::DoDerivativeWithPrevResult ( const T * x, unsigned int icoord, T * , T * , T * ) const
inlineprivatevirtual

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 231 of file IFunction.h.

◆ FdF()

template<class T >
 virtual void ROOT::Math::IGradientFunctionMultiDimTempl< T >::FdF ( const T * x, T & f, T * df ) const
inlinevirtual

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 202 of file IFunction.h.

template<class T >
inlinevirtual

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 177 of file IFunction.h.

template<class T >
 virtual void ROOT::Math::IGradientFunctionMultiDimTempl< T >::GradientWithPrevResult ( const T * x, T * grad, T * previous_grad, T * previous_g2, T * previous_gstep ) const
inlinevirtual

In some cases, the gradient 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 188 of file IFunction.h.

template<class T >
inlinevirtual

Reimplemented from ROOT::Math::IBaseFunctionMultiDimTempl< T >.

Definition at line 220 of file IFunction.h.

◆ NDim()

template<class T >
 virtual unsigned int ROOT::Math::IBaseFunctionMultiDimTempl< T >::NDim ( ) const
virtual

Retrieve the dimension of the function.

Implements ROOT::Math::IBaseFunctionMultiDimTempl< T >.

◆ returnsInMinuit2ParameterSpace()

template<class T >
 virtual bool ROOT::Math::IGradientFunctionMultiDimTempl< T >::returnsInMinuit2ParameterSpace ( ) const
inlinevirtual

Definition at line 222 of file IFunction.h.

• math/mathcore/inc/Math/IFunction.h