MCKL
Monte Carlo Kernel Library
Functions

Converting random integers to uniform floating points. More...

Functions

template<typename UIntType , typename RealType , typename Lower , typename Upper >
RealType mckl::u01 (UIntType u)
 Convert uniform unsigned integers to floating points within [0, 1]. More...
 
template<typename UIntType , typename RealType , typename Lower , typename Upper >
void mckl::u01 (std::size_t n, const UIntType *u, RealType *r)
 Convert uniform unsigned integers to floating points within [0, 1]. More...
 
template<typename UIntType , typename RealType , std::size_t M>
RealType mckl::u01_canonical (const UIntType *u)
 Convert uniform multiple unsigned integers to one floating points within [0, 1]. More...
 
template<typename UIntType , typename RealType , std::size_t M>
void mckl::u01_canonical (std::size_t n, const UIntType *u, RealType *r)
 Convert uniform multiple unsigned integers to one floating points within [0, 1]. More...
 
template<typename UIntType , typename RealType >
RealType mckl::u01_cc (UIntType u)
 Convert uniform unsigned integers to floating points on [0, 1]. More...
 
template<typename UIntType , typename RealType >
void mckl::u01_cc (std::size_t n, const UIntType *u, RealType *r)
 Convert uniform unsigned integers to floating points on [0, 1]. More...
 
template<typename UIntType , typename RealType >
RealType mckl::u01_co (UIntType u)
 Convert uniform unsigned integers to floating points on [0, 1) More...
 
template<typename UIntType , typename RealType >
void mckl::u01_co (std::size_t n, const UIntType *u, RealType *r)
 Convert uniform unsigned integers to floating points on [0, 1) More...
 
template<typename UIntType , typename RealType >
RealType mckl::u01_oc (UIntType u)
 Convert uniform unsigned integers to floating points on (0, 1]. More...
 
template<typename UIntType , typename RealType >
void mckl::u01_oc (std::size_t n, const UIntType *u, RealType *r)
 Convert uniform unsigned integers to floating points on (0, 1]. More...
 
template<typename UIntType , typename RealType >
RealType mckl::u01_oo (UIntType u)
 Convert uniform unsigned integers to floating points on (0, 1) More...
 
template<typename UIntType , typename RealType >
void mckl::u01_oo (std::size_t n, const UIntType *u, RealType *r)
 Convert uniform unsigned integers to floating points on (0, 1) More...
 

Detailed Description

Converting random integers to uniform floating points.

Function Documentation

◆ u01() [1/2]

template<typename UIntType , typename RealType , typename Lower , typename Upper >
RealType mckl::u01 ( UIntType  u)
inline

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

Let \(W\) be the number of digits of unsigned integer type UIntType. 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 88 of file u01.hpp.

◆ u01() [2/2]

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

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

Definition at line 104 of file u01.hpp.

◆ u01_canonical() [1/2]

template<typename UIntType , typename RealType , std::size_t M>
RealType mckl::u01_canonical ( const UIntType *  u)
inline

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

Definition at line 185 of file u01.hpp.

◆ u01_canonical() [2/2]

template<typename UIntType , typename RealType , std::size_t M>
void mckl::u01_canonical ( std::size_t  n,
const UIntType *  u,
RealType *  r 
)
inline

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

Definition at line 202 of file u01.hpp.

◆ u01_cc() [1/2]

template<typename UIntType , typename RealType >
RealType mckl::u01_cc ( UIntType  u)
inline

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

Definition at line 120 of file u01.hpp.

◆ u01_cc() [2/2]

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

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

Definition at line 152 of file u01.hpp.

◆ u01_co() [1/2]

template<typename UIntType , typename RealType >
RealType mckl::u01_co ( UIntType  u)
inline

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

Definition at line 128 of file u01.hpp.

◆ u01_co() [2/2]

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

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

Definition at line 160 of file u01.hpp.

◆ u01_oc() [1/2]

template<typename UIntType , typename RealType >
RealType mckl::u01_oc ( UIntType  u)
inline

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

Definition at line 136 of file u01.hpp.

◆ u01_oc() [2/2]

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

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

Definition at line 168 of file u01.hpp.

◆ u01_oo() [1/2]

template<typename UIntType , typename RealType >
RealType mckl::u01_oo ( UIntType  u)
inline

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

Definition at line 144 of file u01.hpp.

◆ u01_oo() [2/2]

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

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

Definition at line 176 of file u01.hpp.