20#ifndef CCGSL_MONTE_MISER_HPP
21#define CCGSL_MONTE_MISER_HPP
24#include<gsl/gsl_monte_miser.h>
54 explicit state(
size_t const dim ){
57 try {
count =
new size_t; }
catch( std::bad_alloc& e ){
70 explicit state( gsl_monte_miser_state* v ){
112#ifdef __GXX_EXPERIMENTAL_CXX0X__
118 std::swap(
count, v.count );
119 v.ccgsl_pointer =
nullptr;
127 state( std::move( v ) ).swap( *
this );
237#ifdef __GXX_EXPERIMENTAL_CXX0X__
284 {
ccgsl_pointer->min_calls_per_bisection = min_calls_per_bisection; }
317 double const xu[],
size_t const dim,
size_t const calls,
319 return gsl_monte_miser_integrate( f, xl, xu, dim, calls, r.
get(), state.get(),
334 template<
typename L,
typename U>
336 U
const& xu,
size_t const calls,
338 size_t const dim = xl.size();
339 if( dim != xu.size() )
340 GSL_ERROR(
"Mismatch in array lengths", GSL_EBADLEN );
341 if( dim != state.get()->dim )
342 GSL_ERROR(
"Array lengths must match dimension of state", GSL_EBADLEN );
343 return gsl_monte_miser_integrate( f, xl.data(), xu.data(), dim, calls,
344 r.
get(), state.get(),
result, abserr ); }
359 template<
typename L,
typename U>
361 U
const& xu,
size_t const calls,
363 size_t const dim = xl.size();
364 if( dim != xu.size() )
365 GSL_ERROR(
"Mismatch in array lengths", GSL_EBADLEN );
367 GSL_ERROR(
"Array lengths must match dimension of state", GSL_EBADLEN );
368 return gsl_monte_miser_integrate( &f, xl.data(), xu.data(), dim, calls,
Class that extends gsl_monte_function so that it can be constructed from arbitrary function objects.
Workspace for Monte Carlo integration using the MISER algorithm.
bool operator<(state const &v) const
A container needs to define an ordering for sorting.
state(gsl_monte_miser_state *v)
Could construct from a gsl_monte_miser_state.
void set_estimate_frac(double const estimate_frac)
Set estimate_frac.
state & operator=(state &&v)
Move operator.
size_t get_min_calls_per_bisection() const
Get min_calls_per_bisection.
gsl_monte_miser_state * get() const
Get the gsl_monte_miser_state.
bool empty() const
Find if the state is empty.
bool operator!=(state const &v) const
Two state are different if their elements are not identical.
double get_alpha() const
Get alpha.
~state()
The destructor only deletes the pointers if count reaches zero.
double get_estimate_frac() const
Get estimate_frac.
void set_min_calls_per_bisection(size_t const min_calls_per_bisection)
Set min_calls_per_bisection.
state(size_t const dim)
The default constructor creates a new state with n elements.
size_t use_count() const
Find how many state objects share this pointer.
bool operator>(state const &v) const
A container needs to define an ordering for sorting.
void set_min_calls(size_t const min_calls)
Set min_calls.
bool unique() const
Find if this is the only object sharing the gsl_monte_miser_state.
void set_dither(double const dither)
Set dither.
bool operator<=(state const &v) const
A container needs to define an ordering for sorting.
double get_dither() const
Get dither.
state & operator=(state const &v)
The assignment operator.
gsl_monte_miser_state * ccgsl_pointer
The shared pointer.
state()
The default constructor is only really useful for assigning to.
state(state &&v)
Move constructor.
bool operator>=(state const &v) const
A container needs to define an ordering for sorting.
void swap(state &v)
Swap two state objects.
size_t * count
The shared reference count.
size_t get_min_calls() const
Get min_calls.
void set_alpha(double const alpha)
Set alpha.
bool operator==(state const &v) const
Two state are identically equal if their elements are identical.
state(state const &v)
The copy constructor.
gsl_rng * get() const
Get the gsl_rng.
int init(gsl::monte::miser::state &state)
C++ version of gsl_monte_miser_init().
int integrate(gsl::monte::function &f, L const &xl, U const &xu, size_t const calls, gsl::rng &r, state &state, double &result, double &abserr)
C++ version of gsl_monte_miser_integrate().
gsl_sf_result result
Typedef for gsl_sf_result.
The gsl package creates an interface to the GNU Scientific Library for C++.