vSMC
vSMC: Scalable Monte Carlo
Modules | Classes | Typedefs | Functions
Random number generating

Random number generating engines and utilities. More...

Modules

 AES-NI
 Random number generating using AES-NI.
 
 Distribution
 Distribution random varaites.
 
 Intel DRNG
 Random number generating using Intel RDRAND instructions.
 
 Intel Math Kernel Library
 Random number generating using MKL RNG.
 
 Philox
 Random number generating using Random123 Philox RNG.
 
 Random walk
 Random walk MCMC kernels.
 
 Threefry
 Random number generating using Random123 Threefry RNG.
 
 U01
 Converting random integers to uniform floating points.
 
 U01 Sequence
 Generating ordered uniform random sequence.
 
 Xorshift
 Random number generating using the Xorshift algorithm.
 

Classes

class  vsmc::CounterEngine< Generator >
 Counter based RNG engine. More...
 
class  vsmc::RNGBits< RNGType >
 The value of RNGMaxBits<RNGType>::value - RNGMinBits<RNGType>::value. More...
 
class  vsmc::RNGMaxBits< RNGType >
 Find the largest N such that RNGType::max() >= (M >> (W - N)) where M = std::numeric_limits<typename RNGType::result_type>::max() W = std::numeric_limits<typename RNGType::result_type>::digits. More...
 
class  vsmc::RNGMinBits< RNGType >
 Find the smallest N such that (RNGType::min() >> N) == 0 More...
 
class  vsmc::RNGSetScalar< RNGType >
 Scalar RNG set. More...
 
class  vsmc::RNGSetTBB< RNGType >
 Thread-local storage RNG set using tbb::combinable. More...
 
class  vsmc::RNGSetVector< RNGType >
 Vector RNG set. More...
 
class  vsmc::SeedGenerator< ID, ResultType >
 Seed generator. More...
 
class  vsmc::SeedGenerator< ID, std::array< ResultType, K > >
 Seed generator counters. More...
 
class  vsmc::UniformBits< UIntType >
 Generate uniform bits of given type. More...
 

Typedefs

using vsmc::Seed = SeedGenerator< NullType, unsigned >
 The default Seed type. More...
 

Functions

template<typename T , std::size_t K>
void vsmc::increment (std::array< T, K > &ctr)
 Increment a counter by one. More...
 
template<typename T , std::size_t K, T NSkip>
void vsmc::increment (std::array< T, K > &ctr, std::integral_constant< T, NSkip >)
 Increment a counter by given steps. More...
 
template<typename T , std::size_t K>
void vsmc::increment (std::array< T, K > &ctr, T nskip)
 Increment a counter by given steps. More...
 
template<typename T , std::size_t K, std::size_t Blocks>
void vsmc::increment (std::array< T, K > &ctr, std::array< std::array< T, K >, Blocks > &ctr_block)
 Increment a counter by a given steps, and store each step in an array of counters. More...
 
template<typename T , std::size_t K>
void vsmc::increment (std::array< T, K > &ctr, std::size_t n, std::array< T, K > *ctr_block)
 Increment a counter by given steps, and store each step in an array of counters. More...
 
template<typename RNGType >
void vsmc::rng_rand (RNGType &rng, std::size_t n, typename RNGType::result_type *r)
 Generate random bits. More...
 
template<typename UIntType , typename RealType >
RealType vsmc::u01_cc (UIntType u) noexcept
 Convert uniform unsigned integers to floating points on [0, 1]. More...
 
template<typename UIntType , typename RealType >
void vsmc::u01_cc (std::size_t n, const UIntType *u, RealType *r) noexcept
 Convert uniform unsigned integers to floating points on [0, 1]. More...
 
template<typename UIntType , typename RealType >
RealType vsmc::u01_co (UIntType u) noexcept
 Convert uniform unsigned integers to floating points on [0, 1) More...
 
template<typename UIntType , typename RealType >
void vsmc::u01_co (std::size_t n, const UIntType *u, RealType *r) noexcept
 Convert uniform unsigned integers to floating points on [0, 1) More...
 
template<typename UIntType , typename RealType , typename Left , typename Right >
RealType vsmc::u01_lr (UIntType u) noexcept
 Convert uniform unsigned integers to floating points within [0, 1]. More...
 
template<typename UIntType , typename RealType , typename Left , typename Right >
void vsmc::u01_lr (std::size_t n, const UIntType *u, RealType *r) noexcept
 Convert uniform unsigned integers to floating points within [0, 1]. More...
 
template<typename UIntType , typename RealType >
RealType vsmc::u01_oc (UIntType u) noexcept
 Convert uniform unsigned integers to floating points on (0, 1]. More...
 
template<typename UIntType , typename RealType >
void vsmc::u01_oc (std::size_t n, const UIntType *u, RealType *r) noexcept
 Convert uniform unsigned integers to floating points on (0, 1]. More...
 
template<typename UIntType , typename RealType >
RealType vsmc::u01_oo (UIntType u) noexcept
 Convert uniform unsigned integers to floating points on (0, 1) More...
 
template<typename UIntType , typename RealType >
void vsmc::u01_oo (std::size_t n, const UIntType *u, RealType *r) noexcept
 Convert uniform unsigned integers to floating points on (0, 1) More...
 

Detailed Description

Random number generating engines and utilities.

Typedef Documentation

using vsmc::Seed = typedef SeedGenerator<NullType, unsigned >

The default Seed type.

Definition at line 406 of file seed.hpp.

Function Documentation

template<typename T , std::size_t K>
void vsmc::increment ( std::array< T, K > &  ctr)
inline

Increment a counter by one.

Definition at line 62 of file counter.hpp.

template<typename T , std::size_t K, T NSkip>
void vsmc::increment ( std::array< T, K > &  ctr,
std::integral_constant< T, NSkip >   
)
inline

Increment a counter by given steps.

Definition at line 70 of file counter.hpp.

template<typename T , std::size_t K>
void vsmc::increment ( std::array< T, K > &  ctr,
nskip 
)
inline

Increment a counter by given steps.

Definition at line 84 of file counter.hpp.

template<typename T , std::size_t K, std::size_t Blocks>
void vsmc::increment ( std::array< T, K > &  ctr,
std::array< std::array< T, K >, Blocks > &  ctr_block 
)
inline

Increment a counter by a given steps, and store each step in an array of counters.

Definition at line 149 of file counter.hpp.

template<typename T , std::size_t K>
void vsmc::increment ( std::array< T, K > &  ctr,
std::size_t  n,
std::array< T, K > *  ctr_block 
)
inline

Increment a counter by given steps, and store each step in an array of counters.

Definition at line 256 of file counter.hpp.

template<typename RNGType >
void vsmc::rng_rand ( RNGType &  rng,
std::size_t  n,
typename RNGType::result_type *  r 
)

Generate random bits.

Definition at line 524 of file common.hpp.

template<typename UIntType , typename RealType >
RealType vsmc::u01_cc ( UIntType  u)
noexcept

Convert uniform unsigned integers to floating points on [0, 1].

Definition at line 242 of file u01.hpp.

template<typename UIntType , typename RealType >
void vsmc::u01_cc ( std::size_t  n,
const UIntType *  u,
RealType *  r 
)
noexcept

Convert uniform unsigned integers to floating points on [0, 1].

Definition at line 274 of file u01.hpp.

template<typename UIntType , typename RealType >
RealType vsmc::u01_co ( UIntType  u)
noexcept

Convert uniform unsigned integers to floating points on [0, 1)

Definition at line 250 of file u01.hpp.

template<typename UIntType , typename RealType >
void vsmc::u01_co ( std::size_t  n,
const UIntType *  u,
RealType *  r 
)
noexcept

Convert uniform unsigned integers to floating points on [0, 1)

Definition at line 282 of file u01.hpp.

template<typename UIntType , typename RealType , typename Left , typename Right >
RealType vsmc::u01_lr ( UIntType  u)
noexcept

Convert uniform unsigned integers to floating points within [0, 1].

Let \(W\) be the number of digits of unsigned integer type UIntType. Let \(M\) be the number of significant digits of floating point type RealType. Assuming the input is a uniform random number on the set \(\{0,1,\dots,2^W - 1\), the output is uniform over the interval \([0,1]\) or one of its (half-)open interval variant. The exact output depend on the template parameter Left and Right.

Definition at line 212 of file u01.hpp.

template<typename UIntType , typename RealType , typename Left , typename Right >
void vsmc::u01_lr ( std::size_t  n,
const UIntType *  u,
RealType *  r 
)
noexcept

Convert uniform unsigned integers to floating points within [0, 1].

Definition at line 227 of file u01.hpp.

template<typename UIntType , typename RealType >
RealType vsmc::u01_oc ( UIntType  u)
noexcept

Convert uniform unsigned integers to floating points on (0, 1].

Definition at line 258 of file u01.hpp.

template<typename UIntType , typename RealType >
void vsmc::u01_oc ( std::size_t  n,
const UIntType *  u,
RealType *  r 
)
noexcept

Convert uniform unsigned integers to floating points on (0, 1].

Definition at line 290 of file u01.hpp.

template<typename UIntType , typename RealType >
RealType vsmc::u01_oo ( UIntType  u)
noexcept

Convert uniform unsigned integers to floating points on (0, 1)

Definition at line 266 of file u01.hpp.

template<typename UIntType , typename RealType >
void vsmc::u01_oo ( std::size_t  n,
const UIntType *  u,
RealType *  r 
)
noexcept

Convert uniform unsigned integers to floating points on (0, 1)

Definition at line 298 of file u01.hpp.