All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes
o2scl::inte_gen_comp< func_t, lfunc_t, ufunc_t, vec_t > Class Template Reference

Naive generalized multi-dimensional integration. More...

Detailed Description

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

Naively combine several one-dimensional integration objects from class inte in order to perform a multi-dimensional integration. The integration routines are specified in the function set_ptrs().

The integration routines are called in order of the index specified in the function set_oned_inte(). For n-dimensional integration, n one-dimensional integration objects should be specified, with indexes 0 through n-1. The integration routines are called in order of their index, so that the outermost integration is done by the routine specified with index 0. The integral performed is:

\[ \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 \]

This class is particularly useful if $ f_0 $ is time-consuming to evaluate, and separable from $ f_{n-1} $ .

See the discussion about the functions func, lower and upper in the documentation for the class inte_gen.

No error estimate is performed. Error estimation for multiple dimension integrals is provided by the Monte Carlo integration classes (see Monte Carlo Integration).

Idea for Future:
Provide an example of usage for this class.

Definition at line 79 of file inte_gen_comp.h.

#include <inte_gen_comp.h>

Inheritance diagram for o2scl::inte_gen_comp< func_t, lfunc_t, ufunc_t, vec_t >:
o2scl::inte_gen< func_t, lfunc_t, ufunc_t, vec_t >

Public Member Functions

int set_oned_inte (inte<> &it, size_t i)
 Set the one-dimensional integration object with index i.
 
virtual double ginteg (func_t &func, size_t n, func_t &lower, func_t &upper)
 Integrate function func from $ {\ell}_i=f_i(x_i) $ to $ u_i=g_i(x_i) $ for $ 0<i<\mathrm{n}-1 $.
 
virtual const char * type ()
 Return string denoting type ("inte_gen_comp")
 
- Public Member Functions inherited from o2scl::inte_gen< func_t, lfunc_t, ufunc_t, vec_t >
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")
 

Data Fields

size_t max_dim
 The maxiumum number of integration dimensions (default 100)
 
- Data Fields inherited from o2scl::inte_gen< func_t, lfunc_t, ufunc_t, vec_t >
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 Member Functions

double odfunc (double x, size_t &ix)
 The one-dimensional integration function.
 

Protected Attributes

vec_t * cx
 The independent variable vector.
 
lfunc_t * lowerp
 The function specifying the lower limits.
 
ufunc_t * upperp
 The function specifying the upper limits.
 
func_t * mf
 The function to be integrated.
 
size_t ndim
 The number of dimensions.
 
size_t nint
 The size of the integration object arrays.
 
inte ** iptrs
 Pointers to the integration objects.
 
bool * tptrs
 Flag indicating if integration object has been set.
 
- Protected Attributes inherited from o2scl::inte_gen< func_t, lfunc_t, ufunc_t, vec_t >
double interror
 The uncertainty for the last integration computation.
 

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).
Hosted at Get Object-oriented Scientific Computing
Lib at SourceForge.net. Fast, secure and Free Open Source software
downloads..