npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0
npstat::GaussLegendreQuadrature Class Reference

#include <GaussLegendreQuadrature.hh>

Inheritance diagram for npstat::GaussLegendreQuadrature:
npstat::AbsIntervalQuadrature1D

Public Types

enum  { interval_quadrature = 1 }
 

Public Member Functions

 GaussLegendreQuadrature (unsigned npoints)
 
unsigned npoints () const
 
void getAbscissae (long double *abscissae, unsigned len) const
 
void getAllAbscissae (long double *abscissae, unsigned len) const
 
void getWeights (long double *weights, unsigned len) const
 
void getAllWeights (long double *weights, unsigned len) const
 
template<typename FcnResult , typename FcnArg >
long double integrate (const Functor1< FcnResult, FcnArg > &fcn, long double a, long double b) const
 
template<typename FcnResult , typename FcnArg >
long double integrate (const Functor1< FcnResult, FcnArg > &fcn, long double a, long double b, unsigned nsplit) const
 
- Public Member Functions inherited from npstat::AbsIntervalQuadrature1D
template<class Functor >
std::vector< std::pair< double, double > > weightedIntegrationPoints (const Functor &weight, const long double left, const long double right) const
 
template<class Functor >
std::vector< std::pair< long double, long double > > weightedIntegrationPointsLD (const Functor &weight, const long double left, const long double right) const
 

Static Public Member Functions

static bool isAllowed (unsigned npoints)
 
static std::vector< unsigned > allowedNPonts ()
 
static unsigned minimalExactRule (unsigned polyDegree)
 

Detailed Description

Gauss-Legendre quadrature. Internally, operations are performed in long double precision.

Constructor & Destructor Documentation

◆ GaussLegendreQuadrature()

npstat::GaussLegendreQuadrature::GaussLegendreQuadrature ( unsigned  npoints)
explicit

At the moment, the following numbers of points are supported: 2, 4, 6, 8, 10, 12, 16, 32, 64, 100, 128, 256, 512, 1024.

If an unsupported number of points is given in the constructor, std::invalid_argument exception will be thrown.

Member Function Documentation

◆ allowedNPonts()

static std::vector<unsigned> npstat::GaussLegendreQuadrature::allowedNPonts ( )
static

The complete set of allowed rules, in the increasing order

◆ getAbscissae()

void npstat::GaussLegendreQuadrature::getAbscissae ( long double *  abscissae,
unsigned  len 
) const

The abscissae are returned for positive points only, so the buffer length should be at least npoints/2.

◆ getAllAbscissae()

void npstat::GaussLegendreQuadrature::getAllAbscissae ( long double *  abscissae,
unsigned  len 
) const
virtual

Return abscissae for all points

Implements npstat::AbsIntervalQuadrature1D.

◆ getAllWeights()

void npstat::GaussLegendreQuadrature::getAllWeights ( long double *  weights,
unsigned  len 
) const
virtual

Return weights for all points

Implements npstat::AbsIntervalQuadrature1D.

◆ getWeights()

void npstat::GaussLegendreQuadrature::getWeights ( long double *  weights,
unsigned  len 
) const

The weights are returned for positive points only, so the buffer length should be at least npoints/2.

◆ integrate() [1/2]

template<typename FcnResult , typename FcnArg >
long double npstat::GaussLegendreQuadrature::integrate ( const Functor1< FcnResult, FcnArg > &  fcn,
long double  a,
long double  b 
) const

Perform the quadrature on the [a, b] interval

◆ integrate() [2/2]

template<typename FcnResult , typename FcnArg >
long double npstat::GaussLegendreQuadrature::integrate ( const Functor1< FcnResult, FcnArg > &  fcn,
long double  a,
long double  b,
unsigned  nsplit 
) const

This method splits the interval [a, b] into "nsplit" subintervals of equal length, applies Gauss-Legendre quadrature to each subinterval, and sums the results.

◆ isAllowed()

static bool npstat::GaussLegendreQuadrature::isAllowed ( unsigned  npoints)
static

Check if the rule with the given number of points is supported

◆ minimalExactRule()

static unsigned npstat::GaussLegendreQuadrature::minimalExactRule ( unsigned  polyDegree)
static

Minimum number of points, among the supported rules, which integrates a polynomial with the given degree exactly. Returns 0 if the degree is out of range.

◆ npoints()

unsigned npstat::GaussLegendreQuadrature::npoints ( ) const
inlinevirtual

Return the number of quadrature points

Implements npstat::AbsIntervalQuadrature1D.


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