ROOT 6.16/01 Reference Guide |
Class for performing numerical integration of a function in one dimension.
It uses the numerical integration algorithms of GSL, which reimplements the algorithms used in the QUADPACK, a numerical integration package written in Fortran.
Various types of adaptive and non-adaptive integration are supported. These include integration over infinite and semi-infinite ranges and singular integrals.
The integration type is selected using the Integration::type enumeration in the class constructor. The default type is adaptive integration with singularity (ADAPTIVESINGULAR or QAGS in the QUADPACK convention) applying a Gauss-Kronrod 21-point integration rule. In the case of ADAPTIVE type, the integration rule can also be specified via the Integration::GKRule. The default rule is 31 points.
In the case of integration over infinite and semi-infinite ranges, the type used is always ADAPTIVESINGULAR applying a transformation from the original interval into (0,1).
The ADAPTIVESINGULAR type is the most sophicticated type. When performances are important, it is then recommened to use the NONADAPTIVE type in case of smooth functions or ADAPTIVE with a lower Gauss-Kronrod rule.
For detailed description on GSL integration algorithms see the GSL Manual.
Definition at line 90 of file GSLIntegrator.h.
Public Member Functions | |
GSLIntegrator (const char *type, int rule, double absTol, double relTol, size_t size) | |
constructor of GSL Integrator. More... | |
GSLIntegrator (const Integration::Type type, const Integration::GKRule rule, double absTol=1.E-9, double relTol=1E-6, size_t size=1000) | |
generic constructor for GSL Integrator More... | |
GSLIntegrator (const Integration::Type type, double absTol=1.E-9, double relTol=1E-6, size_t size=1000) | |
constructor of GSL Integrator. More... | |
GSLIntegrator (double absTol=1.E-9, double relTol=1E-6, size_t size=1000) | |
Default constructor of GSL Integrator for Adaptive Singular integration. More... | |
virtual | ~GSLIntegrator () |
double | Error () const |
return the estimate of the absolute Error of the last Integral calculation More... | |
IntegrationOneDim::Type | GetType () const |
get type name More... | |
const char * | GetTypeName () const |
return the name More... | |
double | Integral () |
evaluate the Integral over the infinite interval (-inf,+inf) using the function previously set with GSLIntegrator::SetFunction method. More... | |
double | Integral (const IGenFunction &f) |
evaluate the Integral of a function f over the infinite interval (-inf,+inf) More... | |
double | Integral (const IGenFunction &f, const std::vector< double > &pts) |
evaluate the Integral of a function f with known singular points over the defined Integral (a,b) More... | |
double | Integral (const IGenFunction &f, double a, double b) |
evaluate the Integral of a function f over the defined interval (a,b) More... | |
double | Integral (const std::vector< double > &pts) |
evaluate the Integral over the defined interval (a,b) using the function previously set with GSLIntegrator::SetFunction method. More... | |
double | Integral (double a, double b) |
evaluate the Integral over the defined interval (a,b) using the function previously set with GSLIntegrator::SetFunction method More... | |
double | Integral (GSLFuncPointer f, void *p) |
evaluate the Integral of a function f over the infinite interval (-inf,+inf) passing a free function pointer More... | |
double | Integral (GSLFuncPointer f, void *p, const std::vector< double > &pts) |
evaluate the Integral of a function f with knows singular points over the over a defined interval passing a free function pointer More... | |
double | Integral (GSLFuncPointer f, void *p, double a, double b) |
signature for function pointers used by GSL More... | |
double | IntegralCauchy (const IGenFunction &f, double a, double b, double c) |
evaluate the Cauchy principal value of the integral of a function f over the defined interval (a,b) with a singularity at c More... | |
double | IntegralCauchy (double a, double b, double c) |
evaluate the Cauchy principal value of the integral of a previously defined function f over the defined interval (a,b) with a singularity at c More... | |
double | IntegralLow (const IGenFunction &f, double b) |
evaluate the Integral of a function f over the over the semi-infinite interval (-inf,b) More... | |
double | IntegralLow (double b) |
evaluate the Integral of a function f over the over the semi-infinite interval (-inf,b) using the function previously set with GSLIntegrator::SetFunction method. More... | |
double | IntegralLow (GSLFuncPointer f, void *p, double b) |
evaluate the Integral of a function f over the over the semi-infinite interval (-inf,b) passing a free function pointer More... | |
double | IntegralUp (const IGenFunction &f, double a) |
evaluate the Integral of a function f over the semi-infinite interval (a,+inf) More... | |
double | IntegralUp (double a) |
evaluate the Integral of a function f over the semi-infinite interval (a,+inf) using the function previously set with GSLIntegrator::SetFunction method. More... | |
double | IntegralUp (GSLFuncPointer f, void *p, double a) |
evaluate the Integral of a function f over the semi-infinite interval (a,+inf) passing a free function pointer More... | |
int | NEval () const |
return number of function evaluations in calculating the integral More... | |
virtual ROOT::Math::IntegratorOneDimOptions | Options () const |
get the option used for the integration More... | |
double | Result () const |
return the Result of the last Integral calculation More... | |
void | SetAbsTolerance (double absTolerance) |
set the desired absolute Error More... | |
void | SetFunction (const IGenFunction &f) |
method to set the a generic integration function More... | |
void | SetFunction (GSLFuncPointer f, void *p=0) |
Set function from a GSL pointer function type. More... | |
void | SetIntegrationRule (Integration::GKRule) |
set the integration rule (Gauss-Kronrod rule). More... | |
virtual void | SetOptions (const ROOT::Math::IntegratorOneDimOptions &opt) |
set the options More... | |
void | SetRelTolerance (double relTolerance) |
set the desired relative Error More... | |
int | Status () const |
return the Error Status of the last Integral calculation More... | |
Public Member Functions inherited from ROOT::Math::VirtualIntegratorOneDim | |
virtual | ~VirtualIntegratorOneDim () |
destructor: no operation More... | |
virtual double | Integral ()=0 |
evaluate un-defined integral (between -inf, + inf) More... | |
virtual double | Integral (const std::vector< double > &pts)=0 |
evaluate integral with singular points More... | |
virtual double | Integral (double a, double b)=0 |
evaluate integral More... | |
virtual double | IntegralCauchy (double a, double b, double c)=0 |
evaluate Cauchy integral More... | |
virtual double | IntegralLow (double b)=0 |
evaluate integral over the (-inf, b) More... | |
virtual double | IntegralUp (double a)=0 |
evaluate integral over the (a, +inf) More... | |
virtual ROOT::Math::IntegratorOneDimOptions | Options () const =0 |
get the option used for the integration must be implemented by derived class More... | |
virtual void | SetFunction (const IGenFunction &)=0 |
set integration function More... | |
virtual void | SetOptions (const ROOT::Math::IntegratorOneDimOptions &opt) |
set the options (should be re-implemented by derived classes -if more options than tolerance exist More... | |
virtual ROOT::Math::IntegrationOneDim::Type | Type () const |
Public Member Functions inherited from ROOT::Math::VirtualIntegrator | |
virtual | ~VirtualIntegrator () |
virtual double | Error () const =0 |
return the estimate of the absolute Error of the last Integral calculation More... | |
virtual int | NEval () const |
return number of function evaluations in calculating the integral (if integrator do not implement this function returns -1) More... | |
virtual double | Result () const =0 |
return the Result of the last Integral calculation More... | |
virtual void | SetAbsTolerance (double)=0 |
set the desired absolute Error More... | |
virtual void | SetRelTolerance (double)=0 |
set the desired relative Error More... | |
virtual int | Status () const =0 |
return the Error Status of the last Integral calculation More... | |
Protected Member Functions | |
bool | CheckFunction () |
Private Member Functions | |
GSLIntegrator (const GSLIntegrator &) | |
GSLIntegrator & | operator= (const GSLIntegrator &) |
Private Attributes | |
double | fAbsTol |
double | fError |
GSLFunctionWrapper * | fFunction |
size_t | fMaxIntervals |
int | fNEval |
double | fRelTol |
double | fResult |
Integration::GKRule | fRule |
size_t | fSize |
int | fStatus |
Integration::Type | fType |
GSLIntegrationWorkspace * | fWorkspace |
#include <Math/GSLIntegrator.h>
ROOT::Math::GSLIntegrator::GSLIntegrator | ( | double | absTol = 1.E-9 , |
double | relTol = 1E-6 , |
||
size_t | size = 1000 |
||
) |
Default constructor of GSL Integrator for Adaptive Singular integration.
absTol | desired absolute Error |
relTol | desired relative Error |
size | maximum number of sub-intervals |
Definition at line 77 of file GSLIntegrator.cxx.
ROOT::Math::GSLIntegrator::GSLIntegrator | ( | const Integration::Type | type, |
double | absTol = 1.E-9 , |
||
double | relTol = 1E-6 , |
||
size_t | size = 1000 |
||
) |
constructor of GSL Integrator.
In the case of Adaptive integration the Gauss-Krond rule of 31 points is used
type | type of integration. The possible types are defined in the Integration::Type enumeration |
absTol | desired absolute Error |
relTol | desired relative Error |
size | maximum number of sub-intervals |
Definition at line 95 of file GSLIntegrator.cxx.
ROOT::Math::GSLIntegrator::GSLIntegrator | ( | const Integration::Type | type, |
const Integration::GKRule | rule, | ||
double | absTol = 1.E-9 , |
||
double | relTol = 1E-6 , |
||
size_t | size = 1000 |
||
) |
generic constructor for GSL Integrator
type | type of integration. The possible types are defined in the Integration::Type enumeration |
rule | Gauss-Kronrod rule. It is used only for ADAPTIVE::Integration types. The possible rules are defined in the Integration::GKRule enumeration |
absTol | desired absolute Error |
relTol | desired relative Error |
size | maximum number of sub-intervals |
Definition at line 56 of file GSLIntegrator.cxx.
ROOT::Math::GSLIntegrator::GSLIntegrator | ( | const char * | type, |
int | rule, | ||
double | absTol, | ||
double | relTol, | ||
size_t | size | ||
) |
constructor of GSL Integrator.
In the case of Adaptive integration the Gauss-Krond rule of 31 points is used This is used by the plug-in manager (need a char * instead of enumerations)
type | type of integration. The possible types are defined in the Integration::Type enumeration |
rule | Gauss-Kronrod rule (from 1 to 6) |
absTol | desired absolute Error |
relTol | desired relative Error |
size | maximum number of sub-intervals |
Definition at line 114 of file GSLIntegrator.cxx.
|
virtual |
Definition at line 151 of file GSLIntegrator.cxx.
|
private |
Definition at line 158 of file GSLIntegrator.cxx.
|
protected |
Definition at line 408 of file GSLIntegrator.cxx.
|
virtual |
return the estimate of the absolute Error of the last Integral calculation
Implements ROOT::Math::VirtualIntegrator.
Definition at line 390 of file GSLIntegrator.cxx.
|
inline |
get type name
Definition at line 362 of file GSLIntegrator.h.
const char * ROOT::Math::GSLIntegrator::GetTypeName | ( | ) | const |
return the name
Definition at line 459 of file GSLIntegrator.cxx.
|
virtual |
evaluate the Integral over the infinite interval (-inf,+inf) using the function previously set with GSLIntegrator::SetFunction method.
Implements ROOT::Math::VirtualIntegratorOneDim.
Definition at line 274 of file GSLIntegrator.cxx.
double ROOT::Math::GSLIntegrator::Integral | ( | const IGenFunction & | f | ) |
evaluate the Integral of a function f over the infinite interval (-inf,+inf)
f | integration function. The function type must implement the mathlib::IGenFunction interface |
Definition at line 329 of file GSLIntegrator.cxx.
double ROOT::Math::GSLIntegrator::Integral | ( | const IGenFunction & | f, |
const std::vector< double > & | pts | ||
) |
evaluate the Integral of a function f with known singular points over the defined Integral (a,b)
f | integration function. The function type must implement the mathlib::IGenFunction interface |
pts | vector containing both the function singular points and the lower/upper edges of the interval. The vector must have as first element the lower edge of the integration Integral ( a) and last element the upper value. |
Definition at line 347 of file GSLIntegrator.cxx.
double ROOT::Math::GSLIntegrator::Integral | ( | const IGenFunction & | f, |
double | a, | ||
double | b | ||
) |
evaluate the Integral of a function f over the defined interval (a,b)
f | integration function. The function type must implement the mathlib::IGenFunction interface |
a | lower value of the integration interval |
b | upper value of the integration interval |
Definition at line 323 of file GSLIntegrator.cxx.
|
virtual |
evaluate the Integral over the defined interval (a,b) using the function previously set with GSLIntegrator::SetFunction method.
The function has known singular points.
pts | vector containing both the function singular points and the lower/upper edges of the interval. The vector must have as first element the lower edge of the integration Integral ( a) and last element the upper value. |
Implements ROOT::Math::VirtualIntegratorOneDim.
Definition at line 252 of file GSLIntegrator.cxx.
|
virtual |
evaluate the Integral over the defined interval (a,b) using the function previously set with GSLIntegrator::SetFunction method
a | lower value of the integration interval |
b | upper value of the integration interval |
Implements ROOT::Math::VirtualIntegratorOneDim.
Definition at line 190 of file GSLIntegrator.cxx.
double ROOT::Math::GSLIntegrator::Integral | ( | GSLFuncPointer | f, |
void * | p | ||
) |
evaluate the Integral of a function f over the infinite interval (-inf,+inf) passing a free function pointer
Definition at line 362 of file GSLIntegrator.cxx.
double ROOT::Math::GSLIntegrator::Integral | ( | GSLFuncPointer | f, |
void * | p, | ||
const std::vector< double > & | pts | ||
) |
evaluate the Integral of a function f with knows singular points over the over a defined interval passing a free function pointer
Definition at line 380 of file GSLIntegrator.cxx.
double ROOT::Math::GSLIntegrator::Integral | ( | GSLFuncPointer | f, |
void * | p, | ||
double | a, | ||
double | b | ||
) |
signature for function pointers used by GSL
evaluate the Integral of of a function f over the defined interval (a,b) passing a free function pointer The integration function must be a free function and have a signature consistent with GSL functions:
double my_function ( double x, void * p ) { ...... }
This method is the most efficient since no internal adapter to GSL function is created.
f | pointer to the integration function |
p | pointer to the Parameters of the function |
a | lower value of the integration interval |
b | upper value of the integration interval |
Definition at line 356 of file GSLIntegrator.cxx.
double ROOT::Math::GSLIntegrator::IntegralCauchy | ( | const IGenFunction & | f, |
double | a, | ||
double | b, | ||
double | c | ||
) |
evaluate the Cauchy principal value of the integral of a function f over the defined interval (a,b) with a singularity at c
f | integration function. The function type must implement the mathlib::IGenFunction interface |
a | lower interval value |
b | lower interval value |
c | singular value of f |
Definition at line 241 of file GSLIntegrator.cxx.
|
virtual |
evaluate the Cauchy principal value of the integral of a previously defined function f over the defined interval (a,b) with a singularity at c
a | lower interval value |
b | lower interval value |
c | singular value of f |
Implements ROOT::Math::VirtualIntegratorOneDim.
Definition at line 230 of file GSLIntegrator.cxx.
double ROOT::Math::GSLIntegrator::IntegralLow | ( | const IGenFunction & | f, |
double | b | ||
) |
evaluate the Integral of a function f over the over the semi-infinite interval (-inf,b)
f | integration function. The function type must implement the mathlib::IGenFunction interface |
b | upper value of the integration interval |
Definition at line 341 of file GSLIntegrator.cxx.
|
virtual |
evaluate the Integral of a function f over the over the semi-infinite interval (-inf,b) using the function previously set with GSLIntegrator::SetFunction method.
b | upper value of the integration interval |
Implements ROOT::Math::VirtualIntegratorOneDim.
Definition at line 306 of file GSLIntegrator.cxx.
double ROOT::Math::GSLIntegrator::IntegralLow | ( | GSLFuncPointer | f, |
void * | p, | ||
double | b | ||
) |
evaluate the Integral of a function f over the over the semi-infinite interval (-inf,b) passing a free function pointer
Definition at line 374 of file GSLIntegrator.cxx.
double ROOT::Math::GSLIntegrator::IntegralUp | ( | const IGenFunction & | f, |
double | a | ||
) |
evaluate the Integral of a function f over the semi-infinite interval (a,+inf)
f | integration function. The function type must implement the mathlib::IGenFunction interface |
a | lower value of the integration interval |
Definition at line 335 of file GSLIntegrator.cxx.
|
virtual |
evaluate the Integral of a function f over the semi-infinite interval (a,+inf) using the function previously set with GSLIntegrator::SetFunction method.
a | lower value of the integration interval |
Implements ROOT::Math::VirtualIntegratorOneDim.
Definition at line 290 of file GSLIntegrator.cxx.
double ROOT::Math::GSLIntegrator::IntegralUp | ( | GSLFuncPointer | f, |
void * | p, | ||
double | a | ||
) |
evaluate the Integral of a function f over the semi-infinite interval (a,+inf) passing a free function pointer
Definition at line 368 of file GSLIntegrator.cxx.
|
inlinevirtual |
return number of function evaluations in calculating the integral
Reimplemented from ROOT::Math::VirtualIntegrator.
Definition at line 333 of file GSLIntegrator.h.
|
private |
Definition at line 164 of file GSLIntegrator.cxx.
|
virtual |
get the option used for the integration
Implements ROOT::Math::VirtualIntegratorOneDim.
Definition at line 442 of file GSLIntegrator.cxx.
|
virtual |
return the Result of the last Integral calculation
Implements ROOT::Math::VirtualIntegrator.
Definition at line 388 of file GSLIntegrator.cxx.
|
virtual |
set the desired absolute Error
Implements ROOT::Math::VirtualIntegrator.
Definition at line 399 of file GSLIntegrator.cxx.
|
virtual |
method to set the a generic integration function
f | integration function. The function type must implement the assigment operator, double operator() ( double x ) |
Implements ROOT::Math::VirtualIntegratorOneDim.
Definition at line 182 of file GSLIntegrator.cxx.
void ROOT::Math::GSLIntegrator::SetFunction | ( | GSLFuncPointer | f, |
void * | p = 0 |
||
) |
Set function from a GSL pointer function type.
Definition at line 175 of file GSLIntegrator.cxx.
void ROOT::Math::GSLIntegrator::SetIntegrationRule | ( | Integration::GKRule | rule | ) |
set the integration rule (Gauss-Kronrod rule).
The possible rules are defined in the Integration::GKRule enumeration. The integration rule can be modified only for ADAPTIVE type integrations
Definition at line 406 of file GSLIntegrator.cxx.
|
virtual |
set the options
Reimplemented from ROOT::Math::VirtualIntegratorOneDim.
Definition at line 416 of file GSLIntegrator.cxx.
|
virtual |
set the desired relative Error
Implements ROOT::Math::VirtualIntegrator.
Definition at line 403 of file GSLIntegrator.cxx.
|
virtual |
return the Error Status of the last Integral calculation
Implements ROOT::Math::VirtualIntegrator.
Definition at line 392 of file GSLIntegrator.cxx.
|
private |
Definition at line 380 of file GSLIntegrator.h.
|
private |
Definition at line 388 of file GSLIntegrator.h.
|
private |
Definition at line 394 of file GSLIntegrator.h.
|
private |
Definition at line 383 of file GSLIntegrator.h.
|
private |
Definition at line 390 of file GSLIntegrator.h.
|
private |
Definition at line 381 of file GSLIntegrator.h.
|
private |
Definition at line 387 of file GSLIntegrator.h.
|
private |
Definition at line 379 of file GSLIntegrator.h.
|
private |
Definition at line 382 of file GSLIntegrator.h.
|
private |
Definition at line 389 of file GSLIntegrator.h.
|
private |
Definition at line 378 of file GSLIntegrator.h.
|
private |
Definition at line 395 of file GSLIntegrator.h.