#include <integrate.h>
A C++ interface for numerical integration in one dimension with the GSL Monte-Carlo integration functions.
Example:
Definition at line 188 of file integrate.h.
Public Member Functions | |
| Integrator1dMonte (size_t num_calls=1E6) | |
| Construct an integration functor. More... | |
| ~Integrator1dMonte () | |
| Destructor: Clean up internal state and RNG. More... | |
| template<typename F > | |
| Result | operator() (double min, double max, 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 204 of file integrate.h.
|
inline |
Destructor: Clean up internal state and RNG.
Definition at line 215 of file integrate.h.
|
inline |
The function call operator implements the integration functionality.
| [in] | min | The lower limit of the integration. |
| [in] | max | The upper limit of the integration. |
| 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 235 of file integrate.h.
|
private |
internal state of the Monte-Carlo integrator
Definition at line 268 of file integrate.h.
|
private |
random number generator
Definition at line 271 of file integrate.h.
|
private |
number of calls to the integrand
Definition at line 274 of file integrate.h.