24#include<gsl/gsl_qrng.h>
36 typedef gsl_qrng_type
type;
51 explicit qrng(
type const* T,
unsigned int const dimension ){
54 try {
count =
new size_t; }
catch( std::bad_alloc& e ){
67 explicit qrng( gsl_qrng* v ){
104#ifdef __GXX_EXPERIMENTAL_CXX0X__
110 std::swap(
count, v.count );
111 v.ccgsl_pointer =
nullptr;
119 qrng( std::move( v ) ).swap( *
this );
229#ifdef __GXX_EXPERIMENTAL_CXX0X__
256 char const*
name()
const {
return gsl_qrng_name(
get() ); }
262 size_t size()
const {
return gsl_qrng_size(
get() ); }
268 void*
state()
const {
return gsl_qrng_state(
get() ); }
276 int get(
double x[] )
const {
return gsl_qrng_get(
get(), x ); }
286 if(x.size() <
get()->dimension)
287 gsl_error(
"x must have size at least as big as dimension of qrng.",
289 return gsl_qrng_get(
get(), x.data() );
@ GSL_EBADLEN
matrix, vector lengths are not conformant
size_t * count
The shared reference count.
qrng(type const *T, unsigned int const dimension)
The default constructor creates a new qrng with n elements.
bool operator>=(qrng const &v) const
A container needs to define an ordering for sorting.
static type const * halton()
Quasi random number sequence static type.
qrng()
The default constructor is only really useful for assigning to.
static type const * niederreiter_2()
Quasi random number sequence static type.
void * state() const
C++ version of gsl_qrng_state().
bool operator<(qrng const &v) const
A container needs to define an ordering for sorting.
int memcpy(qrng const &src)
C++ version of gsl_qrng_memcpy().
static type const * reversehalton()
Quasi random number sequence static type.
bool operator>(qrng const &v) const
A container needs to define an ordering for sorting.
gsl_qrng_type type
Convenient typedef.
~qrng()
The destructor only deletes the pointers if count reaches zero.
gsl_qrng * get() const
Get the gsl_qrng.
qrng(gsl_qrng *v)
Could construct from a gsl_qrng.
bool empty() const
Find if the qrng is empty.
qrng(qrng const &v)
The copy constructor.
qrng & operator=(qrng &&v)
Move operator.
static type const * sobol()
Quasi random number sequence static type.
char const * name() const
C++ version of gsl_qrng_name().
gsl_qrng * ccgsl_pointer
The shared pointer.
bool operator<=(qrng const &v) const
A container needs to define an ordering for sorting.
qrng clone() const
C++ version of gsl_qrng_clone().
void swap(qrng &v)
Swap two qrng objects.
qrng(qrng &&v)
Move constructor.
int get(X &x) const
C++ version of gsl_qrng_get().
size_t use_count() const
Find how many qrng objects share this pointer.
bool unique() const
Find if this is the only object sharing the gsl_qrng.
void init()
C++ version of gsl_qrng_init().
bool operator==(qrng const &v) const
Two qrng are identically equal if their elements are identical.
qrng & operator=(qrng const &v)
The assignment operator.
bool operator!=(qrng const &v) const
Two qrng are different if their elements are not identical.
size_t size() const
C++ version of gsl_qrng_size().
The gsl package creates an interface to the GNU Scientific Library for C++.