GradFunctor class for Multidimensional gradient functions.
It is used to wrap in a very C++ callable object to make gradient functions. It can be constructed in three different way:
-
from an object implementing both double operator()( const double * ) for the function evaluation and double Derivative(const double *, int icoord) for the partial derivatives
-
from an object implementing any member function like Foo::XXX(const double *) for the function evaluation and any member function like Foo::XXX(const double *, int icoord) for the partial derivatives
-
from two function objects implementing double operator()( const double * ) for the function evaluation and another function object implementing double operator() (const double *, int icoord) for the partial derivatives
-
from two function objects
The function dimension is required when constructing the functor.
Definition at line 142 of file Functor.h.
|
| GradFunctor ()=default |
| Default constructor.
|
|
template<typename Func > |
| GradFunctor (const Func &f, unsigned int dim) |
| construct from a callable object of multi-dimension implementing operator()(const double *x) and Derivative(const double * x,icoord)
|
|
template<class PtrObj , typename MemFn , typename DerivMemFn , std::enable_if_t< std::is_floating_point< decltype((std::declval< std::remove_pointer_t< PtrObj > >().*std::declval< DerivMemFn >())(std::declval< const double * >(), std::declval< int >()))>::value , bool > |
| GradFunctor (const PtrObj &p, MemFn memFn, DerivMemFn gradFn, unsigned int dim) |
| Construct from a pointer to member function and member function types for function and derivative evaluations.
|
|
template<class PtrObj , typename MemFn , typename GradMemFn , std::enable_if_t< std::is_void< decltype((std::declval< std::remove_pointer_t< PtrObj > >().*std::declval< GradMemFn >())(std::declval< const double * >(), std::declval< double * >()))>::value , bool > |
| 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 full derivative evaluations.
|
|
| GradFunctor (std::function< double(double const *)> const &f, std::function< double(double const *, unsigned int)> const &g, unsigned int dim) |
| Construct for Gradient Functions of multi-dimension Func gives the function evaluation, GradFunc the partial derivatives The function dimension is required.
|
|
| GradFunctor (std::function< double(double const *)> const &f, unsigned int dim, std::function< void(double const *, double *)> const &g) |
| Construct a new GradFunctor object using 2 std::function, one for the function evaluation and one for the Gradient Note the difference with the constructor above where partial derivative function is used as input.
|
|
GradFunctor * | Clone () const override |
| Clone a function.
|
|
void | Gradient (const double *x, double *g) const override |
|
unsigned int | NDim () const override |
| Retrieve the dimension of the function.
|
|
T | Derivative (const T *x, unsigned int icoord, T *previous_grad, T *previous_g2, T *previous_gstep) const |
| In some cases, the derivative algorithm will use information from the previous step, these can be passed in with this overload.
|
|
T | Derivative (const T *x, unsigned int icoord=0) const |
| Return the partial derivative with respect to the passed coordinate.
|
|
virtual void | FdF (const T *x, T &f, T *df) const |
| Optimized method to evaluate at the same time the function value and derivative at a point x.
|
|
virtual void | Gradient (const T *x, T *grad) const |
| Evaluate all the vector of function derivatives (gradient) at a point x.
|
|
virtual void | GradientWithPrevResult (const T *x, T *grad, T *previous_grad, T *previous_g2, T *previous_gstep) const |
| In some cases, the gradient algorithm will use information from the previous step, these can be passed in with this overload.
|
|
bool | HasGradient () const |
|
virtual unsigned int | NDim () const=0 |
| Retrieve the dimension of the function.
|
|
virtual bool | returnsInMinuit2ParameterSpace () const |
|
virtual | ~IBaseFunctionMultiDimTempl ()=default |
|
T | operator() (const T *x) const |
| Evaluate the function at a point x[].
|
|