Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ROOT::Math::WrappedFunction< Func > Class Template Reference

template<typename Func = FreeFunctionPtr>
class ROOT::Math::WrappedFunction< Func >

Template class to wrap any C++ callable object which takes one argument i.e.

implementing operator() (double x) in a One-dimensional function interface. It provides a ROOT::Math::IGenFunction-like signature

Note: If you want to wrap just the reference (to avoid copying) you need to use Func& or const Func & as template parameter. The former should be used when the operator() is not a const method of Func

Definition at line 45 of file WrappedFunction.h.

Public Member Functions

 WrappedFunction (Func f)
 construct from the pointer to the object and the member function
 
WrappedFunction * Clone () const override
 clone (required by the interface)
 
- Public Member Functions inherited from ROOT::Math::IBaseFunctionOneDim
virtual ~IBaseFunctionOneDim ()=default
 
double Derivative (const double *x) const
 Compatibility method with multi-dimensional interface for partial derivative.
 
double Derivative (double x) const
 Return the derivative of the function at a point x Use the private method DoDerivative.
 
void FdF (const double *x, double &f, double *df) const
 Compatibility method with multi-dimensional interface for Gradient and function evaluation.
 
virtual void FdF (double x, double &f, double &df) const
 Optimized method to evaluate at the same time the function value and derivative at a point x.
 
void Gradient (const double *x, double *g) const
 Compatibility method with multi-dimensional interface for Gradient.
 
virtual bool HasGradient () const
 
double operator() (const double *x) const
 Evaluate the function at a point x[].
 
double operator() (double x) const
 Evaluate the function at a point x.
 

Private Member Functions

double DoEval (double x) const override
 implementation of the evaluation function. Must be implemented by derived classes
 

Private Attributes

Func fFunc
 

Additional Inherited Members

- Public Types inherited from ROOT::Math::IBaseFunctionOneDim
typedef IBaseFunctionOneDim BaseFunc
 

#include <Math/WrappedFunction.h>

Inheritance diagram for ROOT::Math::WrappedFunction< Func >:
[legend]

Constructor & Destructor Documentation

◆ WrappedFunction()

template<typename Func = FreeFunctionPtr>
ROOT::Math::WrappedFunction< Func >::WrappedFunction ( Func f)
inline

construct from the pointer to the object and the member function

Definition at line 53 of file WrappedFunction.h.

Member Function Documentation

◆ Clone()

template<typename Func = FreeFunctionPtr>
WrappedFunction * ROOT::Math::WrappedFunction< Func >::Clone ( ) const
inlineoverridevirtual

clone (required by the interface)

Implements ROOT::Math::IBaseFunctionOneDim.

Definition at line 60 of file WrappedFunction.h.

◆ DoEval()

template<typename Func = FreeFunctionPtr>
double ROOT::Math::WrappedFunction< Func >::DoEval ( double x) const
inlineoverrideprivatevirtual

implementation of the evaluation function. Must be implemented by derived classes

Implements ROOT::Math::IBaseFunctionOneDim.

Definition at line 68 of file WrappedFunction.h.

Member Data Documentation

◆ fFunc

template<typename Func = FreeFunctionPtr>
Func ROOT::Math::WrappedFunction< Func >::fFunc
private

Definition at line 73 of file WrappedFunction.h.

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