Adaptive multidimensional integration on hyper-rectangles using cubature rules from the Cubature library. More...
#include <cubature.h>
This class is experimental.
A cubature rule takes a function and a hypercube and evaluates the function at a small number of points, returning an estimate of the integral as well as an estimate of the error, and also a suggested dimension of the hypercube to subdivide.
Given such a rule, the adaptive integration is simple:
1) Evaluate the cubature rule on the hypercube(s). Stop if converged.
2) Pick the hypercube with the largest estimated error, and divide it in two along the suggested dimension.
3) Goto (1).
The basic algorithm is based on the adaptive cubature described in Genz80 and subsequently extended to integrating a vector of integrands in Berntsen91 .
Definition at line 133 of file cubature.h.
Classes | |
class | esterr |
A value and error. More... | |
class | heap |
Desc. More... | |
class | hypercube |
Desc. More... | |
class | region |
Desc. More... | |
class | rule |
Desc. More... | |
class | rule75genzmalik |
Desc. More... | |
Public Types | |
typedef boost::numeric::ublas::vector< double > | ubvector |
typedef boost::numeric::ublas::vector_range< ubvector > | ubvector_range |
![]() | |
enum | error_norm { ERROR_INDIVIDUAL = 0, ERROR_PAIRED, ERROR_L2, ERROR_L1, ERROR_LINF } |
Different ways of measuring the absolute and relative error. More... | |
Protected Member Functions | |
double | errMax (const std::vector< esterr > &ee) |
Return the maximum error from ee . | |
double | compute_vol (const hypercube &h) |
Desc. | |
template<class vec_t > | |
void | make_hypercube (size_t dim, const vec_t ¢er, const vec_t &halfwidth, hypercube &h) |
Desc. | |
void | make_hypercube2 (size_t dim, const std::vector< double > &dat, hypercube &h) |
Desc. | |
template<class vec_t > | |
void | make_hypercube_range (size_t dim, const vec_t &xmin, const vec_t &xmax, hypercube &h) |
Desc. | |
void | destroy_hypercube (hypercube &h) |
Desc. | |
void | make_region (const hypercube &h, size_t fdim, region &R) |
Desc. | |
int | cut_region (region &R, region &R2) |
Desc. | |
void | alloc_rule_pts (rule &r, size_t num_regions) |
Desc. | |
void | make_rule (size_t dim, size_t fdim, size_t num_points, rule &r) |
Desc. | |
int | eval_regions (size_t nR, std::vector< region > &R, func_t &f, rule &r) |
Desc. More... | |
size_t | ls0 (size_t n) |
Functions to loop over points in a hypercube. More... | |
void | evalR_Rfs2 (ubvector &pts, size_t pts_ix, size_t dim, std::vector< double > &p, size_t p_ix, const std::vector< double > &c, size_t c_ix, const std::vector< double > &r, size_t r_ix) |
Evaluate the integration points for all ![]() | |
void | evalRR0_0fs2 (ubvector &pts, size_t pts_ix, size_t dim, std::vector< double > &p, size_t p_ix, const std::vector< double > &c, size_t c_ix, const std::vector< double > &r, size_t r_ix) |
Desc. | |
void | evalR0_0fs4d2 (ubvector &pts, size_t pts_ix, size_t dim, std::vector< double > &p, size_t p_ix, const std::vector< double > &c, size_t c_ix, const std::vector< double > &r1, size_t r1_ix, const std::vector< double > &r2, size_t r2_ix) |
Desc. | |
size_t | num0_0 (size_t dim) |
Desc. | |
size_t | numR0_0fs (size_t dim) |
Desc. | |
size_t | numRR0_0fs (size_t dim) |
Desc. | |
size_t | numR_Rfs (size_t dim) |
Desc. | |
int | rule75genzmalik_evalError (rule &runder, size_t fdim, func_t &f, size_t nR, std::vector< region > &R) |
Desc. | |
void | make_rule75genzmalik (size_t dim, size_t fdim, rule75genzmalik &r) |
Desc. | |
int | rule15gauss_evalError (rule &r, size_t fdim, func_t &f, size_t nR, std::vector< region > &R) |
1d 15-point Gaussian quadrature rule, based on qk15.c and qk.c in GNU GSL (which in turn is based on QUADPACK). | |
void | make_rule15gauss (size_t dim, size_t fdim, rule &r) |
Desc. | |
Binary heap implementation | |
Based on Cormen09 and used as a priority queue of regions to integrate. | |
typedef region | heap_item |
Desc. | |
int | use_parallel |
Desc. | |
void | heap_resize (heap &h, size_t nalloc) |
Desc. | |
heap | heap_alloc (size_t nalloc, size_t fdim) |
Desc. | |
void | heap_free (heap &h) |
Note that heap_free does not deallocate anything referenced by the items. | |
int | heap_push (heap &h, heap_item &hi) |
Desc. | |
int | heap_push_many (heap &h, size_t ni, heap_item *hi) |
Desc. | |
heap_item | heap_pop (heap &h) |
Desc. | |
int | converged (size_t fdim, const std::vector< esterr > &ee, double reqAbsError, double reqRelError, error_norm norm) |
Desc. | |
template<class vec_t > | |
int | rulecubature (rule &r, size_t fdim, func_t &f, const hypercube &h, size_t maxEval, double reqAbsError, double reqRelError, error_norm norm, vec_t &val, vec_t &err, int parallel) |
Desc. | |
template<class vec_t > | |
int | cubature (size_t fdim, func_t &f, size_t dim, const vec_t &xmin, const vec_t &xmax, size_t maxEval, double reqAbsError, double reqRelError, error_norm norm, vec_t &val, vec_t &err, int parallel) |
Desc. | |
inte_hcubature () | |
template<class vec_t > | |
int | integ (size_t fdim, func_t &f, size_t dim, const vec_t &xmin, const vec_t &xmax, size_t maxEval, double reqAbsError, double reqRelError, error_norm norm, vec_t &val, vec_t &err) |
Desc. | |
|
inlineprotected |
Definition at line 419 of file cubature.h.
|
inlineprotected |
A Gray-code ordering is used to minimize the number of coordinate updates in p, although this doesn't matter as much now that we are saving all pts.
Definition at line 488 of file cubature.h.
|
inlineprotected |
Based on orbitrule.cpp in HIntLib-0.0.10
ls0 returns the least-significant 0 bit of n (e.g. it returns 0 if the LSB is 0, it returns 1 if the 2 LSBs are 01, etcetera).
Definition at line 448 of file cubature.h.
Documentation generated with Doxygen. Provided under the
GNU Free Documentation License (see License Information).