tk::MKLRNG class

MKL-based random number generator used polymorphically with tk::RNG.

Constructors, destructors, conversion operators

MKLRNG(int n = 1, int brng = VSL_BRNG_MCG59, unsigned int seed = 0, int uniform_method = VSL_RNG_METHOD_UNIFORM_STD, int gaussian_method = VSL_RNG_METHOD_GAUSSIAN_BOXMULLER, int gaussianmv_method = VSL_RNG_METHOD_GAUSSIANMV_BOXMULLER2, int beta_method = VSL_RNG_METHOD_BETA_CJA, int gamma_method = VSL_RNG_METHOD_GAMMA_GNORM) explicit
~MKLRNG() noexcept
Destructor.
MKLRNG(const MKLRNG& x)
Copy constructor: in terms of copy assignment.
MKLRNG(MKLRNG&& x)
Move constructor: in terms of move assignment.

Public functions

void uniform(int tid, ncomp_t num, double* r) const
void gaussian(int tid, ncomp_t num, double* r) const
void gaussianmv(int tid, ncomp_t num, ncomp_t d, const double*const mean, const double*const cov, double* r) const
Multi-variate Gaussian RNG: Generate multi-variate Gaussian random numbers.
void beta(int tid, ncomp_t num, double p, double q, double a, double b, double* r) const
void gamma(int tid, ncomp_t num, double a, double b, double* r) const
auto operator=(const MKLRNG& x) -> MKLRNG&
Copy assignment.
auto operator=(MKLRNG&& x) -> MKLRNG&
Move assignment.
auto nthreads() const -> std::size_t noexcept
Accessor to the number of threads we operate on.

Function documentation

tk::MKLRNG::MKLRNG(int n = 1, int brng = VSL_BRNG_MCG59, unsigned int seed = 0, int uniform_method = VSL_RNG_METHOD_UNIFORM_STD, int gaussian_method = VSL_RNG_METHOD_GAUSSIAN_BOXMULLER, int gaussianmv_method = VSL_RNG_METHOD_GAUSSIANMV_BOXMULLER2, int beta_method = VSL_RNG_METHOD_BETA_CJA, int gamma_method = VSL_RNG_METHOD_GAMMA_GNORM) explicit

Parameters
n in Initialize RNG using this many independent streams
brng in Index of the basic generator to initialize the stream
seed in RNG seed
uniform_method in MKL ID of the method to use for uniform RNGs
gaussian_method in MKL ID of the method to use for Gaussian RNGs
gaussianmv_method in MKL ID of the method to use for multi-variate Gaussian RNGs
beta_method in MKL ID of the method to use for beta RNGs
gamma_method in MKL ID of the method to use for gamma RNGs

Constructor

void tk::MKLRNG::uniform(int tid, ncomp_t num, double* r) const

Parameters
tid in Thread (or more precisely stream) ID
num in Number of RNGs to generate
r in/out Pointer to memory to write the random numbers to

Uniform RNG: Generate uniform random numbers

void tk::MKLRNG::gaussian(int tid, ncomp_t num, double* r) const

Parameters
tid in Thread (or more precisely stream) ID
num in Number of RNGs to generate
r in/out Pointer to memory to write the random numbers to

Gaussian RNG: Generate Gaussian random numbers

void tk::MKLRNG::gaussianmv(int tid, ncomp_t num, ncomp_t d, const double*const mean, const double*const cov, double* r) const

Multi-variate Gaussian RNG: Generate multi-variate Gaussian random numbers.

Parameters
tid in Thread (or more precisely stream) ID
num in Number of RNGs to generate
d in Dimension d ( d ≥ 1) of output random vectors
mean in Mean vector of dimension d
cov in Lower triangle of covariance matrix, stored as a vector of length d(d+1)/2
r in/out Pointer to memory to write the random numbers to

void tk::MKLRNG::beta(int tid, ncomp_t num, double p, double q, double a, double b, double* r) const

Parameters
tid in Thread (or more precisely stream) ID
num in Number of RNGs to generate
p in First beta shape parameter
q in Second beta shape parameter
a in Beta displacement parameter
b in Beta scale factor
r in/out Pointer to memory to write the random numbers to

Beta RNG: Generate beta random numbers

void tk::MKLRNG::gamma(int tid, ncomp_t num, double a, double b, double* r) const

Parameters
tid in Thread (or more precisely stream) ID
num in Number of RNGs to generate
a in Gamma shape parameter
b in Gamma scale factor
r in/out Pointer to memory to write the random numbers to

Gamma RNG: Generate gamma random numbers