vSMC  v3.0.0
Scalable Monte Carlo
Classes | Namespaces | Macros | Typedefs | Functions
u01_distribution.hpp File Reference
#include <vsmc/rng/internal/common.hpp>
#include <vsmc/rng/u01.hpp>
#include <vsmc/rng/uniform_bits_distribution.hpp>

Go to the source code of this file.

Classes

class  vsmc::U01CCDistribution< RealType >
 Standard uniform distribution on [0, 1]. More...
 
class  vsmc::U01CCDistribution< RealType >::param_type
 
class  vsmc::U01CODistribution< RealType >
 Standard uniform distribution on [0, 1) More...
 
class  vsmc::U01CODistribution< RealType >::param_type
 
class  vsmc::U01Distribution< RealType >
 
class  vsmc::U01OCDistribution< RealType >
 Standard uniform distribution on (0, 1]. More...
 
class  vsmc::U01OCDistribution< RealType >::param_type
 
class  vsmc::U01OODistribution< RealType >
 Standard uniform distribution on (0, 1) More...
 
class  vsmc::U01OODistribution< RealType >::param_type
 

Namespaces

 vsmc
 
 vsmc::internal
 

Macros

#define VSMC_DEFINE_U01_DISTRIBUTION(Name, name)
 
#define VSMC_DEFINE_U01_DISTRIBUTION_IMPL(name)
 
#define VSMC_RNG_U01_USE_64BITS_DOUBLE   0
 Use 64-bits intermediate random integers for double precison output. More...
 
#define VSMC_RNG_U01_USE_FIXED_POINT   1
 Default U01 distribution using fixed point conversion. More...
 

Typedefs

template<typename RNGType , typename RealType >
using vsmc::internal::U01UIntType = typename std::conditional<(RNGTraits< RNGType >::bits >=64||std::is_same< RealType, long double >::value), std::uint64_t, std::uint32_t >::type
 

Functions

template<typename RealType , typename RNGType >
void vsmc::rand (RNGType &rng, U01CCDistribution< RealType > &dist, std::size_t N, RealType *r)
 
template<typename RealType , typename RNGType >
void vsmc::rand (RNGType &rng, U01CODistribution< RealType > &dist, std::size_t N, RealType *r)
 
template<typename RealType , typename RNGType >
void vsmc::rand (RNGType &rng, U01OCDistribution< RealType > &dist, std::size_t N, RealType *r)
 
template<typename RealType , typename RNGType >
void vsmc::rand (RNGType &rng, U01OODistribution< RealType > &dist, std::size_t N, RealType *r)
 
template<typename RealType , typename RNGType >
void vsmc::rand (RNGType &, U01Distribution< RealType > &, std::size_t, RealType *)
 
template<typename RealType , typename RNGType >
void vsmc::u01_cc_distribution (RNGType &rng, std::size_t n, RealType *r)
 Generate standard uniform random variates on [0, 1]. More...
 
template<typename RealType , typename RNGType >
void vsmc::u01_cc_distribution (RNGType &rng, std::size_t N, RealType *r, const typename U01CCDistribution< RealType >::param_type &)
 
template<std::size_t K, typename RealType , typename RNGType >
void vsmc::internal::u01_cc_distribution_impl (RNGType &rng, std::size_t n, RealType *r)
 
template<typename RealType , typename RNGType >
void vsmc::u01_co_distribution (RNGType &rng, std::size_t n, RealType *r)
 Generate standard uniform random variates on [0, 1) More...
 
template<typename RealType , typename RNGType >
void vsmc::u01_co_distribution (RNGType &rng, std::size_t N, RealType *r, const typename U01CODistribution< RealType >::param_type &)
 
template<std::size_t K, typename RealType , typename RNGType >
void vsmc::internal::u01_co_distribution_impl (RNGType &rng, std::size_t n, RealType *r)
 
template<typename RealType , typename RNGType >
void vsmc::u01_distribution (RNGType &rng, std::size_t N, RealType *r, const typename U01Distribution< RealType >::param_type &)
 
template<typename RealType , typename RNGType >
void vsmc::u01_distribution (RNGType &rng, std::size_t n, RealType *r)
 Generate standard uniform random variates. More...
 
template<std::size_t K, typename RealType , typename RNGType >
void vsmc::internal::u01_distribution_impl (RNGType &rng, std::size_t n, RealType *r)
 
template<typename RealType , typename RNGType >
void vsmc::u01_oc_distribution (RNGType &rng, std::size_t n, RealType *r)
 Generate standard uniform random variates on (0, 1]. More...
 
template<typename RealType , typename RNGType >
void vsmc::u01_oc_distribution (RNGType &rng, std::size_t N, RealType *r, const typename U01OCDistribution< RealType >::param_type &)
 
template<std::size_t K, typename RealType , typename RNGType >
void vsmc::internal::u01_oc_distribution_impl (RNGType &rng, std::size_t n, RealType *r)
 
template<typename RealType , typename RNGType >
void vsmc::u01_oo_distribution (RNGType &rng, std::size_t n, RealType *r)
 Generate standard uniform random variates on (0, 1) More...
 
template<typename RealType , typename RNGType >
void vsmc::u01_oo_distribution (RNGType &rng, std::size_t N, RealType *r, const typename U01OODistribution< RealType >::param_type &)
 
template<std::size_t K, typename RealType , typename RNGType >
void vsmc::internal::u01_oo_distribution_impl (RNGType &rng, std::size_t n, RealType *r)
 

Macro Definition Documentation

#define VSMC_DEFINE_U01_DISTRIBUTION (   Name,
  name 
)
Value:
template <typename RealType> \
class Name##Distribution \
{ \
VSMC_DEFINE_RNG_DISTRIBUTION_0( \
Name, name, RealType, floating_point, FLOATING_POINT) \
VSMC_DEFINE_RNG_DISTRIBUTION_MEMBER_0 \
\
public: \
result_type min() const { return 0; } \
\
result_type max() const { return 1; } \
\
void reset() {} \
\
private: \
template <typename RNGType> \
result_type generate(RNGType &rng, const param_type &) \
{ \
using UIntType = \
typename internal::U01UIntType<RNGType, RealType>; \
\
UniformBitsDistribution<UIntType> ubits; \
\
return name<UIntType, result_type>(ubits(rng)); \
} \
};

Definition at line 51 of file u01_distribution.hpp.

#define VSMC_DEFINE_U01_DISTRIBUTION_IMPL (   name)
Value:
template <std::size_t K, typename RealType, typename RNGType> \
inline void name##_distribution_impl( \
RNGType &rng, std::size_t n, RealType *r) \
{ \
using UIntType = U01UIntType<RNGType, RealType>; \
\
Array<UIntType, K> s; \
uniform_bits_distribution(rng, n, s.data()); \
name<UIntType, RealType>(n, s.data(), r); \
}

Definition at line 79 of file u01_distribution.hpp.