ccgsl 2.7.2
C++wrappersforGnuScientificLibrary
gsl::monte::vegas::state Class Reference

Workspace for Monte Carlo integration using the VEGAS algorithm. More...

#include <monte_vegas.hpp>

Collaboration diagram for gsl::monte::vegas::state:
Collaboration graph

Public Member Functions

 state ()
 The default constructor is only really useful for assigning to. More...
 
 state (size_t const dim)
 The default constructor creates a new state with n elements. More...
 
 state (gsl_monte_vegas_state *v)
 Could construct from a gsl_monte_vegas_state. More...
 
 state (state const &v)
 The copy constructor. More...
 
int init ()
 Initialise. More...
 
stateoperator= (state const &v)
 The assignment operator. More...
 
 ~state ()
 The destructor only deletes the pointers if count reaches zero. More...
 
 state (state &&v)
 Move constructor. More...
 
stateoperator= (state &&v)
 Move operator. More...
 
bool operator== (state const &v) const
 Two state are identically equal if their elements are identical. More...
 
bool operator!= (state const &v) const
 Two state are different if their elements are not identical. More...
 
bool operator< (state const &v) const
 A container needs to define an ordering for sorting. More...
 
bool operator> (state const &v) const
 A container needs to define an ordering for sorting. More...
 
bool operator<= (state const &v) const
 A container needs to define an ordering for sorting. More...
 
bool operator>= (state const &v) const
 A container needs to define an ordering for sorting. More...
 
bool empty () const
 Find if the state is empty. More...
 
void swap (state &v)
 Swap two state objects. More...
 
gsl_monte_vegas_state * get () const
 Get the gsl_monte_vegas_state. More...
 
bool unique () const
 Find if this is the only object sharing the gsl_monte_vegas_state. More...
 
size_t use_count () const
 Find how many state objects share this pointer. More...
 
 operator bool () const
 Allow conversion to bool. More...
 
int get_stage () const
 Get stage. More...
 
size_t get_iterations () const
 Get iterations. More...
 
size_t get_mode () const
 Get mode. More...
 
double get_alpha () const
 Get alpha. More...
 
int get_verbose () const
 Get verbose. More...
 
FILE * get_ostream () const
 Get ostream. More...
 
void set_stage (int const stage)
 Set stage. More...
 
void set_iterations (size_t const iterations)
 Set iterations. More...
 
void set_mode (int const mode)
 Set mode. More...
 
void set_alpha (double const alpha)
 Set alpha. More...
 
void set_verbose (int const verbose)
 Set verbose. More...
 
void set_ostream (FILE *ostream)
 Set ostream. More...
 
double chisq () const
 Get chi-squared value: this should be close to 1. More...
 
void runval (double *result, double *sigma)
 Returns the raw (unaveraged) values of the integral result and its error sigma from the most recent iteration of the algorithm. More...
 
void runval (double &result, double &sigma)
 Returns the raw (unaveraged) values of the integral result and its error sigma from the most recent iteration of the algorithm. More...
 

Private Attributes

gsl_monte_vegas_state * ccgsl_pointer
 The shared pointer. More...
 
size_t * count
 The shared reference count. More...
 

Detailed Description

Workspace for Monte Carlo integration using the VEGAS algorithm.

Definition at line 38 of file monte_vegas.hpp.

Constructor & Destructor Documentation

◆ state() [1/5]

gsl::monte::vegas::state::state ( )
inline

The default constructor is only really useful for assigning to.

Definition at line 43 of file monte_vegas.hpp.

References ccgsl_pointer, and count.

Referenced by operator=().

◆ state() [2/5]

gsl::monte::vegas::state::state ( size_t const  dim)
inlineexplicit

The default constructor creates a new state with n elements.

Parameters
dimThe number of function arguments

Definition at line 53 of file monte_vegas.hpp.

References ccgsl_pointer, and count.

◆ state() [3/5]

gsl::monte::vegas::state::state ( gsl_monte_vegas_state *  v)
inlineexplicit

Could construct from a gsl_monte_vegas_state.

This is not usually a good idea. In this case we should not use gsl_monte_vegas_free() to deallocate the memory.

Parameters
vThe state

Definition at line 69 of file monte_vegas.hpp.

References ccgsl_pointer, and count.

◆ state() [4/5]

gsl::monte::vegas::state::state ( state const &  v)
inline

The copy constructor.

This creates a new reference to the workspace.

Parameters
vThe state to copy.

Definition at line 80 of file monte_vegas.hpp.

References ccgsl_pointer, and count.

◆ ~state()

gsl::monte::vegas::state::~state ( )
inline

The destructor only deletes the pointers if count reaches zero.

Definition at line 104 of file monte_vegas.hpp.

References ccgsl_pointer, and count.

◆ state() [5/5]

gsl::monte::vegas::state::state ( state &&  v)
inline

Move constructor.

Parameters
vThe state to move.

Definition at line 116 of file monte_vegas.hpp.

References count.

Member Function Documentation

◆ chisq()

double gsl::monte::vegas::state::chisq ( ) const
inline

Get chi-squared value: this should be close to 1.

Returns
chi-squared value

Definition at line 306 of file monte_vegas.hpp.

References ccgsl_pointer.

◆ empty()

bool gsl::monte::vegas::state::empty ( ) const
inline

Find if the state is empty.

Returns
true if has size zero; otherwise false

Definition at line 193 of file monte_vegas.hpp.

References ccgsl_pointer.

◆ get()

gsl_monte_vegas_state * gsl::monte::vegas::state::get ( ) const
inline

Get the gsl_monte_vegas_state.

Returns
the gsl_monte_vegas_state

Definition at line 219 of file monte_vegas.hpp.

References ccgsl_pointer.

Referenced by gsl::monte::vegas::init(), and gsl::monte::vegas::integrate().

◆ get_alpha()

double gsl::monte::vegas::state::get_alpha ( ) const
inline

Get alpha.

Returns
alpha

Definition at line 260 of file monte_vegas.hpp.

References ccgsl_pointer.

◆ get_iterations()

size_t gsl::monte::vegas::state::get_iterations ( ) const
inline

Get iterations.

Returns
iterations

Definition at line 250 of file monte_vegas.hpp.

References ccgsl_pointer.

◆ get_mode()

size_t gsl::monte::vegas::state::get_mode ( ) const
inline

Get mode.

Returns
mode

Definition at line 255 of file monte_vegas.hpp.

References ccgsl_pointer.

◆ get_ostream()

FILE * gsl::monte::vegas::state::get_ostream ( ) const
inline

Get ostream.

Returns
ostream

Definition at line 270 of file monte_vegas.hpp.

References ccgsl_pointer.

◆ get_stage()

int gsl::monte::vegas::state::get_stage ( ) const
inline

Get stage.

Returns
stage

Definition at line 245 of file monte_vegas.hpp.

References ccgsl_pointer.

◆ get_verbose()

int gsl::monte::vegas::state::get_verbose ( ) const
inline

Get verbose.

Returns
verbose

Definition at line 265 of file monte_vegas.hpp.

References ccgsl_pointer.

◆ init()

int gsl::monte::vegas::state::init ( )
inline

Initialise.

This allows this state to be reused.

Returns
Error code on failure

Definition at line 86 of file monte_vegas.hpp.

References ccgsl_pointer.

◆ operator bool()

gsl::monte::vegas::state::operator bool ( ) const
inlineexplicit

Allow conversion to bool.

Returns
true or false according as this contains a pointer to a gsl_monte_vegas_state.

Definition at line 239 of file monte_vegas.hpp.

References ccgsl_pointer.

◆ operator!=()

bool gsl::monte::vegas::state::operator!= ( state const &  v) const
inline

Two state are different if their elements are not identical.

Parameters
vThe state to be compared with this
Returns
false or true according as this and v have identical elements or not

Definition at line 146 of file monte_vegas.hpp.

References operator==().

◆ operator<()

bool gsl::monte::vegas::state::operator< ( state const &  v) const
inline

A container needs to define an ordering for sorting.

This uses standard lexicographical ordering and so is not useful, for example, for checking, that a state is nonnegative.

Parameters
vThe state to be compared with this
Returns
false or true according as this is less than v lexicographically

Definition at line 158 of file monte_vegas.hpp.

References ccgsl_pointer.

◆ operator<=()

bool gsl::monte::vegas::state::operator<= ( state const &  v) const
inline

A container needs to define an ordering for sorting.

This uses standard lexicographical ordering and so is not useful, for example, for checking, that a state is nonnegative.

Parameters
vThe state to be compared with this
Returns
false or true according as this is less than or equal to v lexicographically

Definition at line 178 of file monte_vegas.hpp.

References ccgsl_pointer.

◆ operator=() [1/2]

state & gsl::monte::vegas::state::operator= ( state &&  v)
inline

Move operator.

Parameters
vThe state to move.
Returns
A reference to this.

Definition at line 125 of file monte_vegas.hpp.

References state().

◆ operator=() [2/2]

state & gsl::monte::vegas::state::operator= ( state const &  v)
inline

The assignment operator.

This copies elementwise.

Parameters
vThe state to copy

Definition at line 92 of file monte_vegas.hpp.

References ccgsl_pointer, and count.

◆ operator==()

bool gsl::monte::vegas::state::operator== ( state const &  v) const
inline

Two state are identically equal if their elements are identical.

Parameters
vThe state to be compared with this
Returns
true or false according as this and v have identical elements or not

Definition at line 138 of file monte_vegas.hpp.

References ccgsl_pointer.

Referenced by operator!=().

◆ operator>()

bool gsl::monte::vegas::state::operator> ( state const &  v) const
inline

A container needs to define an ordering for sorting.

This uses standard lexicographical ordering and so is not useful, for example, for checking, that a state is nonnegative.

Parameters
vThe state to be compared with this
Returns
false or true according as this is greater than v lexicographically

Definition at line 168 of file monte_vegas.hpp.

References ccgsl_pointer.

◆ operator>=()

bool gsl::monte::vegas::state::operator>= ( state const &  v) const
inline

A container needs to define an ordering for sorting.

This uses standard lexicographical ordering and so is not useful, for example, for checking, that a state is nonnegative.

Parameters
vThe state to be compared with this
Returns
false or true according as this is no less than v lexicographically

Definition at line 188 of file monte_vegas.hpp.

References ccgsl_pointer.

◆ runval() [1/2]

void gsl::monte::vegas::state::runval ( double &  result,
double &  sigma 
)
inline

Returns the raw (unaveraged) values of the integral result and its error sigma from the most recent iteration of the algorithm.

Parameters
resultThe raw value (return value)
sigmaThe error (return value)

Definition at line 321 of file monte_vegas.hpp.

References ccgsl_pointer.

◆ runval() [2/2]

void gsl::monte::vegas::state::runval ( double *  result,
double *  sigma 
)
inline

Returns the raw (unaveraged) values of the integral result and its error sigma from the most recent iteration of the algorithm.

Parameters
resultThe raw value (return value)
sigmaThe error (return value)

Definition at line 313 of file monte_vegas.hpp.

References ccgsl_pointer.

◆ set_alpha()

void gsl::monte::vegas::state::set_alpha ( double const  alpha)
inline

Set alpha.

Parameters
alphaNew value for alpha

Definition at line 290 of file monte_vegas.hpp.

References ccgsl_pointer.

◆ set_iterations()

void gsl::monte::vegas::state::set_iterations ( size_t const  iterations)
inline

Set iterations.

Parameters
iterationsNew value for iterations

Definition at line 280 of file monte_vegas.hpp.

References ccgsl_pointer.

◆ set_mode()

void gsl::monte::vegas::state::set_mode ( int const  mode)
inline

Set mode.

Parameters
modeNew value for mode

Definition at line 285 of file monte_vegas.hpp.

References ccgsl_pointer.

◆ set_ostream()

void gsl::monte::vegas::state::set_ostream ( FILE *  ostream)
inline

Set ostream.

Parameters
ostreamNew value for ostream

Definition at line 300 of file monte_vegas.hpp.

References ccgsl_pointer.

◆ set_stage()

void gsl::monte::vegas::state::set_stage ( int const  stage)
inline

Set stage.

Parameters
stageNew value for stage

Definition at line 275 of file monte_vegas.hpp.

References ccgsl_pointer.

◆ set_verbose()

void gsl::monte::vegas::state::set_verbose ( int const  verbose)
inline

Set verbose.

Parameters
verboseNew value for verbose

Definition at line 295 of file monte_vegas.hpp.

References ccgsl_pointer.

◆ swap()

void gsl::monte::vegas::state::swap ( state v)
inline

Swap two state objects.

This works even if the state have different sizes because it swaps pointers.

Parameters
vThe state to swap with this.

Definition at line 200 of file monte_vegas.hpp.

References ccgsl_pointer, and count.

◆ unique()

bool gsl::monte::vegas::state::unique ( ) const
inline

Find if this is the only object sharing the gsl_monte_vegas_state.

Returns
true or falses according as this is the only state object sharing the gsl_monte_vegas_state.

Definition at line 225 of file monte_vegas.hpp.

References count.

◆ use_count()

size_t gsl::monte::vegas::state::use_count ( ) const
inline

Find how many state objects share this pointer.

Returns
the number of state objects that share this pointer.

Definition at line 230 of file monte_vegas.hpp.

References count.

Member Data Documentation

◆ ccgsl_pointer

◆ count

size_t* gsl::monte::vegas::state::count
private

The shared reference count.

Definition at line 212 of file monte_vegas.hpp.

Referenced by operator=(), state(), swap(), unique(), use_count(), and ~state().


The documentation for this class was generated from the following file: