![]() |
Object-oriented Scientific Computing Library: Version 0.910
|
Adaptive integration (CERNLIB) More...
#include <cern_adapt.h>
Uses a base integration object (default is cern_gauss56) 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 cern_gauss56. 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 71 of file cern_adapt.h.
Public Member Functions | |
Basic usage | |
virtual int | integ_err (func_t &func, double a, double b, double &res, double &err) |
Integrate function func from a to b giving result res and error err . | |
Protected Attributes | |
double | xlo [nsub] |
Lower end of subdivision. | |
double | xhi [nsub] |
High end of subdivision. | |
double | tval [nsub] |
Value of integral for subdivision. | |
double | ters [nsub] |
Squared error for subdivision. | |
int | prev_subdiv |
Previous number of subdivisions. | |
inte< func_t > * | it |
The base integration object. | |
Integration object | |
cern_gauss56< func_t > | def_inte |
Default integration object. | |
int | set_inte (inte< func_t > &i) |
Set the base integration object to use. | |
Subdivisions | |
size_t | nsubdiv |
Number of subdivisions. | |
size_t | get_nsubdivisions () |
Return the number of subdivisions used in the last integration. | |
int | get_ith_subdivision (size_t i, double &xlow, double &xhigh, double &value, double &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. |
size_t cern_adapt< func_t, nsub >::nsubdiv |
The options are
Definition at line 266 of file cern_adapt.h.
Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).