Class inte_kronrod_boost (o2scl)

O2scl : Class List

template<size_t rule = 15, class fp_25_t = o2fp_25, class fp_35_t = o2fp_35, class fp_50_t = o2fp_50, class fp_100_t = o2fp_100>
class inte_kronrod_boost

Gauss-Kronrod integration class with multiprecision (Boost)

If the default value of tol_rel is used, then this class uses the square root of numeric_limits::epsilon for the relative tolerance. For double precision numbers, this tolerance is usually about \( 10^{-8} \). If the final uncertainty exceeds this value, then the error handler is called, unless err_nonconv is false. Internally, the boost integration function is called with a tolerance which is a factor of 10 smaller, because this is often necessary to ensure convergence.

The multiprecision integration functions require a template function input, and their default tolerance is given by \( 10^{-d} \) where \( d \) is numeric_limits::digits10 .

Note

The uncertainties reported by this class depend on those returned by the boost integration functions and are occasionally underestimated.

Note

The default maximum depth may be insufficient, especially for high-precision types or multiprecision integration, and can be changed with set_max_depth().

Warning

For sufficiently difficult integrands, the multiprecision functions may take a very long time to complete.

Internal methods and data [protected]

size_t max_depth

Maximum depth (default 15)

template<typename func_t, class fp_t>
inline int integ_err_funct(func_t &f, fp_t a, fp_t b, fp_t &res, fp_t &err, fp_t &L1norm_loc, double target_tol, double integ_tol)

Internal integration wrapper of the boost function which stores the L1 norm and tests if the uncertainty is sufficiently small.

This function is used by both integ_err() and integ_err_int() .

template<typename func_t, class fp_t>
inline int integ_err_int(func_t &&func, fp_t a, fp_t b, fp_t &res, fp_t &err, fp_t &L1norm_loc, double target_tol, double integ_tol, double func_tol)

Integrate function func, the internal wrapper which uses a funct_multip object.

There are three tolerances:

  • target_tol is the target tolerance which is sent to the boost integration function. The error value returned by the boost integration function is often larger than this

  • integ_tol is the desired final tolerance of the integration. This function regards the integration as a failure if the error value is larger than integ_tol

  • func_tol is the tolerance for evaluations of the integrand. This value is passed to o2scl::funct_multip.

This function is used by integ_err_multip()

Integration settings

double pow_tol_func

Power for tolerance of function evaluations in multiprecision integrations (default 1.33)

double tol_rel

The maximum relative uncertainty in the value of the integral (default \( -1 \))

double tol_abs

The maximum absolute uncertainty in the value of the integral (default \( -1 \))

\note This value is unused by this integrator, but this
is included for compatibility with the other integrators.
int verbose

Verbosity parameter.

bool err_nonconv

If true, call the error handler if the integration does not succeed (default true)

int fm_verbose

Verbosity parameter for the internal funct_multip object.

inline void set_max_depth(size_t md)

Set the maximum number of interval splittings (default 15)

Integration output quantities

double L1norm

\( L_1 \) norm from the last integration

Constructor

inline inte_kronrod_boost()

Main integration functions

template<typename func_t, class fp_t>
inline int integ_err(func_t &func, fp_t a, fp_t b, fp_t &res, fp_t &err)

Integrate function func from a to b and place the result in res and the error in err.

template<typename func_t, class fp_t>
inline fp_t integ(func_t &func, fp_t a, fp_t b)

Integrate function func from a to b.

Multiprecision integration functions

template<typename func_t, class fp_t>
inline int integ_err_multip(func_t &&func, fp_t a, fp_t b, fp_t &res, fp_t &err, double integ_tol = -1.0)

Integrate function func from a to b using multipreicsion, placing the result in res and the error in err.

template<typename func_t, class fp_t>
inline fp_t integ_multip(func_t &&func, fp_t a, fp_t b)

Integrate function func from a to b.

template<typename func_t, class fp_t>
inline int integ_iu_err_multip(func_t &&func, fp_t a, fp_t &res, fp_t &err, double integ_tol = -1.0)

Integrate function func from a to \( \infty \) using multipreicsion, placing the result in res and the error in err.

template<typename func_t, class fp_t>
inline fp_t integ_iu_multip(func_t &&func, fp_t a, fp_t b)

Integrate function func from a to b.

template<typename func_t, class fp_t>
inline int integ_il_err_multip(func_t &&func, fp_t b, fp_t &res, fp_t &err, double integ_tol = -1.0)

Integrate function func from \( -\infty \) to b using multipreicsion, placing the result in res and the error in err.

template<typename func_t, class fp_t>
inline fp_t integ_il_multip(func_t &&func, fp_t a, fp_t b)

Integrate function func from a to b.

template<typename func_t, class fp_t>
inline int integ_i_err_multip(func_t &&func, fp_t &res, fp_t &err, double integ_tol = -1.0)

Integrate function func from \( -\infty \) to \( \infty \) using multipreicsion, placing the result in res and the error in err.

template<typename func_t, class fp_t>
inline fp_t integ_i_multip(func_t &&func, fp_t a, fp_t b)

Integrate function func from a to b.