34#include "gsl/gsl_integration.h"
63 fResult(0),fError(0),fStatus(-1),fNEval(-1),
78 fType(Integration::kADAPTIVESINGULAR),
79 fRule(Integration::kGAUSS31),
84 fResult(0),fError(0),fStatus(-1),fNEval(-1),
97 fRule(Integration::kGAUSS31),
102 fResult(0),fError(0),fStatus(-1),fNEval(-1),
115 fRule(Integration::kGAUSS31),
120 fResult(0),fError(0),fStatus(-1),fNEval(-1),
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
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
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 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)
gsl_integration_workspace * GetWS()
Class for performing numerical integration of a function in one dimension.
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
Interface (abstract class) for generic functions objects of one-dimension Provides a method to evalua...
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
Namespace for new Math classes and functions.
double(* GSLFuncPointer)(double, void *)
Function pointer corresponding to gsl_function signature.
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.