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

#include <GaussLegendreQuadratureQ.hh>

Public Types

enum  { interval_quadrature = 1 }
 

Public Member Functions

 GaussLegendreQuadratureQ (unsigned npoints)
 
unsigned npoints () const
 
void getAbscissae (lapack_double *abscissae, unsigned len) const
 
void getAllAbscissae (lapack_double *abscissae, unsigned len) const
 
void getWeights (lapack_double *weights, unsigned len) const
 
void getAllWeights (lapack_double *weights, unsigned len) const
 
template<typename FcnResult , typename FcnArg >
lapack_double integrate (const Functor1< FcnResult, FcnArg > &fcn, lapack_double a, lapack_double b) const
 
template<typename FcnResult , typename FcnArg >
lapack_double integrate (const Functor1< FcnResult, FcnArg > &fcn, lapack_double a, lapack_double b, unsigned nsplit) const
 
template<class Functor >
std::vector< std::pair< lapack_double, lapack_double > > weightedIntegrationPoints (const Functor &weight, lapack_double a, lapack_double b) 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 lapack_double precision.

Constructor & Destructor Documentation

◆ GaussLegendreQuadratureQ()

npstat::GaussLegendreQuadratureQ::GaussLegendreQuadratureQ ( 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::GaussLegendreQuadratureQ::allowedNPonts ( )
static

The complete set of allowed rules, in the increasing order

◆ getAbscissae()

void npstat::GaussLegendreQuadratureQ::getAbscissae ( lapack_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::GaussLegendreQuadratureQ::getAllAbscissae ( lapack_double *  abscissae,
unsigned  len 
) const

Return abscissae for all points

◆ getAllWeights()

void npstat::GaussLegendreQuadratureQ::getAllWeights ( lapack_double *  weights,
unsigned  len 
) const

Return weights for all points

◆ getWeights()

void npstat::GaussLegendreQuadratureQ::getWeights ( lapack_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 >
lapack_double npstat::GaussLegendreQuadratureQ::integrate ( const Functor1< FcnResult, FcnArg > &  fcn,
lapack_double  a,
lapack_double  b 
) const

Perform the quadrature on [a, b] interval

◆ integrate() [2/2]

template<typename FcnResult , typename FcnArg >
lapack_double npstat::GaussLegendreQuadratureQ::integrate ( const Functor1< FcnResult, FcnArg > &  fcn,
lapack_double  a,
lapack_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::GaussLegendreQuadratureQ::isAllowed ( unsigned  npoints)
static

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

◆ minimalExactRule()

static unsigned npstat::GaussLegendreQuadratureQ::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::GaussLegendreQuadratureQ::npoints ( ) const
inline

Return the number of quadrature points

◆ weightedIntegrationPoints()

template<class Functor >
std::vector<std::pair<lapack_double,lapack_double> > npstat::GaussLegendreQuadratureQ::weightedIntegrationPoints ( const Functor &  weight,
lapack_double  a,
lapack_double  b 
) const

Weighted integration points on the given interval, suitable for constructing orthogonal polynomials w.r.t. the given weight function (in particular, by ContOrthoPoly1D class). Naturally, rule with "npoints" points must be able to calculate polynomial normalization integrals exactly.


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