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>
54 double integrate(
double* min_array,
double* max_array,
const void* params,
55 size_t nbr_points)
const;
63 return (p_cb->m_object_pointer->*mf)(d_array, dim, p_cb->m_data);
94 , m_member_function(p_member_function)
96 , m_gsl_workspace{nullptr}
100 const gsl_rng_type* random_type;
102 random_type = gsl_rng_default;
109 gsl_monte_miser_free(m_gsl_workspace);
110 gsl_rng_free(m_random_gen);
115 size_t nbr_points)
const
119 gsl_monte_function f;
120 f.f = StaticCallBack;
124 double result, error;
125 gsl_monte_miser_integrate(&f, min_array, max_array, m_dim, nbr_points, m_random_gen,
126 m_gsl_workspace, &result, &error);
std::unique_ptr< IntegratorMCMiser< T > > P_integrator_miser
Alias template for handle to a miser integrator.
double(T::*)(const double *, size_t, const void *) const miser_integrand
Alias template for member function with signature double f(double)
P_integrator_miser< T > make_integrator_miser(const T *object, miser_integrand< T > mem_function, size_t dim)
Template function to create an integrator object.
Template class to use Monte Carlo MISER integration of class member functions.
double integrate(double *min_array, double *max_array, const void *params, size_t nbr_points) const
perform the actual integration over the ranges [min_array, max_array]
static double StaticCallBack(double *d_array, size_t dim, void *v)
static function that can be passed to gsl integrator
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
const miser_integrand< T > m_member_function
gsl_monte_miser_state * m_gsl_workspace
const size_t m_dim
dimension of the integration
structure holding the object and possible extra parameters
const miser_integrand< T > m_member_function
const T * m_object_pointer