Logo ROOT  
Reference Guide
ROOT::Math::GaussLegendreIntegrator Class Reference

User class for performing function integration.

It will use the Gauss-Legendre Method for function integration in a given interval. This class is implemented from TF1::Integral().

Definition at line 37 of file GaussLegendreIntegrator.h.

Public Member Functions

 GaussLegendreIntegrator (int num=10, double eps=1e-12)
 Basic contructor of GaussLegendreIntegrator. More...
 
virtual ~GaussLegendreIntegrator ()
 Default Destructor. More...
 
int GetNumberPoints () const
 
void GetWeightVectors (double *x, double *w) const
 Returns the arrays x and w containing the abscissa and weight of the Gauss-Legendre n-point quadrature formula. More...
 
int NEval () const
 return number of function evaluations in calculating the integral This is equivalent to the number of points More...
 
virtual ROOT::Math::IntegratorOneDimOptions Options () const
 get the option used for the integration More...
 
virtual void SetAbsTolerance (double)
 This method is not implemented. More...
 
void SetNumberPoints (int num)
 Set the number of points used in the calculation of the integral. 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 void SetRelTolerance (double)
 Set the desired relative Error. More...
 
- Public Member Functions inherited from ROOT::Math::GaussIntegrator
 GaussIntegrator (double absTol=-1, double relTol=-1)
 Default Constructor. More...
 
virtual ~GaussIntegrator ()
 Destructor. More...
 
void AbsValue (bool flag)
 Static function: set the fgAbsValue flag. More...
 
double Error () const
 Return the estimate of the absolute Error of the last Integral calculation. More...
 
double Integral ()
 Returns Integral of function on an infinite interval. More...
 
double Integral (const std::vector< double > &pts)
 This method is not implemented. More...
 
double Integral (double a, double b)
 Returns Integral of function between a and b. More...
 
double IntegralCauchy (double a, double b, double c)
 This method is not implemented. More...
 
double IntegralLow (double b)
 Returns Integral of function on a lower semi-infinite interval. More...
 
double IntegralUp (double a)
 Returns Integral of function on an upper semi-infinite interval. More...
 
virtual ROOT::Math::IntegratorOneDimOptions Options () const
 get the option used for the integration More...
 
double Result () const
 Returns the result of the last Integral calculation. More...
 
virtual void SetAbsTolerance (double eps)
 This method is not implemented. More...
 
void SetFunction (const IGenFunction &)
 Set integration function (flag control if function must be copied inside). 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 void SetRelTolerance (double eps)
 Set the desired relative Error. More...
 
int Status () const
 return the status of the last integration - 0 in case of success 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 Attributes

int fNum
 
double * fW
 
double * fX
 
- Protected Attributes inherited from ROOT::Math::GaussIntegrator
double fEpsAbs
 
double fEpsRel
 
const IGenFunctionfFunction
 
double fLastError
 
double fLastResult
 
bool fUsedOnce
 

Private Member Functions

void CalcGaussLegendreSamplingPoints ()
 Type: unsafe but fast interface filling the arrays x and w (static method) More...
 
virtual double DoIntegral (double a, double b, const IGenFunction *func)
 Integration surrugate method. More...
 

Additional Inherited Members

- Static Protected Attributes inherited from ROOT::Math::GaussIntegrator
static bool fgAbsValue = false
 

#include <Math/GaussLegendreIntegrator.h>

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

Constructor & Destructor Documentation

◆ GaussLegendreIntegrator()

ROOT::Math::GaussLegendreIntegrator::GaussLegendreIntegrator ( int  num = 10,
double  eps = 1e-12 
)

Basic contructor of GaussLegendreIntegrator.

@param num Number of desired points to calculate the integration. @param eps Desired relative error.

Definition at line 23 of file GaussLegendreIntegrator.cxx.

◆ ~GaussLegendreIntegrator()

ROOT::Math::GaussLegendreIntegrator::~GaussLegendreIntegrator ( )
virtual

Default Destructor.

Definition at line 34 of file GaussLegendreIntegrator.cxx.

Member Function Documentation

◆ CalcGaussLegendreSamplingPoints()

void ROOT::Math::GaussLegendreIntegrator::CalcGaussLegendreSamplingPoints ( )
private

Type: unsafe but fast interface filling the arrays x and w (static method)

Given the number of sampling points this routine fills the arrays x and w of length num, containing the abscissa and weight of the Gauss-Legendre n-point quadrature formula.

Gauss-Legendre: W(x)=1 -1<x<1 (j+1)P_{j+1} = (2j+1)xP_j-jP_{j-1}

num is the number of sampling points (>0) x and w are arrays of size num eps is the relative precision

If num<=0 or eps<=0 no action is done.

Reference: Numerical Recipes in C, Second Edition

Definition at line 98 of file GaussLegendreIntegrator.cxx.

◆ DoIntegral()

double ROOT::Math::GaussLegendreIntegrator::DoIntegral ( double  a,
double  b,
const IGenFunction func 
)
privatevirtual

Integration surrugate method.

Return integral of passed function in interval [a,b] Reimplement method of GaussIntegrator using CalcGaussLegendreSamplingPoints

Reimplemented from ROOT::Math::GaussIntegrator.

Definition at line 60 of file GaussLegendreIntegrator.cxx.

◆ GetNumberPoints()

int ROOT::Math::GaussLegendreIntegrator::GetNumberPoints ( ) const
inline

Definition at line 68 of file GaussLegendreIntegrator.h.

◆ GetWeightVectors()

void ROOT::Math::GaussLegendreIntegrator::GetWeightVectors ( double *  x,
double *  w 
) const

Returns the arrays x and w containing the abscissa and weight of the Gauss-Legendre n-point quadrature formula.

Gauss-Legendre: W(x)=1 -1<x<1 (j+1)P_{j+1} = (2j+1)xP_j-jP_{j-1}

Definition at line 51 of file GaussLegendreIntegrator.cxx.

◆ NEval()

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

return number of function evaluations in calculating the integral This is equivalent to the number of points

Reimplemented from ROOT::Math::VirtualIntegrator.

Definition at line 74 of file GaussLegendreIntegrator.h.

◆ Options()

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

get the option used for the integration

Reimplemented from ROOT::Math::GaussIntegrator.

Definition at line 157 of file GaussLegendreIntegrator.cxx.

◆ SetAbsTolerance()

void ROOT::Math::GaussLegendreIntegrator::SetAbsTolerance ( double  )
virtual

This method is not implemented.

Reimplemented from ROOT::Math::GaussIntegrator.

Definition at line 93 of file GaussLegendreIntegrator.cxx.

◆ SetNumberPoints()

void ROOT::Math::GaussLegendreIntegrator::SetNumberPoints ( int  num)

Set the number of points used in the calculation of the integral.

Definition at line 43 of file GaussLegendreIntegrator.cxx.

◆ SetOptions()

void ROOT::Math::GaussLegendreIntegrator::SetOptions ( const ROOT::Math::IntegratorOneDimOptions opt)
virtual

set the options (should be re-implemented by derived classes -if more options than tolerance exist

Reimplemented from ROOT::Math::GaussIntegrator.

Definition at line 167 of file GaussLegendreIntegrator.cxx.

◆ SetRelTolerance()

void ROOT::Math::GaussLegendreIntegrator::SetRelTolerance ( double  eps)
virtual

Set the desired relative Error.

Reimplemented from ROOT::Math::GaussIntegrator.

Definition at line 86 of file GaussLegendreIntegrator.cxx.

Member Data Documentation

◆ fNum

int ROOT::Math::GaussLegendreIntegrator::fNum
protected

Definition at line 113 of file GaussLegendreIntegrator.h.

◆ fW

double* ROOT::Math::GaussLegendreIntegrator::fW
protected

Definition at line 115 of file GaussLegendreIntegrator.h.

◆ fX

double* ROOT::Math::GaussLegendreIntegrator::fX
protected

Definition at line 114 of file GaussLegendreIntegrator.h.

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

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