ROOT   Reference Guide
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 contructor of GaussLegendreIntegrator.

virtual ~GaussLegendreIntegrator ()
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
return number of function evaluations in calculating the integral This is equivalent to the number of points

virtual ROOT::Math::IntegratorOneDimOptions Options () const
get the option used for the integration

virtual void SetAbsTolerance (double)
This method is not implemented.

void SetNumberPoints (int num)
Set the number of points used in the calculation of the integral.

virtual void SetOptions (const ROOT::Math::IntegratorOneDimOptions &opt)
set the options (should be re-implemented by derived classes -if more options than tolerance exist

virtual void SetRelTolerance (double)
Set the desired relative Error.

Public Member Functions inherited from ROOT::Math::GaussIntegrator
GaussIntegrator (double absTol=-1, double relTol=-1)
Default Constructor.

virtual ~GaussIntegrator ()
Destructor.

void AbsValue (bool flag)
Static function: set the fgAbsValue flag.

double Error () const
Return the estimate of the absolute Error of the last Integral calculation.

double Integral ()
Returns Integral of function on an infinite interval.

double Integral (const std::vector< double > &pts)
This method is not implemented.

double Integral (double a, double b)
Returns Integral of function between a and b.

double IntegralCauchy (double a, double b, double c)
This method is not implemented.

double IntegralLow (double b)
Returns Integral of function on a lower semi-infinite interval.

double IntegralUp (double a)
Returns Integral of function on an upper semi-infinite interval.

double Result () const
Returns the result of the last Integral calculation.

void SetFunction (const IGenFunction &)
Set integration function (flag control if function must be copied inside).

int Status () const
return the status of the last integration - 0 in case of success

Public Member Functions inherited from ROOT::Math::VirtualIntegratorOneDim
virtual ~VirtualIntegratorOneDim ()
destructor: no operation

virtual ROOT::Math::IntegrationOneDim::Type Type () const

Public Member Functions inherited from ROOT::Math::VirtualIntegrator
virtual ~VirtualIntegrator ()

## Protected Attributes

int fNum

doublefW

doublefX

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)

virtual double DoIntegral (double a, double b, const IGenFunction *func)
Integration surrugate method.

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

#include <Math/GaussLegendreIntegrator.h>

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

## ◆ 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.

## ◆ 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.

## ◆ 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:

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