Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches

Functor1D class for one-dimensional functions.

It is used to wrap in a very simple and convenient way:

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

Definition at line 95 of file Functor.h.

Public Member Functions

 Functor1D ()=default
 Default constructor.
 
template<class PtrObj , typename MemFn >
 Functor1D (const PtrObj &p, MemFn memFn)
 
 Functor1D (std::function< double(double)> const &f)
 Construct from a callable object with the right signature implementing double operator() (double x).
 
Functor1DClone () const override
 Clone a function.
 
- Public Member Functions inherited from ROOT::Math::IBaseFunctionOneDim
virtual ~IBaseFunctionOneDim ()=default
 
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

std::function< double(double)> fFunc
 

Additional Inherited Members

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

#include <Math/Functor.h>

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

Constructor & Destructor Documentation

◆ Functor1D() [1/3]

ROOT::Math::Functor1D::Functor1D ( )
default

Default constructor.

◆ Functor1D() [2/3]

ROOT::Math::Functor1D::Functor1D ( std::function< double(double)> const &  f)
inline

Construct from a callable object with the right signature implementing double operator() (double x).

Definition at line 104 of file Functor.h.

◆ Functor1D() [3/3]

template<class PtrObj , typename MemFn >
ROOT::Math::Functor1D::Functor1D ( const PtrObj &  p,
MemFn  memFn 
)
inline

Definition at line 108 of file Functor.h.

Member Function Documentation

◆ Clone()

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

Clone a function.

Each derived class will implement their version of the private DoClone method.

Implements ROOT::Math::IBaseFunctionOneDim.

Definition at line 111 of file Functor.h.

◆ DoEval()

double ROOT::Math::Functor1D::DoEval ( double  x) const
inlineoverrideprivatevirtual

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

Implements ROOT::Math::IBaseFunctionOneDim.

Definition at line 115 of file Functor.h.

Member Data Documentation

◆ fFunc

std::function<double(double)> ROOT::Math::Functor1D::fFunc
private

Definition at line 119 of file Functor.h.

Libraries for ROOT::Math::Functor1D:

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