#include <integrate.h>
A C++ interface for numerical integration in two dimensions with the GSL Monte-Carlo integration functions.
Example:
Definition at line 288 of file integrate.h.
Public Member Functions | |
Integrator2d (size_t num_calls=1E6) | |
Construct an integration functor. More... | |
~Integrator2d () | |
Destructor: Clean up internal state and RNG. 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 | |
gsl_monte_plain_state * | state_ |
internal state of the Monte-Carlo integrator More... | |
gsl_rng * | rng_ |
random number generator More... | |
const std::size_t | number_of_calls_ |
number of calls to the integrand More... | |
|
inlineexplicit |
Construct an integration functor.
[in] | num_calls | The desired number of calls to the integrand function (defaults to 1E6 if omitted), i.e. how often the integrand is sampled in the Monte-Carlo integration. Larger numbers lead to a more precise result, but also to increased runtime. |
workspace_size
, keep the Integrator object around. Definition at line 304 of file integrate.h.
|
inline |
Destructor: Clean up internal state and RNG.
Definition at line 315 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 337 of file integrate.h.
|
private |
internal state of the Monte-Carlo integrator
Definition at line 363 of file integrate.h.
|
private |
random number generator
Definition at line 366 of file integrate.h.
|
private |
number of calls to the integrand
Definition at line 369 of file integrate.h.