ROOT 6.18/05 Reference Guide |
Class for computing numerical derivative of a function.
Presently this class is implemented only using the numerical derivatives algorithms provided by GSL using the implementation class ROOT::Math::GSLDerivator
This class does not support copying
Definition at line 61 of file Derivator.h.
Public Types | |
typedef double(* | GSLFuncPointer) (double, void *) |
signature for function pointers used by GSL More... | |
Public Member Functions | |
Derivator () | |
Empty Construct for a Derivator class Need to set the function afterwards with Derivator::SetFunction. More... | |
Derivator (const GSLFuncPointer &f, void *p=0) | |
Construct using a GSL function pointer type. More... | |
Derivator (const IGenFunction &f) | |
Construct using a ROOT::Math::IGenFunction interface. More... | |
virtual | ~Derivator () |
destructor More... | |
double | Eval (double x, double h=1E-8) const |
Computes the numerical derivative of a function f at a point x. More... | |
double | EvalBackward (double x, double h=1E-8) const |
Computes the numerical derivative at a point x using an adaptive backward difference algorithm with a step size h. More... | |
double | EvalCentral (double x, double h=1E-8) const |
Computes the numerical derivative at a point x using an adaptive central difference algorithm with a step size h. More... | |
double | EvalForward (double x, double h=1E-8) const |
Computes the numerical derivative at a point x using an adaptive forward difference algorithm with a step size h. More... | |
void | SetFunction (const GSLFuncPointer &f, void *p=0) |
Set the function f for evaluating the derivative using a GSL function pointer type. More... | |
void | SetFunction (const IGenFunction &f) |
Set the function for calculating the derivatives. More... | |
Private Member Functions | |
Derivator (const Derivator &) | |
Derivator & | operator= (const Derivator &) |
— Static methods — | |
This methods don't require to use a Derivator object, and are designed to be used in fast calculation. Error and status code cannot be retrieved in this case | |
GSLDerivator * | fDerivator |
int | Status () const |
return the error status of the last derivative calculation More... | |
double | Result () const |
return the result of the last derivative calculation More... | |
double | Error () const |
return the estimate of the absolute error of the last derivative calculation More... | |
static double | Eval (const IGenFunction &f, double x, double h=1E-8) |
Computes the numerical derivative of a function f at a point x. More... | |
static double | EvalCentral (const IGenFunction &f, double x, double h=1E-8) |
Computes the numerical derivative of a function f at a point x using an adaptive central difference algorithm with a step size h. More... | |
static double | EvalForward (const IGenFunction &f, double x, double h=1E-8) |
Computes the numerical derivative of a function f at a point x using an adaptive forward difference algorithm with a step size h. More... | |
static double | EvalBackward (const IGenFunction &f, double x, double h=1E-8) |
Computes the numerical derivative of a function f at a point x using an adaptive backward difference algorithm with a step size h. More... | |
static double | Eval (const IMultiGenFunction &f, const double *x, unsigned int icoord=0, double h=1E-8) |
Evaluate the partial derivative of a multi-dim function with respect coordinate x_icoord at the point x[]. More... | |
static double | Eval (IParamFunction &f, double x, const double *p, unsigned int ipar=0, double h=1E-8) |
Evaluate the derivative with respect a parameter for one-dim parameteric function at the point ( x,p[]) with respect the parameter p_ipar. More... | |
static double | Eval (IParamMultiFunction &f, const double *x, const double *p, unsigned int ipar=0, double h=1E-8) |
Evaluate the derivative with respect a parameter for a multi-dim parameteric function at the point ( x[],p[]) with respect the parameter p_ipar. More... | |
#include <Math/Derivator.h>
typedef double(* ROOT::Math::Derivator::GSLFuncPointer) (double, void *) |
signature for function pointers used by GSL
Definition at line 68 of file Derivator.h.
ROOT::Math::Derivator::Derivator | ( | ) |
Empty Construct for a Derivator class Need to set the function afterwards with Derivator::SetFunction.
Definition at line 47 of file Derivator.cxx.
|
explicit |
Construct using a ROOT::Math::IGenFunction interface.
Definition at line 51 of file Derivator.cxx.
|
explicit |
Construct using a GSL function pointer type.
f | : free function pointer of the GSL required type |
p | : pointer to the object carrying the function state (for example the function object itself) |
Definition at line 58 of file Derivator.cxx.
|
virtual |
destructor
Definition at line 66 of file Derivator.cxx.
|
private |
Definition at line 72 of file Derivator.cxx.
double ROOT::Math::Derivator::Error | ( | ) | const |
return the estimate of the absolute error of the last derivative calculation
Definition at line 154 of file Derivator.cxx.
|
static |
Computes the numerical derivative of a function f at a point x.
It uses Derivator::EvalCentral to compute the derivative using an adaptive central difference algorithm with a step size h
Definition at line 110 of file Derivator.cxx.
|
static |
Evaluate the partial derivative of a multi-dim function with respect coordinate x_icoord at the point x[].
Definition at line 126 of file Derivator.cxx.
double ROOT::Math::Derivator::Eval | ( | double | x, |
double | h = 1E-8 |
||
) | const |
Computes the numerical derivative of a function f at a point x.
It uses Derivator::EvalCentral to compute the derivative using an adaptive central difference algorithm with a step size h
Definition at line 93 of file Derivator.cxx.
|
static |
Evaluate the derivative with respect a parameter for one-dim parameteric function at the point ( x,p[]) with respect the parameter p_ipar.
Definition at line 134 of file Derivator.cxx.
|
static |
Evaluate the derivative with respect a parameter for a multi-dim parameteric function at the point ( x[],p[]) with respect the parameter p_ipar.
Definition at line 143 of file Derivator.cxx.
|
static |
Computes the numerical derivative of a function f at a point x using an adaptive backward difference algorithm with a step size h.
The function is evaluated only at points less than x and at x itself
Definition at line 122 of file Derivator.cxx.
double ROOT::Math::Derivator::EvalBackward | ( | double | x, |
double | h = 1E-8 |
||
) | const |
Computes the numerical derivative at a point x using an adaptive backward difference algorithm with a step size h.
The function is evaluated only at points less than x and at x itself.
Definition at line 105 of file Derivator.cxx.
|
static |
Computes the numerical derivative of a function f at a point x using an adaptive central difference algorithm with a step size h.
Definition at line 114 of file Derivator.cxx.
double ROOT::Math::Derivator::EvalCentral | ( | double | x, |
double | h = 1E-8 |
||
) | const |
Computes the numerical derivative at a point x using an adaptive central difference algorithm with a step size h.
Definition at line 97 of file Derivator.cxx.
|
static |
Computes the numerical derivative of a function f at a point x using an adaptive forward difference algorithm with a step size h.
The function is evaluated only at points greater than x and at x itself
Definition at line 118 of file Derivator.cxx.
double ROOT::Math::Derivator::EvalForward | ( | double | x, |
double | h = 1E-8 |
||
) | const |
Computes the numerical derivative at a point x using an adaptive forward difference algorithm with a step size h.
The function is evaluated only at points greater than x and at x itself.
Definition at line 101 of file Derivator.cxx.
Definition at line 76 of file Derivator.cxx.
double ROOT::Math::Derivator::Result | ( | ) | const |
return the result of the last derivative calculation
Definition at line 152 of file Derivator.cxx.
void ROOT::Math::Derivator::SetFunction | ( | const GSLFuncPointer & | f, |
void * | p = 0 |
||
) |
Set the function f for evaluating the derivative using a GSL function pointer type.
f | : free function pointer of the GSL required type |
p | : pointer to the object carrying the function state (for example the function object itself) |
Definition at line 88 of file Derivator.cxx.
void ROOT::Math::Derivator::SetFunction | ( | const IGenFunction & | f | ) |
Set the function for calculating the derivatives.
The function must implement the ROOT::Math::IGenFunction signature
Definition at line 84 of file Derivator.cxx.
int ROOT::Math::Derivator::Status | ( | ) | const |
return the error status of the last derivative calculation
Definition at line 156 of file Derivator.cxx.
|
mutableprivate |
Definition at line 232 of file Derivator.h.