Logo ROOT  
Reference Guide
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Loading...
Searching...
No Matches

Documentation for class Functor class.

It is used to wrap in a very simple and convenient way multi-dimensional function objects. It can wrap all the following types:

  • any C++ callable object implementation double operator()( const double * )
  • a free C function of type double ()(const double * )
  • an std::function of type std::function<double (double const *)>
  • a member function with the correct signature like Foo::Eval(const double * ). In this case one pass the object pointer and a pointer to the member function (&Foo::Eval)

The function dimension is required when constructing the functor.

Definition at line 47 of file Functor.h.

Public Member Functions

 Functor ()
 Default constructor.
 
template<class PtrObj , typename MemFn >
 Functor (const PtrObj &p, MemFn memFn, unsigned int dim)
 Construct from a pointer to member function (multi-dim type).
 
 Functor (std::function< double(double const *)> const &f, unsigned int dim)
 Construct from a callable object of multi-dimension with the right signature (implementing double operator()(const double *x)).
 
FunctorClone () const override
 Clone a function.
 
unsigned int NDim () const override
 Retrieve the dimension of the function.
 
- Public Member Functions inherited from ROOT::Math::IBaseFunctionMultiDimTempl< double >
virtual ~IBaseFunctionMultiDimTempl ()=default
 
virtual bool HasGradient () const
 
double operator() (const double *x) const
 Evaluate the function at a point x[].
 

Private Member Functions

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

Private Attributes

unsigned int fDim
 
std::function< double(double const *) fFunc )
 

Additional Inherited Members

- Public Types inherited from ROOT::Math::IBaseFunctionMultiDimTempl< double >
typedef double BackendType
 
typedef IBaseFunctionMultiDimTempl< doubleBaseFunc
 

#include <Math/Functor.h>

Inheritance diagram for ROOT::Math::Functor:
[legend]

Constructor & Destructor Documentation

◆ Functor() [1/3]

ROOT::Math::Functor::Functor ( )
inline

Default constructor.

Definition at line 52 of file Functor.h.

◆ Functor() [2/3]

template<class PtrObj , typename MemFn >
ROOT::Math::Functor::Functor ( const PtrObj & p,
MemFn memFn,
unsigned int dim )
inline

Construct from a pointer to member function (multi-dim type).

Definition at line 56 of file Functor.h.

◆ Functor() [3/3]

ROOT::Math::Functor::Functor ( std::function< double(double const *)> const & f,
unsigned int dim )
inline

Construct from a callable object of multi-dimension with the right signature (implementing double operator()(const double *x)).

Definition at line 62 of file Functor.h.

Member Function Documentation

◆ Clone()

Functor * ROOT::Math::Functor::Clone ( ) const
inlineoverridevirtual

Clone a function.

Each derived class must implement their version of the Clone method.

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

Definition at line 65 of file Functor.h.

◆ DoEval()

double ROOT::Math::Functor::DoEval ( const double * x) const
inlineoverrideprivatevirtual

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

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

Definition at line 72 of file Functor.h.

◆ NDim()

unsigned int ROOT::Math::Functor::NDim ( ) const
inlineoverridevirtual

Retrieve the dimension of the function.

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

Definition at line 68 of file Functor.h.

Member Data Documentation

◆ fDim

unsigned int ROOT::Math::Functor::fDim
private

Definition at line 76 of file Functor.h.

◆ fFunc

std::function<double(double const *) ROOT::Math::Functor::fFunc)
private

Definition at line 77 of file Functor.h.

Libraries for ROOT::Math::Functor:

The documentation for this class was generated from the following file: