34 #include "gsl/gsl_integration.h" 63 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).
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()
int Status() const
return the Error Status of the last Integral calculation
#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)
double RelTolerance() const
absolute tolerance
GSLFunctionWrapper * fFunction
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.
IntegrationOneDim::Type IntegratorType() const
type of the integrator (return the enumeration type)
unsigned int WKSize() const
size of the workspace
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.
double AbsTolerance() const
non-static methods for retrivieng options
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
unsigned int NPoints() const
maximum number of function calls
bool IsValid()
check if function is valid (has been set)
double Error() const
return the estimate of the absolute Error of the last Integral calculation
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
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)
virtual ROOT::Math::IntegratorOneDimOptions Options() const
get the option used for the integration
void SetAbsTolerance(double absTolerance)
set the desired absolute Error
gsl_integration_workspace * GetWS()
const char * GetTypeName() const
return the name
GSLIntegrator & operator=(const GSLIntegrator &)
Wrapper class to the gsl_function C structure.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
int gsl_integration_qagi(gsl_function *f, double epsabs, double epsrel, size_t limit, gsl_integration_workspace *workspace, double *result, double *abserr)
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
void SetAbsTolerance(double tol)
non-static methods for setting options