vSMC  v3.0.0
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.
 
 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.
 

Classes

class  vsmc::CounterEngine< ResultType, Generator >
 Counter based RNG engine. 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::RNGTraits< RNGType >
 Traits of RNG engines. More...
 
class  vsmc::SeedGenerator< ID, ResultType >
 Seed generator. More...
 

Typedefs

using vsmc::RNG = ::vsmc::ARS
 The default 32-bits RNG. More...
 
using vsmc::RNG_64 = ARS_64
 The default 64-bits RNG. More...
 
using vsmc::RNGMini = ::vsmc::Philox2x32
 The 32-bits RNG with smallest state. More...
 
using vsmc::RNGMini_64 = ::vsmc::Philox2x32_64
 The 64-bits RNG with smallest state. More...
 
template<typename RNGType = typename std::conditional< std::is_same< ::vsmc::RNGSetTBB <RNG>, RNGSetVector<RNG>>::value, RNGMini, RNG>::type>
using vsmc::RNGSet = ::vsmc::RNGSetTBB< RNGType >
 Default RNG set. More...
 
using vsmc::Seed = SeedGenerator< NullType >
 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 RNGType >
void vsmc::rand (RNGType &rng, std::size_t n, typename RNGType::result_type *r)
 Generate random integers. More...
 
template<typename RNGType , typename DistributionType >
void vsmc::rand (RNGType &rng, const DistributionType &distribution, std::size_t n, typename DistributionType::result_type *r)
 Generate random distribution numbers. More...
 
template<typename UIntType , typename RealType , typename Lower , typename Upper >
RealType vsmc::u01 (UIntType u) noexcept
 Convert uniform unsigned integers to floating points within [0, 1]. More...
 
template<typename UIntType , typename RealType , typename Lower , typename Upper >
void vsmc::u01 (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_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 >
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::RNG = typedef ::vsmc::ARS

The default 32-bits RNG.

Definition at line 87 of file engine.hpp.

using vsmc::RNG_64 = typedef ARS_64

The default 64-bits RNG.

Definition at line 91 of file engine.hpp.

using vsmc::RNGMini = typedef ::vsmc::Philox2x32

The 32-bits RNG with smallest state.

Definition at line 95 of file engine.hpp.

The 64-bits RNG with smallest state.

Definition at line 99 of file engine.hpp.

template<typename RNGType = typename std::conditional< std::is_same< ::vsmc::RNGSetTBB <RNG>, RNGSetVector<RNG>>::value, RNGMini, RNG>::type>
using vsmc::RNGSet = typedef ::vsmc::RNGSetTBB <RNGType>

Default RNG set.

Definition at line 157 of file rng_set.hpp.

using vsmc::Seed = typedef SeedGenerator<NullType>

The default Seed type.

Definition at line 201 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 RNGType >
void vsmc::rand ( RNGType &  rng,
std::size_t  n,
typename RNGType::result_type *  r 
)
inline

Generate random integers.

Definition at line 1032 of file rng/internal/common.hpp.

template<typename RNGType , typename DistributionType >
void vsmc::rand ( RNGType &  rng,
const DistributionType &  distribution,
std::size_t  n,
typename DistributionType::result_type *  r 
)
inline

Generate random distribution numbers.

Definition at line 1041 of file rng/internal/common.hpp.

template<typename UIntType , typename RealType , typename Lower , typename Upper >
RealType vsmc::u01 ( UIntType  u)
inlinenoexcept

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 Lower and Upper.

Definition at line 213 of file u01.hpp.

template<typename UIntType , typename RealType , typename Lower , typename Upper >
void vsmc::u01 ( std::size_t  n,
const UIntType *  u,
RealType *  r 
)
inlinenoexcept

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

Definition at line 228 of file u01.hpp.

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

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

Definition at line 243 of file u01.hpp.

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

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

Definition at line 275 of file u01.hpp.

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

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

Definition at line 251 of file u01.hpp.

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

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

Definition at line 283 of file u01.hpp.

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

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

Definition at line 259 of file u01.hpp.

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

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

Definition at line 291 of file u01.hpp.

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

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

Definition at line 267 of file u01.hpp.

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

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

Definition at line 299 of file u01.hpp.