Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 constructor of GaussLegendreIntegrator.
 
 ~GaussLegendreIntegrator () override
 Default Destructor.
 
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.
 
int NEval () const override
 return number of function evaluations in calculating the integral This is equivalent to the number of points
 
ROOT::Math::IntegratorOneDimOptions Options () const override
 get the option used for the integration
 
void SetAbsTolerance (double) override
 This method is not implemented.
 
void SetNumberPoints (int num)
 Set the number of points used in the calculation of the integral.
 
void SetOptions (const ROOT::Math::IntegratorOneDimOptions &opt) override
 set the options (should be re-implemented by derived classes -if more options than tolerance exist
 
void SetRelTolerance (double) override
 Set the desired relative Error.
 
- Public Member Functions inherited from ROOT::Math::GaussIntegrator
 GaussIntegrator (double absTol=-1, double relTol=-1)
 Default Constructor.
 
 ~GaussIntegrator () override
 Destructor.
 
void AbsValue (bool flag)
 Static function: set the fgAbsValue flag.
 
double Error () const override
 Return the estimate of the absolute Error of the last Integral calculation.
 
double Integral () override
 Returns Integral of function on an infinite interval.
 
double Integral (const std::vector< double > &pts) override
 This method is not implemented.
 
double Integral (double a, double b) override
 Returns Integral of function between a and b.
 
double IntegralCauchy (double a, double b, double c) override
 This method is not implemented.
 
double IntegralLow (double b) override
 Returns Integral of function on a lower semi-infinite interval.
 
double IntegralUp (double a) override
 Returns Integral of function on an upper semi-infinite interval.
 
double Result () const override
 Returns the result of the last Integral calculation.
 
void SetFunction (const IGenFunction &) override
 Set integration function (flag control if function must be copied inside).
 
int Status () const override
 return the status of the last integration - 0 in case of success
 
- Public Member Functions inherited from ROOT::Math::VirtualIntegratorOneDim
 ~VirtualIntegratorOneDim () override
 destructor: no operation
 
virtual ROOT::Math::IntegrationOneDim::Type Type () const
 return type of integrator
 
- Public Member Functions inherited from ROOT::Math::VirtualIntegrator
virtual ~VirtualIntegrator ()
 destructor: no operation
 

Protected Attributes

int fNum
 Number of points used in the estimation of the integral.
 
doublefW
 Weights of the points used.
 
doublefX
 Abscisa of the points used.
 
- Protected Attributes inherited from ROOT::Math::GaussIntegrator
double fEpsAbs
 Absolute error.
 
double fEpsRel
 Relative error.
 
const IGenFunctionfFunction
 Pointer to function used.
 
double fLastError
 Error from the last estimation.
 
double fLastResult
 Result from the last estimation.
 
bool fUsedOnce
 Bool value to check if the function was at least called once.
 

Private Member Functions

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

Additional Inherited Members

- Static Protected Attributes inherited from ROOT::Math::GaussIntegrator
static bool fgAbsValue = false
 AbsValue used for the calculation of the integral.
 

#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 constructor 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 ( )
override

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

Integration surrogate 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
inlineoverridevirtual

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
overridevirtual

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

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

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

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

Number of points used in the estimation of the integral.

Definition at line 113 of file GaussLegendreIntegrator.h.

◆ fW

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

Weights of the points used.

Definition at line 115 of file GaussLegendreIntegrator.h.

◆ fX

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

Abscisa of the points used.

Definition at line 114 of file GaussLegendreIntegrator.h.

Libraries for ROOT::Math::GaussLegendreIntegrator:

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