 ROOT   Reference Guide ROOT::Math::GSLIntegrator Class Reference

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 &)

GSLIntegratoroperator= (const GSLIntegrator &)

## Private Attributes

double fAbsTol

double fError

GSLFunctionWrapperfFunction

size_t fMaxIntervals

int fNEval

double fRelTol

double fResult

Integration::GKRule fRule

size_t fSize

int fStatus

Integration::Type fType

GSLIntegrationWorkspacefWorkspace

#include <Math/GSLIntegrator.h>

Inheritance diagram for ROOT::Math::GSLIntegrator:
[legend]

## ◆ GSLIntegrator() [1/5]

 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.

Parameters
 absTol desired absolute Error relTol desired relative Error size maximum number of sub-intervals

Definition at line 77 of file GSLIntegrator.cxx.

## ◆ GSLIntegrator() [2/5]

 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

Parameters
 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.

## ◆ GSLIntegrator() [3/5]

 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

Parameters
 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.

## ◆ GSLIntegrator() [4/5]

 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)

Parameters
 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.

## ◆ ~GSLIntegrator()

 ROOT::Math::GSLIntegrator::~GSLIntegrator ( )
virtual

Definition at line 151 of file GSLIntegrator.cxx.

## ◆ GSLIntegrator() [5/5]

 ROOT::Math::GSLIntegrator::GSLIntegrator ( const GSLIntegrator & )
private

Definition at line 158 of file GSLIntegrator.cxx.

## ◆ CheckFunction()

 bool ROOT::Math::GSLIntegrator::CheckFunction ( )
protected

Definition at line 408 of file GSLIntegrator.cxx.

## ◆ Error()

 double ROOT::Math::GSLIntegrator::Error ( ) const
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.

## ◆ GetType()

 IntegrationOneDim::Type ROOT::Math::GSLIntegrator::GetType ( ) const
inline

get type name

Definition at line 362 of file GSLIntegrator.h.

## ◆ GetTypeName()

 const char * ROOT::Math::GSLIntegrator::GetTypeName ( ) const

return the name

Definition at line 459 of file GSLIntegrator.cxx.

## ◆ Integral() [1/9]

 double ROOT::Math::GSLIntegrator::Integral ( )
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.

## ◆ Integral() [2/9]

 double ROOT::Math::GSLIntegrator::Integral ( const IGenFunction & f )

evaluate the Integral of a function f over the infinite interval (-inf,+inf)

Parameters
 f integration function. The function type must implement the mathlib::IGenFunction interface

Definition at line 329 of file GSLIntegrator.cxx.

## ◆ Integral() [3/9]

 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)

Parameters
 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.

## ◆ Integral() [4/9]

 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)

Parameters
 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.

## ◆ Integral() [5/9]

 double ROOT::Math::GSLIntegrator::Integral ( const std::vector< double > & pts )
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.

Parameters
 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.

## ◆ Integral() [6/9]

 double ROOT::Math::GSLIntegrator::Integral ( double a, double b )
virtual

evaluate the Integral over the defined interval (a,b) using the function previously set with GSLIntegrator::SetFunction method

Parameters
 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.

## ◆ Integral() [7/9]

 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.

## ◆ Integral() [8/9]

 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.

## ◆ Integral() [9/9]

 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.

Parameters
 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.

## ◆ IntegralCauchy() [1/2]

 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

Parameters
 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.

## ◆ IntegralCauchy() [2/2]

 double ROOT::Math::GSLIntegrator::IntegralCauchy ( double a, double b, double c )
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

Parameters
 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.

## ◆ IntegralLow() [1/3]

 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)

Parameters
 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.

## ◆ IntegralLow() [2/3]

 double ROOT::Math::GSLIntegrator::IntegralLow ( double b )
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.

Parameters
 b upper value of the integration interval

Implements ROOT::Math::VirtualIntegratorOneDim.

Definition at line 306 of file GSLIntegrator.cxx.

## ◆ IntegralLow() [3/3]

 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.

## ◆ IntegralUp() [1/3]

 double ROOT::Math::GSLIntegrator::IntegralUp ( const IGenFunction & f, double a )

evaluate the Integral of a function f over the semi-infinite interval (a,+inf)

Parameters
 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.

## ◆ IntegralUp() [2/3]

 double ROOT::Math::GSLIntegrator::IntegralUp ( double a )
virtual

evaluate the Integral of a function f over the semi-infinite interval (a,+inf) using the function previously set with GSLIntegrator::SetFunction method.

Parameters
 a lower value of the integration interval

Implements ROOT::Math::VirtualIntegratorOneDim.

Definition at line 290 of file GSLIntegrator.cxx.

## ◆ IntegralUp() [3/3]

 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.

## ◆ NEval()

 int ROOT::Math::GSLIntegrator::NEval ( ) const
inlinevirtual

return number of function evaluations in calculating the integral

Reimplemented from ROOT::Math::VirtualIntegrator.

Definition at line 333 of file GSLIntegrator.h.

## ◆ operator=()

 GSLIntegrator & ROOT::Math::GSLIntegrator::operator= ( const GSLIntegrator & rhs )
private

Definition at line 164 of file GSLIntegrator.cxx.

## ◆ Options()

 ROOT::Math::IntegratorOneDimOptions ROOT::Math::GSLIntegrator::Options ( ) const
virtual

get the option used for the integration

Implements ROOT::Math::VirtualIntegratorOneDim.

Definition at line 442 of file GSLIntegrator.cxx.

## ◆ Result()

 double ROOT::Math::GSLIntegrator::Result ( ) const
virtual

return the Result of the last Integral calculation

Implements ROOT::Math::VirtualIntegrator.

Definition at line 388 of file GSLIntegrator.cxx.

## ◆ SetAbsTolerance()

 void ROOT::Math::GSLIntegrator::SetAbsTolerance ( double absTolerance )
virtual

set the desired absolute Error

Implements ROOT::Math::VirtualIntegrator.

Definition at line 399 of file GSLIntegrator.cxx.

## ◆ SetFunction() [1/2]

 void ROOT::Math::GSLIntegrator::SetFunction ( const IGenFunction & f )
virtual

method to set the a generic integration function

Parameters
 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.

## ◆ SetFunction() [2/2]

 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.

## ◆ SetIntegrationRule()

 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.

## ◆ SetOptions()

 void ROOT::Math::GSLIntegrator::SetOptions ( const ROOT::Math::IntegratorOneDimOptions & opt )
virtual

set the options

Reimplemented from ROOT::Math::VirtualIntegratorOneDim.

Definition at line 416 of file GSLIntegrator.cxx.

## ◆ SetRelTolerance()

 void ROOT::Math::GSLIntegrator::SetRelTolerance ( double relTolerance )
virtual

set the desired relative Error

Implements ROOT::Math::VirtualIntegrator.

Definition at line 403 of file GSLIntegrator.cxx.

## ◆ Status()

 int ROOT::Math::GSLIntegrator::Status ( ) const
virtual

return the Error Status of the last Integral calculation

Implements ROOT::Math::VirtualIntegrator.

Definition at line 392 of file GSLIntegrator.cxx.

## ◆ fAbsTol

 double ROOT::Math::GSLIntegrator::fAbsTol
private

Definition at line 380 of file GSLIntegrator.h.

## ◆ fError

 double ROOT::Math::GSLIntegrator::fError
private

Definition at line 388 of file GSLIntegrator.h.

## ◆ fFunction

 GSLFunctionWrapper* ROOT::Math::GSLIntegrator::fFunction
private

Definition at line 394 of file GSLIntegrator.h.

## ◆ fMaxIntervals

 size_t ROOT::Math::GSLIntegrator::fMaxIntervals
private

Definition at line 383 of file GSLIntegrator.h.

## ◆ fNEval

 int ROOT::Math::GSLIntegrator::fNEval
private

Definition at line 390 of file GSLIntegrator.h.

## ◆ fRelTol

 double ROOT::Math::GSLIntegrator::fRelTol
private

Definition at line 381 of file GSLIntegrator.h.

## ◆ fResult

 double ROOT::Math::GSLIntegrator::fResult
private

Definition at line 387 of file GSLIntegrator.h.

## ◆ fRule

 Integration::GKRule ROOT::Math::GSLIntegrator::fRule
private

Definition at line 379 of file GSLIntegrator.h.

## ◆ fSize

 size_t ROOT::Math::GSLIntegrator::fSize
private

Definition at line 382 of file GSLIntegrator.h.

## ◆ fStatus

 int ROOT::Math::GSLIntegrator::fStatus
private

Definition at line 389 of file GSLIntegrator.h.

## ◆ fType

 Integration::Type ROOT::Math::GSLIntegrator::fType
private

Definition at line 378 of file GSLIntegrator.h.

## ◆ fWorkspace

 GSLIntegrationWorkspace* ROOT::Math::GSLIntegrator::fWorkspace
private

Definition at line 395 of file GSLIntegrator.h.

Libraries for ROOT::Math::GSLIntegrator: [legend]

The documentation for this class was generated from the following files: