34#include "gsl/gsl_integration.h"
127 if (
type !=
nullptr) {
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};
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");
#define MATH_WARN_MSG(loc, str)
int gsl_integration_qagil(gsl_function *f, double b, double epsabs, double epsrel, size_t limit, gsl_integration_workspace *workspace, double *result, double *abserr)
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)
int gsl_integration_qagi(gsl_function *f, double epsabs, double epsrel, size_t limit, gsl_integration_workspace *workspace, double *result, double *abserr)
int gsl_integration_qagiu(gsl_function *f, double a, double epsabs, double epsrel, size_t limit, gsl_integration_workspace *workspace, double *result, double *abserr)
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)
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
void SetAbsTolerance(double tol)
non-static methods for setting options
double RelTolerance() const
absolute tolerance
void SetRelTolerance(double tol)
set the relative tolerance
unsigned int WKSize() const
size of the workspace
double AbsTolerance() const
non-static methods for retrieving options
void SetWKSize(unsigned int size)
set workspace size
Wrapper class to the gsl_function C structure.
void SetOptions(const ROOT::Math::IntegratorOneDimOptions &opt) override
set the options
Integration::GKRule fRule
void SetIntegrationRule(Integration::GKRule)
set the integration rule (Gauss-Kronrod rule).
~GSLIntegrator() override
GSLIntegrator & operator=(const GSLIntegrator &)
double Result() const override
return the Result of the last Integral calculation
double Error() const override
return the estimate of the absolute Error of the last Integral calculation
double IntegralCauchy(double a, double b, double c) override
evaluate the Cauchy principal value of the integral of a previously defined function f over the defin...
double IntegralUp(const IGenFunction &f, double a)
evaluate the Integral of a function f over the semi-infinite interval (a,+inf)
double IntegralLow(const IGenFunction &f, double b)
evaluate the Integral of a function f over the over the semi-infinite interval (-inf,...
GSLIntegrationWorkspace * fWorkspace
double Integral() override
evaluate the Integral over the infinite interval (-inf,+inf) using the function previously set with G...
GSLFunctionWrapper * fFunction
void SetAbsTolerance(double absTolerance) override
set the desired absolute Error
int Status() const override
return the Error Status of the last Integral calculation
ROOT::Math::IntegratorOneDimOptions Options() const override
get the option used for the integration
GSLIntegrator(double absTol=1.E-9, double relTol=1E-6, size_t size=1000)
Default constructor of GSL Integrator for Adaptive Singular integration.
const char * GetTypeName() const
return the name
void SetFunction(const IGenFunction &f) override
method to set the a generic integration function
void SetRelTolerance(double relTolerance) override
set the desired relative Error
Numerical one dimensional integration options.
IntegrationOneDim::Type IntegratorType() const
type of the integrator (return the enumeration type)
void SetIntegrator(const char *name)
set 1D integrator name
void SetNPoints(unsigned int n)
Set number of points for active integration rule.
unsigned int NPoints() const
Number of points used by current integration rule.
Interface (abstract) class for 1D numerical integration It must be implemented by the concrete Integr...
GKRule
enumeration specifying the Gauss-KronRod integration rule for ADAPTIVE integration type
Type
enumeration specifying the integration types.
@ kADAPTIVESINGULAR
default adaptive integration type which can be used in the case of the presence of singularities.
@ kNONADAPTIVE
to be used for smooth functions
@ kADAPTIVE
to be used for general functions without singularities
@ kDEFAULT
default type specified in the static options
double(* GSLFuncPointer)(double, void *)
Function pointer corresponding to gsl_function signature.
IBaseFunctionOneDim IGenFunction