Class GCQuadrature

Class Documentation

class GCQuadrature

Performs adaptive Gauss-Chebyshev quadrature of the second kind 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]

REFERENCES: (Perez92) J.M. Perez-Jorda et al., Comput. Phys. Comm. 70 (1992), 271-284 (Perez93) J.M. Perez-Jorda et al., Comput. Phys. Comm. 77 (1993), 46-56 (Krack98) M. Krack, A.M. Koster, J. Chem. Phys. 108 (1998), 3226 - 3234 (Flores06) R. Flores-Moreno et al., J. Comput. Chem. 27 (2006), 1009-1019

Public Functions

GCQuadrature()

Default constructor, creates empty object.

GCQuadrature(const GCQuadrature &other)

Copy constructor, carbon copies all members.

void 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)

std::pair<double, bool> integrate(std::function<double(double, const double*, int)> &f, const double *params, double tolerance, int start, int end) const

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

  • start – - the index of the first point used in the integration

  • end – - the index of the last point used in the integration

Returns

the integral (first) and true if integration converged, false otherwise (second)

void transformZeroInf()

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

void 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 untransformRMinMax(double z, double p)
inline int getN() const
Returns

the maximum number of quadrature points

inline std::vector<double> &getX()
Returns

a reference to the abscissae

inline const std::vector<double> &getX() const