ccgsl 2.7.2
C++wrappersforGnuScientificLibrary
gsl::qrng Class Reference

Quasi random sequences. More...

#include <qrng.hpp>

Collaboration diagram for gsl::qrng:
Collaboration graph

Public Types

typedef gsl_qrng_type type
 Convenient typedef. More...
 

Public Member Functions

 qrng ()
 The default constructor is only really useful for assigning to. More...
 
 qrng (type const *T, unsigned int const dimension)
 The default constructor creates a new qrng with n elements. More...
 
 qrng (gsl_qrng *v)
 Could construct from a gsl_qrng. More...
 
 qrng (qrng const &v)
 The copy constructor. More...
 
qrngoperator= (qrng const &v)
 The assignment operator. More...
 
 ~qrng ()
 The destructor only deletes the pointers if count reaches zero. More...
 
 qrng (qrng &&v)
 Move constructor. More...
 
qrngoperator= (qrng &&v)
 Move operator. More...
 
bool operator== (qrng const &v) const
 Two qrng are identically equal if their elements are identical. More...
 
bool operator!= (qrng const &v) const
 Two qrng are different if their elements are not identical. More...
 
bool operator< (qrng const &v) const
 A container needs to define an ordering for sorting. More...
 
bool operator> (qrng const &v) const
 A container needs to define an ordering for sorting. More...
 
bool operator<= (qrng const &v) const
 A container needs to define an ordering for sorting. More...
 
bool operator>= (qrng const &v) const
 A container needs to define an ordering for sorting. More...
 
bool empty () const
 Find if the qrng is empty. More...
 
void swap (qrng &v)
 Swap two qrng objects. More...
 
gsl_qrng * get () const
 Get the gsl_qrng. More...
 
bool unique () const
 Find if this is the only object sharing the gsl_qrng. More...
 
size_t use_count () const
 Find how many qrng objects share this pointer. More...
 
 operator bool () const
 Allow conversion to bool. More...
 
int memcpy (qrng const &src)
 C++ version of gsl_qrng_memcpy(). More...
 
qrng clone () const
 C++ version of gsl_qrng_clone(). More...
 
void init ()
 C++ version of gsl_qrng_init(). More...
 
char const * name () const
 C++ version of gsl_qrng_name(). More...
 
size_t size () const
 C++ version of gsl_qrng_size(). More...
 
void * state () const
 C++ version of gsl_qrng_state(). More...
 
template<typename X >
int get (X &x) const
 C++ version of gsl_qrng_get(). More...
 

Static Public Member Functions

static type const * niederreiter_2 ()
 Quasi random number sequence static type. More...
 
static type const * sobol ()
 Quasi random number sequence static type. More...
 
static type const * halton ()
 Quasi random number sequence static type. More...
 
static type const * reversehalton ()
 Quasi random number sequence static type. More...
 

Private Attributes

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

Detailed Description

Quasi random sequences.

Definition at line 31 of file qrng.hpp.

Member Typedef Documentation

◆ type

typedef gsl_qrng_type gsl::qrng::type

Convenient typedef.

Definition at line 36 of file qrng.hpp.

Constructor & Destructor Documentation

◆ qrng() [1/5]

gsl::qrng::qrng ( )
inline

The default constructor is only really useful for assigning to.

Definition at line 40 of file qrng.hpp.

References ccgsl_pointer, and count.

Referenced by clone(), and operator=().

◆ qrng() [2/5]

gsl::qrng::qrng ( type const *  T,
unsigned int const  dimension 
)
inlineexplicit

The default constructor creates a new qrng with n elements.

Parameters
Tthe type
dimensionthe dimension of the space

Definition at line 51 of file qrng.hpp.

References ccgsl_pointer, and count.

◆ qrng() [3/5]

gsl::qrng::qrng ( gsl_qrng *  v)
inlineexplicit

Could construct from a gsl_qrng.

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

Parameters
vThe qrng

Definition at line 67 of file qrng.hpp.

References ccgsl_pointer, and count.

◆ qrng() [4/5]

gsl::qrng::qrng ( qrng const &  v)
inline

The copy constructor.

This creates a new reference to the workspace.

Parameters
vThe qrng to copy.

Definition at line 78 of file qrng.hpp.

References ccgsl_pointer, and count.

◆ ~qrng()

gsl::qrng::~qrng ( )
inline

The destructor only deletes the pointers if count reaches zero.

Definition at line 97 of file qrng.hpp.

References ccgsl_pointer, and count.

◆ qrng() [5/5]

gsl::qrng::qrng ( qrng &&  v)
inline

Move constructor.

Parameters
vThe qrng to move.

Definition at line 109 of file qrng.hpp.

References count.

Member Function Documentation

◆ clone()

qrng gsl::qrng::clone ( ) const
inline

C++ version of gsl_qrng_clone().

Returns
A cloned copy of this

Definition at line 245 of file qrng.hpp.

References get(), and qrng().

◆ empty()

bool gsl::qrng::empty ( ) const
inline

Find if the qrng is empty.

Returns
true if has size zero; otherwise false

Definition at line 186 of file qrng.hpp.

References ccgsl_pointer.

◆ get() [1/2]

gsl_qrng * gsl::qrng::get ( ) const
inline

Get the gsl_qrng.

Returns
the gsl_qrng

Definition at line 212 of file qrng.hpp.

References ccgsl_pointer.

Referenced by clone(), get(), init(), memcpy(), name(), size(), and state().

◆ get() [2/2]

template<typename X >
int gsl::qrng::get ( X &  x) const
inline

C++ version of gsl_qrng_get().

This version works with gsl::vector and std::vector<double> arrays

Parameters
xAn array of size dimension to hold as return value the next point
Returns
Error code on failure

Definition at line 285 of file qrng.hpp.

References get(), and gsl::exception::GSL_EBADLEN.

◆ halton()

static type const * gsl::qrng::halton ( )
inlinestatic

Quasi random number sequence static type.

Returns
the named quasi random sequence type

Definition at line 306 of file qrng.hpp.

◆ init()

void gsl::qrng::init ( )
inline

C++ version of gsl_qrng_init().

Definition at line 250 of file qrng.hpp.

References get().

◆ memcpy()

int gsl::qrng::memcpy ( qrng const &  src)
inline

C++ version of gsl_qrng_memcpy().

Parameters
srcSource qrng
Returns
Error code on failure

Definition at line 239 of file qrng.hpp.

References get().

◆ name()

char const * gsl::qrng::name ( ) const
inline

C++ version of gsl_qrng_name().

Returns
The name of the qrng type

Definition at line 256 of file qrng.hpp.

References get().

◆ niederreiter_2()

static type const * gsl::qrng::niederreiter_2 ( )
inlinestatic

Quasi random number sequence static type.

Returns
the named quasi random sequence type

Definition at line 296 of file qrng.hpp.

◆ operator bool()

gsl::qrng::operator bool ( ) const
inlineexplicit

Allow conversion to bool.

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

Definition at line 232 of file qrng.hpp.

References ccgsl_pointer.

◆ operator!=()

bool gsl::qrng::operator!= ( qrng const &  v) const
inline

Two qrng are different if their elements are not identical.

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

Definition at line 139 of file qrng.hpp.

References operator==().

◆ operator<()

bool gsl::qrng::operator< ( qrng 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 qrng is nonnegative.

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

Definition at line 151 of file qrng.hpp.

References ccgsl_pointer.

◆ operator<=()

bool gsl::qrng::operator<= ( qrng 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 qrng is nonnegative.

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

Definition at line 171 of file qrng.hpp.

References ccgsl_pointer.

◆ operator=() [1/2]

qrng & gsl::qrng::operator= ( qrng &&  v)
inline

Move operator.

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

Definition at line 118 of file qrng.hpp.

References qrng().

◆ operator=() [2/2]

qrng & gsl::qrng::operator= ( qrng const &  v)
inline

The assignment operator.

This copies elementwise.

Parameters
vThe qrng to copy

Definition at line 85 of file qrng.hpp.

References ccgsl_pointer, and count.

◆ operator==()

bool gsl::qrng::operator== ( qrng const &  v) const
inline

Two qrng are identically equal if their elements are identical.

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

Definition at line 131 of file qrng.hpp.

References ccgsl_pointer.

Referenced by operator!=().

◆ operator>()

bool gsl::qrng::operator> ( qrng 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 qrng is nonnegative.

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

Definition at line 161 of file qrng.hpp.

References ccgsl_pointer.

◆ operator>=()

bool gsl::qrng::operator>= ( qrng 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 qrng is nonnegative.

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

Definition at line 181 of file qrng.hpp.

References ccgsl_pointer.

◆ reversehalton()

static type const * gsl::qrng::reversehalton ( )
inlinestatic

Quasi random number sequence static type.

Returns
the named quasi random sequence type

Definition at line 311 of file qrng.hpp.

◆ size()

size_t gsl::qrng::size ( ) const
inline

C++ version of gsl_qrng_size().

Returns
The size of the qrng

Definition at line 262 of file qrng.hpp.

References get().

◆ sobol()

static type const * gsl::qrng::sobol ( )
inlinestatic

Quasi random number sequence static type.

Returns
the named quasi random sequence type

Definition at line 301 of file qrng.hpp.

◆ state()

void * gsl::qrng::state ( ) const
inline

C++ version of gsl_qrng_state().

Returns
The state of the qrng

Definition at line 268 of file qrng.hpp.

References get().

◆ swap()

void gsl::qrng::swap ( qrng v)
inline

Swap two qrng objects.

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

Parameters
vThe qrng to swap with this.

Definition at line 193 of file qrng.hpp.

References ccgsl_pointer, and count.

◆ unique()

bool gsl::qrng::unique ( ) const
inline

Find if this is the only object sharing the gsl_qrng.

Returns
true or falses according as this is the only qrng object sharing the gsl_qrng.

Definition at line 218 of file qrng.hpp.

References count.

◆ use_count()

size_t gsl::qrng::use_count ( ) const
inline

Find how many qrng objects share this pointer.

Returns
the number of qrng objects that share this pointer.

Definition at line 223 of file qrng.hpp.

References count.

Member Data Documentation

◆ ccgsl_pointer

gsl_qrng* gsl::qrng::ccgsl_pointer
private

The shared pointer.

Definition at line 201 of file qrng.hpp.

Referenced by empty(), get(), operator bool(), operator<(), operator<=(), operator=(), operator==(), operator>(), operator>=(), qrng(), swap(), and ~qrng().

◆ count

size_t* gsl::qrng::count
private

The shared reference count.

Definition at line 205 of file qrng.hpp.

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


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