13 #ifndef GSL_QRNG_WRAP_H_KJBLIB_UARIZONAVISION
14 #define GSL_QRNG_WRAP_H_KJBLIB_UARIZONAVISION
21 #include "gsl/gsl_qrng.h"
28 #warning "Compiling GNU GSL wrapper without GNU GSL; it will not run properly"
62 template<
unsigned KIND >
65 unsigned m_dimensions;
85 : m_dimensions( dimensions ),
86 m_qrng( m_dimensions ? gsl_qrng_alloc( qtype, m_dimensions ) : 00 )
88 ETX_2( 0 == m_dimensions,
"Gsl_Qrng primitive ctor: zero dimensions" );
89 ETX_2( 00 == m_qrng,
"Gsl_Qrng primitive ctor: allocation failed" );
90 ETX_2( dimensions > maxdim,
"Gsl_Qrng ctor: too many dimensions" );
91 gsl_qrng_init( m_qrng );
102 gsl_qrng_free( m_qrng );
112 void read(
double* destination )
115 ETX_2( 00 == destination,
"Call to Gsl_Qrng::read( NULL )" );
116 GSL_ETX( gsl_qrng_get( m_qrng, destination ) );
124 read( & sample[ 0 ] );
125 return Vector( sample.begin(), sample.end() );
131 return gsl_qrng_name( m_qrng );
144 m_qrng( gsl_qrng_clone( that.m_qrng ) )
146 ETX_2( 0 == m_dimensions,
"Gsl_Qrng copy ctor: zero dimensions" );
147 ETX_2( 00 == m_qrng,
"Gsl_Qrng copy ctor: allocation failed" );
159 swap( m_dimensions, that.m_dimensions );
160 swap( m_qrng, that.m_qrng );
170 GSL_ETX( gsl_qrng_memcpy( m_qrng, that.m_qrng ) );
255 template<
unsigned KIND >
Vector read()
Best way to read a single random sample of known dimensionality.
Definition: gsl_qrng.h:121
gsl_qrng_type * gsl_qrng_sobol
Definition: gsl_qrng.h:31
Quasi-random generator using the algorithm of Bratley et al.
Definition: gsl_qrng.h:188
Definition: gsl_qrng.h:40
Gsl_Qrng_Niederreiter(unsigned dims)
ctor for Niederreiter QRNG of given number of dimensions dims
Definition: gsl_qrng.h:191
Gsl_Qrng_Halton(unsigned dimensions)
ctor for Halton QRNG of given number of dimensions
Definition: gsl_qrng.h:225
void gsl_qrng
Definition: gsl_qrng.h:30
This class implements vectors, in the linear-algebra sense, with real-valued elements.
Definition: m_vector.h:87
GSL utility stuff to help those using the C++ wrapper on GSL code.
Vector sample(const MV_gaussian_distribution &dist)
Sample from a multivariate normal distribution.
Definition: prob_sample.cpp:42
Quasi-random generator using the algorithm of Halton.
Definition: gsl_qrng.h:222
Gsl_Qrng_basic< KIND > & operator=(const Gsl_Qrng_basic< KIND > &that)
assignment operator
Definition: gsl_qrng.h:165
size_t dims(const Scene &scene, bool respect_changed=true, bool infer_head=true)
Computes the number of variables in this scene.
Definition: pt_scene.cpp:106
gsl_qrng_type * gsl_qrng_reversehalton
Definition: gsl_qrng.h:31
gsl_qrng_type * gsl_qrng_halton
Definition: gsl_qrng.h:31
const char * name() const
Definition: gsl_qrng.h:128
Definition: gsl_qrng.h:39
Gsl_Qrng_basic(const Gsl_Qrng_basic< KIND > &that)
copy ctor
Definition: gsl_qrng.h:141
Gsl_Qrng_Sobol(unsigned dimensions)
ctor for Sobol QRNG of given number of dimensions
Definition: gsl_qrng.h:208
Quasi-random generator using the algorithm of Antonov and Saleev.
Definition: gsl_qrng.h:205
#define GSL_ETX(gsl_expr)
Definition: gsl_util.h:37
Gsl_Qrng_basic(unsigned dimensions, const gsl_qrng_type *qtype, unsigned maxdim)
ctor builds the quasi-random generator
Definition: gsl_qrng.h:79
void swap(Gsl_Qrng_basic< KIND > &that)
swap two generators
Definition: gsl_qrng.h:154
#define KJB_THROW_2(ex, msg)
Definition: l_exception.h:48
void swap(kjb::Gsl_Multimin_fdf &m1, kjb::Gsl_Multimin_fdf &m2)
Swap two wrapped multimin objects.
Definition: gsl_multimin.h:693
Gsl_Qrng_Rvs_Halton(unsigned d)
ctor for Reverse Halton QRNG of dimensionality d
Definition: gsl_qrng.h:244
~Gsl_Qrng_basic()
Definition: gsl_qrng.h:99
#define ETX_2(a, msg)
Definition: l_exception.h:78
unsigned get_dimensions() const
Definition: gsl_qrng.h:135
Wrapper for one of GSL's quasi-random generators.
Definition: gsl_qrng.h:63
gsl_qrng_type * gsl_qrng_niederreiter_2
Definition: gsl_qrng.h:31
Support for error handling exception classes in libKJB.
Object thrown when a program lacks required resources or libraries.
Definition: l_exception.h:539
void gsl_qrng_type
Definition: gsl_qrng.h:29
Definition: gsl_qrng.h:41
Quasi-random generator using the algorithm of Vandewoestyne et al.
Definition: gsl_qrng.h:241
Definition for the Vector class, a thin wrapper on the KJB Vector struct and its related functionalit...
void read(double *destination)
The old-fashioned way to read a quasi-random sample.
Definition: gsl_qrng.h:112
Definition: gsl_qrng.h:42