Psi4
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
psi::GCQuadrature Class Reference

Performs adaptive Gauss-Chebyshev quadrature for any given function. More...

#include <gaussquad.h>

Public Member Functions

 GCQuadrature ()
 Default constructor, creates empty object. More...
 
 GCQuadrature (const GCQuadrature &other)
 Copy constructor, carbon copies all members. More...
 
void initGrid (int points, GCTYPE t)
 
bool integrate (std::function< double(double, double *, int)> &f, double *params, const double tolerance)
 
void transformZeroInf ()
 
void transformRMinMax (double z, double p)
 
double getI () const
 Returns the calculated integral value - must have called integrate first. More...
 
int getN () const
 Returns the maximum number of quadrature points. More...
 
std::vector< double > & getX ()
 Returns a reference to the abscissae. More...
 

Public Attributes

int start
 Start and endpoints of integration, used for prescreening. More...
 
int end
 

Private Member Functions

double sumTerms (std::function< double(double, double *, int)> &f, double *p, int limit, int shift, int skip)
 Worker function for integration routines, should not be called directly. More...
 

Private Attributes

int maxN
 Maximum number of points to use in quadrature. More...
 
int M
 Index of midpoint. More...
 
std::vector< double > x
 Weights. More...
 
std::vector< double > w
 Abscissae. More...
 
double I
 Integration value. More...
 
GCTYPE t
 Algorithm to be used. More...
 

Detailed Description

Performs adaptive Gauss-Chebyshev quadrature for any given function.

Stores the weights and abscissae for the quadrature, and provides two different methods to integrate on [-1, 1] Also contains means to transform the region of integration to [0, infinity) and [rmin, rmax]

Constructor & Destructor Documentation

psi::GCQuadrature::GCQuadrature ( )

Default constructor, creates empty object.

psi::GCQuadrature::GCQuadrature ( const GCQuadrature other)

Copy constructor, carbon copies all members.

Member Function Documentation

double psi::GCQuadrature::getI ( ) const
inline

Returns the calculated integral value - must have called integrate first.

int psi::GCQuadrature::getN ( ) const
inline

Returns the maximum number of quadrature points.

std::vector<double>& psi::GCQuadrature::getX ( )
inline

Returns a reference to the abscissae.

void psi::GCQuadrature::initGrid ( int  points,
GCTYPE  t 
)

Intialises the integration grid to the given number of points, and integration type. ONEPOINT will choose N = 2^n - 1 closest to the given number of points, whilst TWOPOINT will choose N= 3*2^n - 1 in the same way.

Parameters
points- maximum number of quadrature points to be used
t- the algorithm to be used (ONEPOINT / TWOPOINT)
bool psi::GCQuadrature::integrate ( std::function< double(double, double *, int)> &  f,
double *  params,
const double  tolerance 
)

Integrates the given function (over [-1, 1] by default) to within the given tolerance.

Parameters
f- the function to be integrated
params- array of parameters for the function to be integrated
tolerance- change below which convergenced is considered to be achieved
Returns
true if integration converged, false otherwise
double psi::GCQuadrature::sumTerms ( std::function< double(double, double *, int)> &  f,
double *  p,
int  limit,
int  shift,
int  skip 
)
private

Worker function for integration routines, should not be called directly.

void psi::GCQuadrature::transformRMinMax ( double  z,
double  p 
)

Transforms region of integration to [rmin, rmax] using the linear transformation from Flores06, assuming a Gaussian envelope. rmin/rmax are the distances from the centre of the envelope such that the integrand is effectively zero.

Parameters
z- the exponent of the Gaussian envelope
p- the centre of the Gaussian envelope
void psi::GCQuadrature::transformZeroInf ( )

Transforms the region of integration to [0, inf) using the logarithmic transformation of Krack98

Member Data Documentation

int psi::GCQuadrature::end
double psi::GCQuadrature::I
private

Integration value.

int psi::GCQuadrature::M
private

Index of midpoint.

int psi::GCQuadrature::maxN
private

Maximum number of points to use in quadrature.

int psi::GCQuadrature::start

Start and endpoints of integration, used for prescreening.

GCTYPE psi::GCQuadrature::t
private

Algorithm to be used.

std::vector<double> psi::GCQuadrature::w
private

Abscissae.

std::vector<double> psi::GCQuadrature::x
private

Weights.


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