Logo ROOT  
Reference Guide
 
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 implemention 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 401 of file Functor.h.

Public Types

typedef FunctorImpl< IBaseFunctionMultiDimImpl
 
typedef IBaseFunctionMultiDim::BaseFunc ImplBase
 
- Public Types inherited from ROOT::Math::IBaseFunctionMultiDimTempl< double >
typedef double BackendType
 
typedef IBaseFunctionMultiDimTempl< doubleBaseFunc
 

Public Member Functions

 Functor ()
 Default constructor.
 
template<typename Func >
 Functor (const Func &f, unsigned int dim)
 construct from a callable object of multi-dimension with the right signature (implementing operator()(const double *x)
 
 Functor (const Functor &rhs)
 Copy constructor for functor based on ROOT::Math::IMultiGenFunction.
 
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 (const std::function< double(double const *)> &f, unsigned int dim)
 specialized constructor from a std::function of multi-dimension with the right signature (double operator()(double const *x) This specialized constructor is introduced in order to use the Functor class in Python passing Python user defined functions
 
virtual ~Functor ()
 Destructor (no operations)
 
ImplBaseClone () const
 Clone a function.
 
unsigned int NDim () const
 Retrieve the dimension of the function.
 
Functoroperator= (const Functor &rhs)
 Assignment operator.
 
- Public Member Functions inherited from ROOT::Math::IBaseFunctionMultiDimTempl< double >
 IBaseFunctionMultiDimTempl ()
 
virtual ~IBaseFunctionMultiDimTempl ()
 virtual destructor
 
double operator() (const double *x) const
 Evaluate the function at a point x[].
 

Private Member Functions

double DoEval (const double *x) const
 Implementation of the evaluation function.
 

Private Attributes

std::unique_ptr< ImplfImpl
 

#include <Math/Functor.h>

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

Member Typedef Documentation

◆ Impl

◆ ImplBase

Constructor & Destructor Documentation

◆ Functor() [1/5]

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

Default constructor.

Definition at line 412 of file Functor.h.

◆ Functor() [2/5]

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 419 of file Functor.h.

◆ Functor() [3/5]

template<typename Func >
ROOT::Math::Functor::Functor ( const Func &  f,
unsigned int  dim 
)
inline

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

Definition at line 430 of file Functor.h.

◆ Functor() [4/5]

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

specialized constructor from a std::function of multi-dimension with the right signature (double operator()(double const *x) This specialized constructor is introduced in order to use the Functor class in Python passing Python user defined functions

Definition at line 441 of file Functor.h.

◆ ~Functor()

virtual ROOT::Math::Functor::~Functor ( )
inlinevirtual

Destructor (no operations)

Definition at line 448 of file Functor.h.

◆ Functor() [5/5]

ROOT::Math::Functor::Functor ( const Functor rhs)
inline

Copy constructor for functor based on ROOT::Math::IMultiGenFunction.

Definition at line 453 of file Functor.h.

Member Function Documentation

◆ Clone()

ImplBase * ROOT::Math::Functor::Clone ( ) const
inlinevirtual

Clone a function.

Each derived class must implement their version of the Clone method

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

Definition at line 473 of file Functor.h.

◆ DoEval()

double ROOT::Math::Functor::DoEval ( const double x) const
inlineprivatevirtual

Implementation of the evaluation function.

Must be implemented by derived classes

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

Definition at line 481 of file Functor.h.

◆ NDim()

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

Retrieve the dimension of the function.

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

Definition at line 476 of file Functor.h.

◆ operator=()

Functor & ROOT::Math::Functor::operator= ( const Functor rhs)
inline

Assignment operator.

Definition at line 465 of file Functor.h.

Member Data Documentation

◆ fImpl

std::unique_ptr<Impl> ROOT::Math::Functor::fImpl
private

Definition at line 486 of file Functor.h.

Libraries for ROOT::Math::Functor:

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