16 #error no need to expose this header to Swig
20 #ifndef BORNAGAIN_BASE_MATH_INTEGRATORMCMISER_H
21 #define BORNAGAIN_BASE_MATH_INTEGRATORMCMISER_H
23 #include <gsl/gsl_monte_miser.h>
27 template <
class T>
using miser_integrand = double (T::*)(
double*, size_t,
void*)
const;
53 double integrate(
double* min_array,
double* max_array,
void* params,
size_t nbr_points);
91 : m_object(p_object), m_member_function(p_member_function), m_dim(dim), m_gsl_workspace{nullptr}
95 const gsl_rng_type* random_type;
97 random_type = gsl_rng_default;
103 gsl_monte_miser_free(m_gsl_workspace);
104 gsl_rng_free(m_random_gen);
113 gsl_monte_function f;
114 f.f = StaticCallBack;
118 double result, error;
119 gsl_monte_miser_integrate(&f, min_array, max_array, m_dim, nbr_points, m_random_gen,
120 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