comp_gen_inte Class Template Reference

Naive generalized multi-dimensional integration. More...

#include <comp_gen_inte.h>

Inheritance diagram for comp_gen_inte:

gen_inte

Detailed Description

template<class param_t, class func_t, class lfunc_t = func_t, class ufunc_t = func_t, class vec_t = ovector_base, class alloc_vec_t = ovector, class alloc_t = ovector_alloc>
class comp_gen_inte< param_t, func_t, lfunc_t, ufunc_t, vec_t, alloc_vec_t, alloc_t >

Naive generalized multi-dimensional integration.

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 gen_inte.

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

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

Definition at line 75 of file comp_gen_inte.h.


Public Member Functions

int set_oned_inte (inte< size_t > &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, param_t &pa)
 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 ("comp_gen_inte").

Data Fields

size_t max_dim
 The maxiumum number of integration dimensions (default 100).

Protected Member Functions

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

Protected Attributes

alloc_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.
param_t * vp
 The user-specified parameter.
alloc_t ao
 Memory allocator for objects of type alloc_vec_t.
funct_mfptr_noerr
< comp_gen_inte< param_t,
func_t, lfunc_t, ufunc_t,
vec_t, alloc_vec_t, alloc_t >
, size_t > * 
fmn
 The function to send to the integrators.
size_t nint
 The size of the integration object arrays.
inte< size_t, funct< size_t > > ** iptrs
 Pointers to the integration objects.
bool * tptrs
 Flag indicating if integration object has been set.

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

Documentation generated with Doxygen and provided under the GNU Free Documentation License. See License Information for details.

Project hosting provided by SourceForge.net Logo, O2scl Sourceforge Project Page