Classes | Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Attributes | List of all members
o2scl::inte_pcubature< func_t, vec_t, vec_crange_t, vec_range_t > Class Template Reference

Integration by p-adaptive cubature from the Cubature library. More...

#include <cubature.h>

Inheritance diagram for o2scl::inte_pcubature< func_t, vec_t, vec_crange_t, vec_range_t >:
o2scl::inte_cubature_base

Classes

class  cache
 Cache of the values for the m[dim] grid. More...
 

Public Member Functions

int integ_v_buf (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, std::vector< size_t > &m, vec_t &buf, size_t &nbuf, size_t max_nbuf, vec_t &val, vec_t &err)
 Desc. More...
 
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.
 

Static Public Attributes

static const size_t DEFAULT_MAX_NBUF =(1U << 20)
 Desc.
 

Protected Member Functions

int compute_cacheval (const std::vector< size_t > &m, size_t mi, vec_t &val, size_t &vali, size_t fdim, func_t &f, size_t dim, size_t id, std::vector< double > &p, const vec_t &xmin, const vec_t &xmax, vec_t &buf, size_t nbuf, size_t &ibuf)
 Desc. More...
 
size_t num_cacheval (const std::vector< size_t > &m, size_t mi, size_t dim, size_t i_shift)
 Desc.
 
int add_cacheval (std::vector< cache > &vc, const std::vector< size_t > &m, size_t mi, size_t fdim, func_t &f, size_t dim, const vec_t &xmin, const vec_t &xmax, vec_t &buf, size_t nbuf)
 Desc.
 
size_t eval (const std::vector< size_t > &cm, size_t cmi, vec_t &cval, const std::vector< size_t > &m, size_t md, size_t fdim, size_t dim, size_t id, double weight, vec_t &val, size_t voff2)
 Desc. More...
 
void evals (std::vector< cache > &vc, const std::vector< size_t > &m, size_t md, size_t fdim, size_t dim, double V, vec_t &val)
 Desc. More...
 
void eval_integral (std::vector< cache > &vc, const std::vector< size_t > &m, size_t fdim, size_t dim, double V, size_t &mi, vec_t &val, vec_t &err, vec_t &val1)
 Desc. More...
 
template<class vec2_t >
int converged (size_t fdim, const vec2_t &vals, const vec2_t &errs, double reqAbsError, double reqRelError, error_norm norm)
 Desc.
 

Static Protected Attributes

static const size_t MAXDIM =20
 Maximum integral dimension.
 

Additional Inherited Members

- Public Types inherited from o2scl::inte_cubature_base
enum  error_norm {
  ERROR_INDIVIDUAL = 0, ERROR_PAIRED, ERROR_L2, ERROR_L1,
  ERROR_LINF
}
 Different ways of measuring the absolute and relative error. More...
 

Detailed Description

template<class func_t, class vec_t, class vec_crange_t, class vec_range_t>
class o2scl::inte_pcubature< func_t, vec_t, vec_crange_t, vec_range_t >

This class is experimental.


Documentation adapted from Cubature

This class performs adaptive integration by increasing the degree of the cubature rule rather than subdividing the domain, using products of Clenshaw-Curtis rules. This algorithm may be superior to Genz-Malik for smooth integrands lacking strongly-localized features, in moderate dimensions.


Definition at line 1482 of file cubature.h.

Member Function Documentation

◆ compute_cacheval()

template<class func_t , class vec_t , class vec_crange_t , class vec_range_t >
int o2scl::inte_pcubature< func_t, vec_t, vec_crange_t, vec_range_t >::compute_cacheval ( const std::vector< size_t > &  m,
size_t  mi,
vec_t &  val,
size_t &  vali,
size_t  fdim,
func_t &  f,
size_t  dim,
size_t  id,
std::vector< double > &  p,
const vec_t &  xmin,
const vec_t &  xmax,
vec_t &  buf,
size_t  nbuf,
size_t &  ibuf 
)
inlineprotected

recursive loop over all cubature points for the given (m,mi) cache entry: add each point to the buffer buf, evaluating all at once whenever the buffer is full or when we are done

Definition at line 1536 of file cubature.h.

◆ eval()

template<class func_t , class vec_t , class vec_crange_t , class vec_range_t >
size_t o2scl::inte_pcubature< func_t, vec_t, vec_crange_t, vec_range_t >::eval ( const std::vector< size_t > &  cm,
size_t  cmi,
vec_t &  cval,
const std::vector< size_t > &  m,
size_t  md,
size_t  fdim,
size_t  dim,
size_t  id,
double  weight,
vec_t &  val,
size_t  voff2 
)
inlineprotected

Recursive loop to evaluate the integral contribution from the cache entry c, accumulating in val, for the given m[] except with m[md] -> m[md] - 1 if md < dim, using the cached values (cm,cmi,cval). id is the current loop dimension (from 0 to dim-1).

Definition at line 1661 of file cubature.h.

◆ eval_integral()

template<class func_t , class vec_t , class vec_crange_t , class vec_range_t >
void o2scl::inte_pcubature< func_t, vec_t, vec_crange_t, vec_range_t >::eval_integral ( std::vector< cache > &  vc,
const std::vector< size_t > &  m,
size_t  fdim,
size_t  dim,
double  V,
size_t &  mi,
vec_t &  val,
vec_t &  err,
vec_t &  val1 
)
inlineprotected

Evaluate the integrals for the given m[] using the cached values in vc, storing the integrals in val[], the error estimate in err[], and the dimension to subdivide next (the largest error contribution) in *mi

Definition at line 1738 of file cubature.h.

◆ evals()

template<class func_t , class vec_t , class vec_crange_t , class vec_range_t >
void o2scl::inte_pcubature< func_t, vec_t, vec_crange_t, vec_range_t >::evals ( std::vector< cache > &  vc,
const std::vector< size_t > &  m,
size_t  md,
size_t  fdim,
size_t  dim,
double  V,
vec_t &  val 
)
inlineprotected

Loop over all cache entries that contribute to the integral, (with m[md] decremented by 1)

Definition at line 1715 of file cubature.h.

◆ integ_v_buf()

template<class func_t , class vec_t , class vec_crange_t , class vec_range_t >
int o2scl::inte_pcubature< func_t, vec_t, vec_crange_t, vec_range_t >::integ_v_buf ( 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,
std::vector< size_t > &  m,
vec_t &  buf,
size_t &  nbuf,
size_t  max_nbuf,
vec_t &  val,
vec_t &  err 
)
inline

Vectorized version with user-supplied buffer to store points and values. The buffer *buf should be of length *nbuf * dim on entry (these parameters are changed upon return to the final buffer and length that was used). The buffer length will be kept <= max(max_nbuf, 1) * dim.

Also allows the caller to specify an array m[dim] of starting degrees for the rule, which upon return will hold the final degrees. The number of points in each dimension i is 2^(m[i]+1)

  • 1.

Definition at line 1880 of file cubature.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).