34 #include "gsl/gsl_integration.h"
63 fResult(0),fError(0),fStatus(-1),fNEval(-1),
84 fResult(0),fError(0),fStatus(-1),fNEval(-1),
102 fResult(0),fError(0),fStatus(-1),fNEval(-1),
120 fResult(0),fError(0),fStatus(-1),fNEval(-1),
128 std::string typeName(type);
129 std::transform(typeName.begin(), typeName.end(), typeName.begin(), (int(*)(int)) toupper );
130 if (typeName ==
"NONADAPTIVE")
132 else if (typeName ==
"ADAPTIVE")
135 if (typeName !=
"ADAPTIVESINGULAR")
136 MATH_WARN_MSG(
"GSLIntegrator",
"Use default type: AdaptiveSingular");
167 if (
this == &rhs)
return *
this;
204 const int npts[6] = {15,21,31,41,51,61};
205 assert(fRule>=1 && fRule <=6);
221 std::cerr <<
"GSLIntegrator - Error: Unknown integration type" << std::endl;
222 throw std::exception();
259 double * p =
const_cast<double *
>(&pts.front() );
267 std::cerr <<
"GSLIntegrator - Error: Unknown integration type or not enough singular points defined" << std::endl;
412 std::cerr <<
"GSLIntegrator - Error : Function has not been specified " << std::endl;
424 MATH_WARN_MSG(
"GSLIntegrator::SetOptions",
"Invalid rule options - use default ADAPTIVESINGULAR");
436 MATH_WARN_MSG(
"GSLIntegrator::SetOptions",
"Invalid rule options - use default GAUSS31");
double Result() const
return the Result of the last Integral calculation
GKRule
enumeration specifying the Gauss-KronRod integration rule for ADAPTIVE integration type ...
Interface (abstract) class for 1D numerical integration It must be implemented by the concrate Integr...
Interface (abstract class) for generic functions objects of one-dimension Provides a method to evalua...
int gsl_integration_qng(const gsl_function *f, double a, double b, double epsabs, double epsrel, double *result, double *abserr, size_t *neval)
Namespace for new ROOT classes and functions.
int gsl_integration_qagiu(gsl_function *f, double a, double epsabs, double epsrel, size_t limit, gsl_integration_workspace *workspace, double *result, double *abserr)
double IntegralUp(const IGenFunction &f, double a)
evaluate the Integral of a function f over the semi-infinite interval (a,+inf)
void SetWKSize(unsigned int size)
set workspace size
void SetIntegrationRule(Integration::GKRule)
set the integration rule (Gauss-Kronrod rule).
virtual ROOT::Math::IntegratorOneDimOptions Options() const
get the option used for the integration
void SetNPoints(unsigned int n)
set number of points rule values of 1,2,3,4,5,6 corresponds to 15,21,31,41,51,61 and they are used in...
void SetFunction(const FuncType &f)
fill the GSL C struct from a generic C++ callable object implementing operator()
#define MATH_WARN_MSG(loc, str)
int gsl_integration_qag(const gsl_function *f, double a, double b, double epsabs, double epsrel, size_t limit, int key, gsl_integration_workspace *workspace, double *result, double *abserr)
GSLFunctionWrapper * fFunction
const char * GetTypeName() const
return the name
virtual void SetOptions(const ROOT::Math::IntegratorOneDimOptions &opt)
set the options
int gsl_integration_qags(const gsl_function *f, double a, double b, double epsabs, double epsrel, size_t limit, gsl_integration_workspace *workspace, double *result, double *abserr)
Class for performing numerical integration of a function in one dimension.
double IntegralLow(const IGenFunction &f, double b)
evaluate the Integral of a function f over the over the semi-infinite interval (-inf,b)
double(* GSLFuncPointer)(double, void *)
Function pointer corresponding to gsl_function signature.
int Status() const
return the Error Status of the last Integral calculation
double Integral()
evaluate the Integral over the infinite interval (-inf,+inf) using the function previously set with G...
Numerical one dimensional integration options.
void SetFunction(const IGenFunction &f)
method to set the a generic integration function
bool IsValid()
check if function is valid (has been set)
Type
enumeration specifying the integration types.
GSLIntegrator(double absTol=1.E-9, double relTol=1E-6, size_t size=1000)
Default constructor of GSL Integrator for Adaptive Singular integration.
void SetRelTolerance(double relTolerance)
set the desired relative Error
double RelTolerance() const
absolute tolerance
IntegrationOneDim::Type IntegratorType() const
type of the integrator (return the enumeration type)
GSLIntegrationWorkspace * fWorkspace
double IntegralCauchy(double a, double b, double c)
evaluate the Cauchy principal value of the integral of a previously defined function f over the defin...
void SetFuncPointer(GSLFuncPointer f)
set in the GSL C struct the pointer to the function evaluation
Namespace for new Math classes and functions.
int gsl_integration_qagil(gsl_function *f, double b, double epsabs, double epsrel, size_t limit, gsl_integration_workspace *workspace, double *result, double *abserr)
unsigned int WKSize() const
size of the workspace
void SetAbsTolerance(double absTolerance)
set the desired absolute Error
gsl_integration_workspace * GetWS()
GSLIntegrator & operator=(const GSLIntegrator &)
Wrapper class to the gsl_function C structure.
double AbsTolerance() const
non-static methods for retrivieng options
int gsl_integration_qagi(gsl_function *f, double epsabs, double epsrel, size_t limit, gsl_integration_workspace *workspace, double *result, double *abserr)
unsigned int NPoints() const
maximum number of function calls
Integration::GKRule fRule
void SetParams(void *p)
set in the GSL C struct the extra-object pointer
void SetIntegrator(const char *name)
set 1D integrator name
void SetRelTolerance(double tol)
set the relative tolerance
double Error() const
return the estimate of the absolute Error of the last Integral calculation
void SetAbsTolerance(double tol)
non-static methods for setting options