32 #ifndef VSMC_RNG_LEVY_DISTRIBUTION_HPP 33 #define VSMC_RNG_LEVY_DISTRIBUTION_HPP 44 template <
typename RealType>
54 template <
typename RealType>
69 template <
typename RNGType>
74 return param.
a() + param.
b() / (r * r);
81 template <std::
size_t K,
typename RealType,
typename RNGType>
83 RNGType &rng, std::size_t n, RealType *r, RealType a, RealType b)
86 rng, n, r, static_cast<RealType>(0), static_cast<RealType>(1));
96 template <
typename RealType,
typename RNGType>
98 RNGType &rng, std::size_t n, RealType *r, RealType a, RealType b)
100 static_assert(std::is_floating_point<RealType>::value,
101 "**levy_distribution** USED WITH RealType OTHER THAN FLOATING POINT " 104 const std::size_t k = 1024;
105 const std::size_t m = n / k;
106 const std::size_t l = n % k;
107 for (std::size_t i = 0; i != m; ++i, r += k)
108 internal::levy_distribution_impl<k>(rng, k, r, a, b);
109 internal::levy_distribution_impl<k>(rng, l, r, a, b);
116 #endif // VSMC_RNG_LEVY_DISTRIBUTION_HPP
#define VSMC_DEFINE_RNG_DISTRIBUTION_2(Name, name, p1, v1, p2, v2)
void levy_distribution_impl(RNGType &rng, std::size_t n, RealType *r, RealType a, RealType b)
void normal_distribution(RNGType &, std::size_t, RealType *, RealType, RealType)
Generating Normal random variates.
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 .
#define VSMC_DEFINE_RNG_DISTRIBUTION_RAND_2(Name, name, p1, p2)
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.