#include <integrate.h>
A C++ interface for numerical integration in two dimensions with the Cuba Cuhre integration function.
The algorithm is deterministic and well-suited for low dimensions, where it can reach good accuracy.
Example:
Definition at line 219 of file integrate.h.
Public Member Functions | |
Integrator2d (int num_calls=1e6, double epsrel=5e-4, double epsabs=1e-9) | |
Construct an integration functor. More... | |
template<typename F > | |
Result | operator() (double min1, double max1, double min2, double max2, F fun) |
The function call operator implements the integration functionality. More... | |
Private Attributes | |
int | maxeval_ |
The (approximate) maximum number of integrand evaluations allowed. More... | |
double | epsrel_ |
Requested relative accuracy. More... | |
double | epsabs_ |
Requested absolute accuracy. More... | |
int | nregions_ |
Actual number of subregions needed. More... | |
int | neval_ |
Actual number of integrand evaluations needed. More... | |
int | fail_ |
An error flag. More... | |
double | prob_ |
The chi^2 probability that the error is not a reliable estimate of the true integration error. More... | |
|
inlineexplicit |
Construct an integration functor.
[in] | num_calls | The maximum number of calls to the integrand function (defaults to 1E6 if omitted), i.e. how often the integrand can be sampled in the integration. Larger numbers lead to a more precise result, but possibly to increased runtime. |
[in] | epsrel | The desired relative accuracy (1E-3 by default). |
[in] | epsabs | The desired absolute accuracy (1E-3 by default). |
Definition at line 232 of file integrate.h.
|
inline |
The function call operator implements the integration functionality.
[in] | min1 | The lower limit in the first dimension. |
[in] | max1 | The upper limit in the first dimension. |
[in] | min2 | The lower limit in the second dimension. |
[in] | max2 | The upper limit in the second dimension. |
F | Type of the integrand function. |
[in] | fun | The callable to integrate over. This callable may be a function pointer, lambda, or a functor object. In any case, the callable must return a double and take two double arguments. If you want to pass additional data to the callable you can e.g. use lambda captures. |
Definition at line 253 of file integrate.h.
|
private |
The (approximate) maximum number of integrand evaluations allowed.
Definition at line 310 of file integrate.h.
|
private |
Requested relative accuracy.
Definition at line 312 of file integrate.h.
|
private |
Requested absolute accuracy.
Definition at line 314 of file integrate.h.
|
private |
Actual number of subregions needed.
Definition at line 316 of file integrate.h.
|
private |
Actual number of integrand evaluations needed.
Definition at line 318 of file integrate.h.
|
private |
An error flag.
0 if the desired accuracy was reached, -1 if the dimension is out of range, larger than 0 if the accuracy goal was not met within the maximum number of evaluations.
Definition at line 326 of file integrate.h.
|
private |
The chi^2 probability that the error is not a reliable estimate of the true integration error.
Definition at line 331 of file integrate.h.