Serial multi-quadrature codes were used for development and testing and are included in the source tree for posterity. Adaptive quadrature routines are implemented in the following source files for double and single precision arithmetic respectively:
The basic idea is the the STL multimap container can be used to sort quadrature subregions ("data") according to error estimates ("keys"), providing an efficient means for steering the refinement algorithm.
The multi-quadrature routines are implemented in the folowing C-source files, where the number in the file name is the degree of the Gauss-Kronrod rule per dimension:
Abscissae and weights were computed using long double precision to about O(1e-18) accuracy, i.e., order of magnitude above machine epsilon, and are thus "exact" for double and single precision.
The program tools/gkdata.cpp can be used to generate abscissae and weights for other Gauss-Kronrod rules.
Quadpack conventions are present in the "resasc" argument returned by the multi-quadrature routines. The original adaptive routines from QUADPACK computed the error estimated in a nonlinear fashion from the following data:
It is not immediately clear how this nonlinear transformation should scale for a multi-quadrature rule formed via the tensor product of lower-dimensional rules. Therefore the MGK routines compute only the raw error, that is, the absolute difference between the tensor product Gauss-Legendre and Gauss-Kronrod rules.
The value resabs is computed by these routines since it is straightforward as well as useful for determining a relative quadrature error.
Although the routines have a return argument for resasc, the computation is turned off by default, since it requires O(N^d) extra memory resources and an extra loop of the same length. It can be turned on by defining the COMPUTE_RESASC preprocessor macro; e.g., passing the -DCOMPUTE_RESASC flag when compiling the source files.
Alternatively, autotools sets this macro in the config.h header, and it can be turned on using the ./configure script:
$ ./configure --enable-resasc $ make