Class inte_gen (o2scl)¶
-
template<class
func_t
, classlfunc_t
, classufunc_t
, classvec_t
= boost::numeric::ublas::vector<double>>
classo2scl
::
inte_gen
¶ Generalized multi-dimensional integration [abstract base].
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
andb
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 toa
for \( a_1() \) is 1, etc., and similarly for the upper limits specified inb
and the integrands specified infunc
.- 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.
Public Functions
-
inte_gen
()¶
-
~inte_gen
()¶
-
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 \).
-
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()
This will quietly return zero if no integrations have been performed.
-
const char *
type
()¶ Return string denoting type (“inte_gen”)
Public Members
-
int
verbose
¶ Verbosity.
-
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.