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

Protected Attributes

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

Private Member Functions

virtual double DoIntegral (double a, double b, const IGenFunction *func)
 Integration surrugate method. More...
 
void CalcGaussLegendreSamplingPoints ()
 Type: unsafe but fast interface filling the arrays x and w (static 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:
+ Collaboration diagram for ROOT::Math::GaussLegendreIntegrator:

Constructor & Destructor Documentation

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 19 of file GaussLegendreIntegrator.cxx.

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

Default Destructor.

Definition at line 30 of file GaussLegendreIntegrator.cxx.

Member Function Documentation

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 94 of file GaussLegendreIntegrator.cxx.

Referenced by GaussLegendreIntegrator(), SetNumberPoints(), SetOptions(), and SetRelTolerance().

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 56 of file GaussLegendreIntegrator.cxx.

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

Definition at line 70 of file GaussLegendreIntegrator.h.

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 47 of file GaussLegendreIntegrator.cxx.

Referenced by TF1::CalcGaussLegendreSamplingPoints().

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 76 of file GaussLegendreIntegrator.h.

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

get the option used for the integration

Reimplemented from ROOT::Math::GaussIntegrator.

Definition at line 153 of file GaussLegendreIntegrator.cxx.

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

This method is not implemented.

Reimplemented from ROOT::Math::GaussIntegrator.

Definition at line 89 of file GaussLegendreIntegrator.cxx.

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

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

Definition at line 39 of file GaussLegendreIntegrator.cxx.

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 163 of file GaussLegendreIntegrator.cxx.

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

Set the desired relative Error.

Reimplemented from ROOT::Math::GaussIntegrator.

Definition at line 82 of file GaussLegendreIntegrator.cxx.

Member Data Documentation

int ROOT::Math::GaussLegendreIntegrator::fNum
protected
double* ROOT::Math::GaussLegendreIntegrator::fW
protected
double* ROOT::Math::GaussLegendreIntegrator::fX
protected

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