Adaptive integration (CERNLIB) More...
#include <inte_adapt_cern.h>
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.
where is the current estimate for the integral and
is the current estimate for the uncertainty. If the number of subdivisions exceeds the template parameter
nsub
, 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
Definition at line 243 of file inte_adapt_cern.h.
Public Member Functions | |
Basic usage | |
virtual 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 giving result res and error err . | |
![]() | |
virtual double | integ (funct &func, double a, double b) |
Integrate function func from a to b . | |
virtual int | integ_err (funct &func, double a, double b, double &res, double &err)=0 |
Integrate function func from a to b and place the result in res and the error in err . | |
double | get_error () |
Return the numerically estimated error in the result from the last call to integ() More... | |
virtual const char * | type () |
Return string denoting type ("inte") | |
Protected Attributes | |
fp_t | xlo [nsub] |
Lower end of subdivision. | |
fp_t | xhi [nsub] |
High end of subdivision. | |
fp_t | tval [nsub] |
Value of integral for subdivision. | |
fp_t | ters [nsub] |
Squared error for subdivision. | |
int | prev_subdiv |
Previous number of subdivisions. | |
inte< func_t, fp_t > * | it |
The base integration object. | |
![]() | |
double | interror |
The uncertainty for the last integration computation. | |
Integration object | |
def_inte_t | def_inte |
Default integration object. | |
int | set_inte (inte< func_t, fp_t > &i) |
Set the base integration object to use. | |
Subdivisions | |
size_t | nsubdiv |
Number of subdivisions. More... | |
size_t | get_nsubdivisions () |
Return the number of subdivisions used in the last integration. | |
int | get_ith_subdivision (size_t i, fp_t &xlow, fp_t &xhigh, fp_t &value, fp_t &errsq) |
Return the ith subdivision. | |
template<class vec_t > | |
int | get_subdivisions (vec_t &xlow, vec_t &xhigh, vec_t &value, vec_t &errsq) |
Return all of the subdivisions. | |
Additional Inherited Members | |
![]() | |
int | verbose |
Verbosity. | |
size_t | last_iter |
The most recent number of iterations taken. | |
double | tol_rel |
The maximum relative uncertainty in the value of the integral (default ![]() | |
double | tol_abs |
The maximum absolute uncertainty in the value of the integral (default ![]() | |
bool | err_nonconv |
If true, call the error handler if the routine does not converge or reach the desired tolerance (default true) More... | |
size_t o2scl::inte_adapt_cern< func_t, def_inte_t, nsub, fp_t >::nsubdiv |
The options are
Definition at line 437 of file inte_adapt_cern.h.
Documentation generated with Doxygen. Provided under the
GNU Free Documentation License (see License Information).