32 #ifndef VSMC_RNG_PARETO_DISTRIBUTION_HPP 33 #define VSMC_RNG_PARETO_DISTRIBUTION_HPP 44 template <
typename RealType>
47 return a > 0 && b > 0;
54 template <
typename RealType>
67 template <
typename RNGType>
79 template <std::
size_t K,
typename RealType,
typename RNGType>
81 RNGType &rng, std::size_t n, RealType *r, RealType a, RealType b)
92 template <
typename RealType,
typename RNGType>
94 RNGType &rng, std::size_t n, RealType *r, RealType a, RealType b)
96 static_assert(std::is_floating_point<RealType>::value,
97 "**pareto_distribution** USED WITH RealType OTHER THAN FLOATING POINT " 100 const std::size_t k = 1024;
101 const std::size_t m = n / k;
102 const std::size_t l = n % k;
103 for (std::size_t i = 0; i != m; ++i, r += k)
104 internal::pareto_distribution_impl<k>(rng, k, r, a, b);
105 internal::pareto_distribution_impl<k>(rng, l, r, a, b);
112 #endif // VSMC_RNG_PARETO_DISTRIBUTION_HPP bool pareto_distribution_check_param(RealType a, RealType b)
void mul(std::size_t n, const float *a, const float *b, float *y)
#define VSMC_DEFINE_RNG_DISTRIBUTION_2(Name, name, p1, v1, p2, v2)
void exponential_distribution(RNGType &rng, std::size_t n, RealType *r, RealType lambda)
Generating exponential random variates.
void pareto_distribution(RNGType &, std::size_t, RealType *, RealType, RealType)
Generating pareto random variates.
void exp(std::size_t n, const float *a, float *y)
void pareto_distribution_impl(RNGType &rng, std::size_t n, RealType *r, RealType a, RealType b)
Standard uniform distribution.
#define VSMC_DEFINE_RNG_DISTRIBUTION_RAND_2(Name, name, p1, p2)
void log(std::size_t n, const float *a, float *y)