Public Member Functions | Protected Attributes | List of all members
o2scl::inte_kronrod_gsl< func_t > Class Template Reference

Basic Gauss-Kronrod integration class (GSL) More...

#include <inte_kronrod_gsl.h>

Inheritance diagram for o2scl::inte_kronrod_gsl< func_t >:
o2scl::inte_gsl o2scl::inte< func_t > o2scl::inte_qag_gsl< func_t > o2scl::inte_singular_gsl< func_t > o2scl::inte_qags_gsl< func_t > o2scl::inte_transform_gsl< func_t > o2scl::inte_cheb_gsl< func_t > o2scl::inte_qagi_gsl< func_t > o2scl::inte_qagil_gsl< func_t > o2scl::inte_qagiu_gsl< func_t > o2scl::inte_qawc_gsl< func_t > o2scl::inte_qawo_gsl_sin< func_t > o2scl::inte_qaws_gsl< func_t > o2scl::inte_qawf_gsl_sin< func_t > o2scl::inte_qawo_gsl_cos< func_t > o2scl::inte_qawf_gsl_cos< func_t >

Public Member Functions

int get_rule ()
 Get the Gauss-Kronrod integration rule. More...
 
void set_rule (int rule)
 Set the Gauss-Kronrod integration rule to be used.
 
int set_limit (size_t lim)
 Set the limit for the number of subdivisions of the integration region (default 1000) More...
 
template<class func2_t >
void gauss_kronrod_base (func2_t &func, double a, double b, double *result, double *abserr, double *resabs, double *resasc)
 The base Gauss-Kronrod integration function template. More...
 
virtual void gauss_kronrod (func_t &func, double a, double b, double *result, double *abserr, double *resabs, double *resasc)
 Integration wrapper for user-specified function type.
 
- Public Member Functions inherited from o2scl::inte< func_t >
virtual double integ (func_t &func, double a, double b)
 Integrate function func from a to b.
 
virtual int integ_err (func_t &func, double a, double b, double &res, double &err)=0
 Integrate function func from a to b and place the result in res and the error in err.
 
double get_error ()
 Return the numerically estimated error in the result from the last call to integ() More...
 
virtual const char * type ()
 Return string denoting type ("inte")
 

Protected Attributes

inte_workspace_gslw
 The integration workspace.
 
int n_gk
 Size of Gauss-Kronrod arrays.
 
const double * x_gk
 Gauss-Kronrod abscissae pointer.
 
const double * w_g
 Gauss weight pointer.
 
const double * w_gk
 Gauss-Kronrod weight pointer.
 
double * f_v1
 Scratch space.
 
double * f_v2
 Scratch space.
 
- Protected Attributes inherited from o2scl::inte< func_t >
double interror
 The uncertainty for the last integration computation.
 

Additional Inherited Members

- Public Attributes inherited from o2scl::inte< func_t >
int verbose
 Verbosity.
 
size_t last_iter
 The most recent number of iterations taken.
 
double tol_rel
 The maximum relative uncertainty in the value of the integral (default $ 10^{-8} $)
 
double tol_abs
 The maximum absolute uncertainty in the value of the integral (default $ 10^{-8} $)
 
bool err_nonconv
 If true, call the error handler if the routine does not converge or reach the desired tolerance (default true) More...
 
- Protected Member Functions inherited from o2scl::inte_gsl
double rescale_error (double err, const double result_abs, const double result_asc)
 QUADPACK's nonlinear rescaling of the absolute-error estimate. More...
 

Detailed Description

template<class func_t>
class o2scl::inte_kronrod_gsl< func_t >

This class provides the basic Gauss-Kronrod integration function and integration workspace for some of the GSL-based integration classes.

The main function of interest is set_rule(), which sets the integration rule for the GSL integration classes which inherit from this base class. The argument to set rule should be selected from the following list:

The integration coefficients for use with this class and associated children are stored in the o2scl_inte_gk_coeffs namespace.

Idea for Future:
Convert 'double *' objects to ubvector

Definition at line 615 of file inte_kronrod_gsl.h.

Member Function Documentation

◆ gauss_kronrod_base()

template<class func_t >
template<class func2_t >
void o2scl::inte_kronrod_gsl< func_t >::gauss_kronrod_base ( func2_t &  func,
double  a,
double  b,
double *  result,
double *  abserr,
double *  resabs,
double *  resasc 
)
inline

Given abcissas and weights, this performs the integration of func between a and b, providing a result with uncertainties.

The Gauss-Kronrod rule uses $ 2m+1 $ abscissae $ x_1, \ldots, x_{2m+1} \in (a, b) $ to estimate the integral of a function as a linear combination of values,

\[ \int_a^b f~dx \; \approx \; Q_m^{GK}f \; \equiv \; \sum_{k=1}^{2m+1} \beta_k f(x_k), \]

where the weights $ \beta_1,\ldots, \beta_{2m+1} $ are intrinsic to the abscissae. The data are designed so that the even-indexed abscissae yield a coarser estimate,

\[ Q_m^{G}f \; \equiv \; \sum_{j=1}^{m} \alpha_j f(x_{2j}), \]

and their difference $ |Q_m^Gf - Q_m^{GK}f| $ is the "raw" error estimate. The various quantities that the function computes are

\begin{eqnarray*} \mathtt{result} &=& Q_m^{GK}f, \\ \mathtt{resabs} &=& Q_m^{GK}|f|, \\ \mathtt{resasc} &=& Q_m^{GK}(|f| - \mu), \quad \mu \equiv \frac{Q_m^{GK}f}{b - a}. \end{eqnarray*}

The "absolute" error abserr is computed from the raw error value using the function inte_gsl::rescale_error.

This function is designed for use with the values given in the o2scl_inte_gk_coeffs namespace.

This function never calls the error handler.

Idea for Future:
This function, in principle, is an integration object in and of itself, and could be implemented separately as an object of type o2scl::inte.

Definition at line 799 of file inte_kronrod_gsl.h.

◆ get_rule()

template<class func_t >
int o2scl::inte_kronrod_gsl< func_t >::get_rule ( )
inline

This returns the index of the GSL integration rule a number between 1 and 6 (inclusive)

Definition at line 664 of file inte_kronrod_gsl.h.

◆ set_limit()

template<class func_t >
int o2scl::inte_kronrod_gsl< func_t >::set_limit ( size_t  lim)
inline

If the value of size is zero, the error handler will be called.

Definition at line 746 of file inte_kronrod_gsl.h.


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

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).