15 #ifndef BORNAGAIN_BASE_UTILS_INTEGRATORMCMISER_H
16 #define BORNAGAIN_BASE_UTILS_INTEGRATORMCMISER_H
18 #include <gsl/gsl_monte_miser.h>
22 template <
class T>
using miser_integrand = double (T::*)(
double*, size_t,
void*)
const;
49 double integrate(
double* min_array,
double* max_array,
void* params,
size_t nbr_points);
87 : mp_object(p_object), m_member_function(p_member_function),
88 m_dim(dim), m_gsl_workspace{nullptr}
92 const gsl_rng_type* random_type;
94 random_type = gsl_rng_default;
100 gsl_monte_miser_free(m_gsl_workspace);
101 gsl_rng_free(m_random_gen);
110 gsl_monte_function f;
111 f.f = StaticCallBack;
115 double result, error;
116 gsl_monte_miser_integrate(&f, min_array, max_array, m_dim, nbr_points, m_random_gen,
117 m_gsl_workspace, &result, &error);
double(T::*)(double *, size_t, void *) const miser_integrand
Alias template for member function with signature double f(double)
std::unique_ptr< IntegratorMCMiser< T > > P_integrator_miser
Alias template for handle to a miser integrator.
Template class to use Monte Carlo MISER integration of class member functions.
static double StaticCallBack(double *d_array, size_t dim, void *v)
static function that can be passed to gsl integrator
double integrate(double *min_array, double *max_array, void *params, size_t nbr_points)
perform the actual integration over the ranges [min_array, max_array]
miser_integrand< T > m_member_function
IntegratorMCMiser(const T *p_object, miser_integrand< T > p_member_function, size_t dim)
to integrate p_member_function, which must belong to p_object
size_t m_dim
dimension of the integration
gsl_monte_miser_state * m_gsl_workspace
structure holding the object and possible extra parameters
miser_integrand< T > m_member_function
const T * m_object_pointer