Public Member Functions | Public Attributes | Protected Attributes | List of all members
o2scl::inte_gen< func_t, lfunc_t, ufunc_t, vec_t > Class Template Referenceabstract

Generalized multi-dimensional integration [abstract base]. More...

#include <inte_gen.h>

Public Member Functions

virtual double ginteg (func_t &func, size_t ndim, lfunc_t &a, ufunc_t &b)=0
 Integrate function func from $ x_i=a_i(x_i) $ to $ x_i=b_i(x_i) $ for $ 0<i<\mathrm{ndim}-1 $.
virtual int ginteg_err (func_t &func, size_t ndim, lfunc_t &a, ufunc_t &b, double &res, double &err)
 Integrate function func from $ x_i=a_i(x_i) $ to $ x_i=b_i(x_i) $ for $ 0<i<\mathrm{ndim}-1 $.
double get_error ()
 Return the error in the result from the last call to ginteg() or ginteg_err() More...
const char * type ()
 Return string denoting type ("inte_gen")

Public Attributes

int verbose
double tol_rel
 The maximum "uncertainty" in the value of the integral.
bool err_nonconv
 If true, call the error handler if the routine does not "converge".

Protected Attributes

double interror
 The uncertainty for the last integration computation.

Detailed Description

template<class func_t, class lfunc_t, class ufunc_t, class vec_t = boost::numeric::ublas::vector<double>>
class o2scl::inte_gen< func_t, lfunc_t, ufunc_t, vec_t >

Perform the generalized multi-dimensional integral:

\[ \int_{x_0=a_0}^{x_0=b_0} f(x_0) \int_{x_1=a_1(x_0)}^{x_1=b_1(x_0)} f(x_0, x_1) ... \int_{x_{\mathrm{n}-1}=a_{\mathrm{n}-1}(x_0,x_1,..,x_{\mathrm{n}-2})}^ {x_{\mathrm{n}-1}=b_{\mathrm{n}-1}(x_0,x_1,..,x_{\mathrm{n}-2})} f(x_0,x_1,...,x_{\mathrm{n-1}})~d x_{\mathrm{n}-1}~...~d x_1~d x_0 \]

The functions $ a_i $ and $ b_i $ are specified in the arguments a and b to the function ginteg() or ginteg_err() .

In order to allow the user to specify only three functions (for the integrand, the lower limits, and the upper limits) the first argument to the limit and integrand functions is used to distinguish among the limits for each separate integral. So first argument to a for $ a_0() $ is 0, and the first argument to a for $ a_1() $ is 1, etc., and similarly for the upper limits specified in b and the integrands specified in func.

Idea for Future:
It might be interesting to construct a child class of o2scl::inte_gen which automatically transforms variables to a hypercube and then applies a child of o2scl::inte_multi to do the integration.

Definition at line 64 of file inte_gen.h.

Member Function Documentation

◆ get_error()

template<class func_t , class lfunc_t , class ufunc_t , class vec_t = boost::numeric::ublas::vector<double>>
double o2scl::inte_gen< func_t, lfunc_t, ufunc_t, vec_t >::get_error ( )

This will quietly return zero if no integrations have been performed.

Definition at line 110 of file inte_gen.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).