32 #ifndef VSMC_RNG_LEVY_DISTRIBUTION_HPP 33 #define VSMC_RNG_LEVY_DISTRIBUTION_HPP 44 template <
typename RealType>
54 template <
typename RealType>
66 return std::numeric_limits<result_type>::max
VSMC_MNE();
74 template <
typename RNGType>
79 return param.
a() + param.
b() / (r * r);
86 template <std::
size_t K,
typename RealType,
typename RNGType>
88 RNGType &rng, std::size_t n, RealType *r, RealType a, RealType b)
91 rng, n, r, static_cast<RealType>(0), static_cast<RealType>(1));
101 template <
typename RealType,
typename RNGType>
103 RNGType &rng, std::size_t n, RealType *r, RealType a, RealType b)
105 const std::size_t k = 1000;
106 const std::size_t m = n / k;
107 const std::size_t l = n % k;
108 for (std::size_t i = 0; i != m; ++i)
109 internal::levy_distribution_impl<k>(rng, k, r + i * k, a, b);
110 internal::levy_distribution_impl<k>(rng, l, r + m * k, a, b);
113 template <
typename RealType,
typename RNGType>
122 #endif // VSMC_RNG_LEVY_DISTRIBUTION_HPP
void levy_distribution_impl(RNGType &rng, std::size_t n, RealType *r, RealType a, RealType b)
void rng_rand(RNGType &rng, BernoulliDistribution< IntType > &dist, std::size_t n, IntType *r)
#define VSMC_DEFINE_RNG_DISTRIBUTION_OPERATORS
void normal_distribution(RNGType &, std::size_t, RealType *, RealType, RealType)
Generating normal random variates.
#define VSMC_DEFINE_RNG_DISTRIBUTION_2(Name, name, T, T1, p1, v1, T2, p2, v2)
void inv(std::size_t n, const float *a, float *y)
void fma(std::size_t n, const T *a, const T *b, const T *c, T *y)
For , compute .
bool levy_distribution_check_param(RealType, RealType b)
void sqr(std::size_t n, const float *a, float *y)
void levy_distribution(RNGType &, std::size_t, RealType *, RealType, RealType)
Generating levy random variates.