BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
ROOT::Math::IGradientFunctionOneDim Class Referenceabstract

Description

Interface (abstract class) for one-dimensional functions providing a gradient calculation. It implements both the ROOT::Math::IBaseFunctionOneDim and ROOT::Math::IGradientOneDim interfaces. The method ROOT::Math::IFunction::Derivative calculates the derivative and ROOT::Math::Fdf calculates the derivative and the function values at the same time. The pure private virtual method DoDerivative() must be implemented by the derived classes, while FdF is by default implemented using DoDerivative, but it can be overloaded by the derived classes to improve the efficiency in the derivative calculation.

Definition at line 381 of file IFunction.h.

Inheritance diagram for ROOT::Math::IGradientFunctionOneDim:
[legend]
Collaboration diagram for ROOT::Math::IGradientFunctionOneDim:
[legend]

Public Types

typedef IBaseFunctionOneDim BaseFunc
 
typedef IGradientOneDim BaseGrad
 

Public Member Functions

virtual ~IGradientFunctionOneDim ()
 
virtual IBaseFunctionOneDimClone () const =0
 
double Derivative (const double *x) const
 
double Derivative (double x) const
 
void FdF (const double *x, double &f, double *df) const
 
virtual void FdF (double x, double &f, double &df) const
 
void Gradient (const double *x, double *g) const
 
double operator() (const double *x) const
 
double operator() (double x) const
 

Private Member Functions

virtual double DoDerivative (double x) const =0
 
virtual double DoEval (double x) const =0
 implementation of the evaluation function. Must be implemented by derived classes More...
 

Member Typedef Documentation

◆ BaseFunc

◆ BaseGrad

Constructor & Destructor Documentation

◆ ~IGradientFunctionOneDim()

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

Virtual Destructor (no operations)

Definition at line 395 of file IFunction.h.

395 {}

Member Function Documentation

◆ Clone()

virtual IBaseFunctionOneDim* ROOT::Math::IBaseFunctionOneDim::Clone ( ) const
pure virtualinherited

◆ Derivative() [1/2]

double ROOT::Math::IGradientOneDim::Derivative ( const double *  x) const
inlineinherited

Compatibility method with multi-dimensional interface for partial derivative

Definition at line 277 of file IFunction.h.

278  {
279  return DoDerivative(*x);
280  }
virtual double DoDerivative(double x) const =0

References ROOT::Math::IGradientOneDim::DoDerivative().

Here is the call graph for this function:

◆ Derivative() [2/2]

double ROOT::Math::IGradientOneDim::Derivative ( double  x) const
inlineinherited

Return the derivative of the function at a point x Use the private method DoDerivative

Definition at line 258 of file IFunction.h.

259  {
260  return DoDerivative(x);
261  }

References ROOT::Math::IGradientOneDim::DoDerivative().

Referenced by FdF().

Here is the call graph for this function:

◆ DoDerivative()

virtual double ROOT::Math::IGradientOneDim::DoDerivative ( double  x) const
privatepure virtualinherited

function to evaluate the derivative with respect each coordinate. To be implemented by the derived class

Implemented in ROOT::Math::GradFunctor1D.

Referenced by ROOT::Math::IGradientOneDim::Derivative(), and ROOT::Math::IGradientOneDim::Gradient().

◆ DoEval()

virtual double ROOT::Math::IBaseFunctionOneDim::DoEval ( double  x) const
privatepure virtualinherited

◆ FdF() [1/2]

void ROOT::Math::IGradientOneDim::FdF ( const double *  x,
double &  f,
double *  df 
) const
inlineinherited

Compatibility method with multi-dimensional interface for Gradient and function evaluation

Definition at line 293 of file IFunction.h.

294  {
295  FdF(*x, f, *df);
296  }
virtual void FdF(double x, double &f, double &df) const =0

References ROOT::Math::IGradientOneDim::FdF().

Here is the call graph for this function:

◆ FdF() [2/2]

virtual void ROOT::Math::IGradientFunctionOneDim::FdF ( double  x,
double &  f,
double &  df 
) const
inlinevirtual

Optimized method to evaluate at the same time the function value and derivative at a point x. Often both value and derivatives are needed and it is often more efficient to compute them at the same time. Derived class should implement this method if performances play an important role and if it is faster to evaluate value and derivative at the same time

Implements ROOT::Math::IGradientOneDim.

Definition at line 405 of file IFunction.h.

406  {
407  f = operator()(x);
408  df = Derivative(x);
409  }
double operator()(double x) const
Definition: IFunction.h:158
double Derivative(double x) const
Definition: IFunction.h:258

References ROOT::Math::IGradientOneDim::Derivative(), and ROOT::Math::IBaseFunctionOneDim::operator()().

Here is the call graph for this function:

◆ Gradient()

void ROOT::Math::IGradientOneDim::Gradient ( const double *  x,
double *  g 
) const
inlineinherited

Compatibility method with multi-dimensional interface for Gradient

Definition at line 285 of file IFunction.h.

286  {
287  g[0] = DoDerivative(*x);
288  }

References ROOT::Math::IGradientOneDim::DoDerivative().

Here is the call graph for this function:

◆ operator()() [1/2]

double ROOT::Math::IBaseFunctionOneDim::operator() ( const double *  x) const
inlineinherited

Evaluate the function at a point x[]. Compatible method with multi-dimensional functions

Definition at line 167 of file IFunction.h.

168  {
169  return DoEval(*x);
170  }
virtual double DoEval(double x) const =0
implementation of the evaluation function. Must be implemented by derived classes

References ROOT::Math::IBaseFunctionOneDim::DoEval().

Here is the call graph for this function:

◆ operator()() [2/2]

double ROOT::Math::IBaseFunctionOneDim::operator() ( double  x) const
inlineinherited

Evaluate the function at a point x Use the a pure virtual private method DoEval which must be implemented by sub-classes

Definition at line 158 of file IFunction.h.

159  {
160  return DoEval(x);
161  }

References ROOT::Math::IBaseFunctionOneDim::DoEval().

Referenced by FdF().

Here is the call graph for this function:

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