36#include "gsl/gsl_deriv.h"
50 std::cerr <<
"GSLDerivator: Error : The function has not been specified" << std::endl;
61 std::cerr <<
"GSLDerivator: Error : The function has not been specified" << std::endl;
72 std::cerr <<
"GSLDerivator: Error : The function has not been specified" << std::endl;
84 double result, error = 0;
86 gsl_deriv_central( gslfw.
GetFunc(),
x,
h, &result, &error);
93 double result, error = 0;
95 gsl_deriv_forward( gslfw.
GetFunc(),
x,
h, &result, &error);
102 double result, error = 0;
104 gsl_deriv_backward( gslfw.
GetFunc(),
x,
h, &result, &error);
void SetFunction(const IGenFunction &f)
Set the function for calculating the derivatives.
double Result() const
return the result of the last derivative calculation
double EvalForward(double x, double h)
Computes the numerical derivative at a point x using an adaptive forward difference algorithm with a ...
double EvalCentral(double x, double h)
Computes the numerical derivative at a point x using an adaptive central difference algorithm with a ...
GSLFunctionWrapper fFunction
double Error() const
return the estimate of the absolute error of the last derivative calculation
int Status() const
return the error status of the last integral calculation
double EvalBackward(double x, double h)
Computes the numerical derivative at a point x using an adaptive backward difference algorithm with a...
Wrapper class to the gsl_function C structure.
void SetFunction(const FuncType &f)
fill the GSL C struct from a generic C++ callable object implementing operator()
void SetFuncPointer(GSLFuncPointer f)
set in the GSL C struct the pointer to the function evaluation
void SetParams(void *p)
set in the GSL C struct the extra-object pointer
bool IsValid()
check if function is valid (has been set)
Interface (abstract class) for generic functions objects of one-dimension Provides a method to evalua...
Namespace for new Math classes and functions.
double(* GSLFuncPointer)(double, void *)
Function pointer corresponding to gsl_function signature.