Class inte_adapt_cern (o2scl)¶
-
template<class
func_t
= funct, classdef_inte_t
= inte_gauss56_cern<funct, double, inte_gauss56_coeffs_double>, size_tnsub
= 100, classfp_t
= double>
classo2scl
::
inte_adapt_cern
: public o2scl::inte<funct, double>¶ Adaptive integration (CERNLIB)
Uses a base integration object (default is inte_gauss56_cern) to perform adaptive integration by automatically subdividing the integration interval. At each step, the interval with the largest absolute uncertainty is divided in half. The routine succeeds if the absolute tolerance is less than tol_abs or if the relative tolerance is less than tol_rel, i.e.
\[ \mathrm{err}\leq\mathrm{tol\_abs}~\mathrm{or}~ \mathrm{err}\leq\mathrm{tol\_rel}\cdot|I| \]where \( I \) is the current estimate for the integral and \( \mathrm{err} \) is the current estimate for the uncertainty. If the number of subdivisions exceeds the template parameternsub
, the error handler is called, since the integration may not have been successful. The number of subdivisions used in the last integration can be obtained from get_nsubdivisions().The template parameter
nsub
, is the maximum number of subdivisions. It is automatically set to 100 in the original CERNLIB routine, and defaults to 100 here. The default base integration object is of type inte_gauss56_cern. This is the CERNLIB default, but can be modified by calling set_inte().This class is based on the CERNLIB routines RADAPT and DADAPT which are documented at http://wwwasdoc.web.cern.ch/wwwasdoc/shortwrupsdir/d102/top.html
- Idea for Future:
Allow user to set the initial subdivisions?
It might be interesting to directly compare the performance of this class to o2scl::inte_qag_gsl .
There is a fixme entry in the code which could be resolved.
Output the point where most subdividing was required?
Basic usage
Integration object
-
def_inte_t
def_inte
¶ Default integration object.
Subdivisions
-
size_t
nsubdiv
¶ Number of subdivisions.
The options are
0: Use previous binning and do not subdivide further
1: Automatic - adapt until tolerance is attained (default)
n: (n>1) split first in n equal subdivisions, then adapt until tolerance is obtained.
-
size_t
get_nsubdivisions
()¶ Return the number of subdivisions used in the last integration.
Public Functions
-
inte_adapt_cern
()¶
Protected Attributes
-
int
prev_subdiv
¶ Previous number of subdivisions.