14 #ifndef ROOT_Math_Functor 15 #define ROOT_Math_Functor 17 #ifndef ROOT_Math_IFunction 44 template<
class IBaseFunc>
77 template<
class ParentFunctor,
class Func >
121 inline double DoEval (
const double *
x)
const {
126 return fFunc.Derivative(x);
130 return fFunc.Derivative(x,icoord);
153 template<
class ParentFunctor,
class Func,
class GradFunc >
196 inline double DoEval (
const double *
x)
const {
205 return fGradFunc(x, icoord);
225 template <
class ParentFunctor,
typename PointerToObj,
226 typename PointerToMemFn>
237 : fDim(1), fObj(pObj), fMemFn(pMemFn)
241 MemFunHandler(
unsigned int dim,
const PointerToObj& pObj, PointerToMemFn pMemFn)
242 : fDim(dim), fObj(pObj), fMemFn(pMemFn)
261 return ((*fObj).*fMemFn)(
x);
264 inline double DoEval (
const double *
x)
const {
265 return ((*fObj).*fMemFn)(
x);
285 template <
class ParentFunctor,
typename PointerToObj,
286 typename PointerToMemFn,
typename PointerToGradMemFn>
296 MemGradFunHandler(
const PointerToObj& pObj, PointerToMemFn pMemFn, PointerToGradMemFn pGradMemFn)
300 fGradMemFn(pGradMemFn)
305 const PointerToObj& pObj,
306 PointerToMemFn pMemFn,
307 PointerToGradMemFn pGradMemFn )
311 fGradMemFn(pGradMemFn)
330 return ((*fObj).*fMemFn)(
x);
333 inline double DoEval (
const double *
x)
const {
334 return ((*fObj).*fMemFn)(
x);
338 return ((*fObj).*fGradMemFn)(
x);
342 return ((*fObj).*fGradMemFn)(
x,icoord);
411 template <
class PtrObj,
typename MemFn>
412 Functor(
const PtrObj& p, MemFn memFn,
unsigned int dim )
422 template <
typename Func>
440 fImpl = std::unique_ptr<Impl>( (rhs.
fImpl)->
Copy() );
451 fImpl.swap( copy.
fImpl);
464 unsigned int NDim()
const {
return fImpl->NDim(); }
469 inline double DoEval (
const double *
x)
const {
511 template <
typename Func>
520 template <
class PtrObj,
typename MemFn>
540 fImpl = std::unique_ptr<Impl>( (rhs.
fImpl)->
Copy() );
549 fImpl.swap( copy.
fImpl);
612 template <
typename Func>
620 template <
class PtrObj,
typename MemFn,
typename GradMemFn>
621 GradFunctor(
const PtrObj& p, MemFn memFn, GradMemFn gradFn,
unsigned int dim )
630 template <
typename Func,
typename GradFunc>
649 fImpl = std::unique_ptr<Impl>( rhs.
fImpl->Copy() );
657 fImpl.swap(copy.
fImpl);
670 unsigned int NDim()
const {
return fImpl->NDim(); }
675 inline double DoEval (
const double *
x)
const {
681 return fImpl->Derivative(x,icoord);
728 template <
typename Func>
739 template <
class PtrObj,
typename MemFn,
typename GradMemFn>
749 template <
typename Func,
typename GradFunc>
768 fImpl = std::unique_ptr<Impl>( rhs.
fImpl->Copy() );
777 fImpl.swap(copy.
fImpl);
799 return fImpl->Derivative(x);
FunctorHandler(const Func &fun)
Interface (abstract class) for multi-dimensional functions providing a gradient calculation.
GradFunctor1D(const Func &f, const GradFunc &g)
construct from two 1D function objects
FunctorImpl< IBaseFunctionMultiDim > Impl
Functor Handler class is responsible for wrapping any other functor and pointer to free C functions...
Interface (abstract class) for generic functions objects of one-dimension Provides a method to evalua...
FunctorImpl< IGradientFunctionMultiDim > Impl
double DoEval(const double *x) const
MemFunHandler(const PointerToObj &pObj, PointerToMemFn pMemFn)
constructor from a pointer to the class and a pointer to the function
virtual FunctorImpl * Copy() const =0
virtual ~FunctorGradHandler()
This namespace contains pre-defined functions to be used in conjuction with TExecutor::Map and TExecu...
GradFunctor class for Multidimensional gradient functions.
double DoEval(const double *x) const
Implementation of the evaluation function.
double DoEval(const double *x) const
GradFunctor1D class for one-dimensional gradient functions.
FunctorImpl< IGradientFunctionOneDim > Impl
GradFunctor1D(const GradFunctor1D &rhs)
Copy constructor for Functor based on ROOT::Math::IGradFunction.
Documentation for class Functor class.
unsigned int NDim() const
Retrieve the dimension of the function.
double DoEval(const double *x) const
IBaseFunctionOneDim::BaseFunc ImplBase
GradFunctor1D(const Func &f)
construct from an object with the right signature implementing both operator() (double x) and Derivat...
virtual ~MemGradFunHandler()
double DoEval(double x) const
unsigned int NDim() const
GradFunctor()
Default constructor.
double DoDerivative(const double *x, unsigned int icoord) const
std::unique_ptr< Impl > fImpl
FunctorHandler(unsigned int dim, const Func &fun)
MemGradFunHandler(const PointerToObj &pObj, PointerToMemFn pMemFn, PointerToGradMemFn pGradMemFn)
constructor from a pointer to the class and a pointer to the function
Interface (abstract class) for one-dimensional functions providing a gradient calculation.
GradFunctor(const Func &f, const GradFunc &g, int dim)
construct for Gradient Functions of multi-dimension Func gives the function evaluatiion, GradFunc the partial derivatives The function dimension is required
GradFunctor(const Func &f, unsigned int dim)
construct from a callable object of multi-dimension implementing operator()(const double *x) and Deri...
ImplFunc::BaseFunc BaseFunc
FunctorGradHandler(unsigned int dim, const Func &fun, const GradFunc &gfun)
virtual ~GradFunctor()
Destructor (no operations)
Functor(const Func &f, unsigned int dim)
construct from a callable object of multi-dimension with the right signature (implementing operator()...
ImplBase * Clone() const
Clone a function.
double DoEval(const double *x) const
ParentFunctor::Impl ImplFunc
Functor1D(const Functor1D &rhs)
Copy constructor for Functor based on ROOT::Math::IGenFunction.
ParentFunctor::Impl ImplFunc
GradFunctor1D()
Default constructor.
Functor Handler to Wrap pointers to member functions The member function type must be (XXX means any ...
Functor1D(const PtrObj &p, MemFn memFn)
construct from a pointer to member function (1D type)
Functor(const PtrObj &p, MemFn memFn, unsigned int dim)
construct from a pointer to member function (multi-dim type)
ImplBase * Clone() const
Clone a function.
MemGradFunHandler(unsigned int dim, const PointerToObj &pObj, PointerToMemFn pMemFn, PointerToGradMemFn pGradMemFn)
constructor from a pointer to the class and a pointer to the function
double DoDerivative(const double *x, unsigned int icoord) const
function to evaluate the derivative with respect each coordinate.
Functor(const Functor &rhs)
Copy constructor for functor based on ROOT::Math::IMultiGenFunction.
FunctorImpl is a base class for the functor handler implementation class.
IParamFunction interface (abstract class) describing multi-dimensional parameteric functions It is a ...
Functor1D()
Default constructor.
GradFunctor(const GradFunctor &rhs)
Copy constructor for functor based on ROOT::Math::IMultiGradFunction.
std::unique_ptr< Impl > fImpl
unsigned int NDim() const
GradFunctor(const PtrObj &p, MemFn memFn, GradMemFn gradFn, unsigned int dim)
construct from a pointer to member function and member function types for function and derivative eva...
double DoDerivative(double x) const
Functor()
Default constructor.
virtual ~FunctorHandler()
std::unique_ptr< Impl > fImpl
virtual ~Functor1D()
Destructor (no operations)
GradFunctor1D(const PtrObj &p, MemFn memFn, GradMemFn gradFn)
construct from a pointer to class and two pointers to member functions, one for the function evaluati...
IGradientFunctionOneDim::BaseFunc ImplBase
double DoEval(double x) const
ImplBase * Clone() const
Clone a function.
double DoDerivative(const double *x, unsigned int icoord) const
double DoDerivative(double x) const
function to evaluate the derivative with respect each coordinate.
double DoEval(double x) const
Functor1D(const Func &f)
construct from a callable object with the right signature implementing operator() (double x) ...
double DoDerivative(double x) const
virtual ~Functor()
Destructor (no operations)
Namespace for new Math classes and functions.
PointerToGradMemFn fGradMemFn
ImplFunc::BaseFunc BaseFunc
ParentFunctor::Impl ImplFunc
MemFunHandler(unsigned int dim, const PointerToObj &pObj, PointerToMemFn pMemFn)
constructor from a pointer to the class and a pointer to the function
double DoEval(const double *x) const
Implementation of the evaluation function.
unsigned int NDim() const
double DoDerivative(const double *x, unsigned int icoord) const
virtual ~GradFunctor1D()
Destructor (no operations)
ParentFunctor::Impl ImplFunc
std::unique_ptr< Impl > fImpl
Functor Handler to Wrap pointers to member functions for the evaluation of the function and the gradi...
FunctorGradHandler(const Func &fun, const GradFunc &gfun)
ImplBase * Clone() const
Clone a function.
double DoEval(double x) const
implementation of the evaluation function. Must be implemented by derived classes ...
unsigned int NDim() const
double DoEval(double x) const
implementation of the evaluation function. Must be implemented by derived classes ...
Functor1D class for one-dimensional functions.
IGradientFunctionMultiDim::BaseFunc ImplBase
unsigned int NDim() const
Retrieve the dimension of the function.
ImplFunc::BaseFunc BaseFunc
Documentation for the abstract class IBaseFunctionMultiDim.
ImplFunc::BaseFunc BaseFunc
IBaseFunctionMultiDim::BaseFunc ImplBase
double DoDerivative(double x) const
double DoEval(double x) const
FunctorImpl< IBaseFunctionOneDim > Impl
Functor Handler class for gradient functions where both callable objects are provided for the functio...