32 #ifndef VSMC_RNG_STUDENT_T_DISTRIBUTION_HPP 33 #define VSMC_RNG_STUDENT_T_DISTRIBUTION_HPP 45 template <
typename RealType>
55 template <
typename RealType>
63 return std::numeric_limits<result_type>::lowest();
78 template <
typename RNGType>
83 if (param == param_) {
84 u = n() / chi_squared_(rng);
87 u = param.
n() / chi_squared(rng);
97 template <std::
size_t K,
typename RealType,
typename RNGType>
99 RNGType &rng, std::size_t n, RealType *r, RealType df)
103 mul(n, 1 / df, r, r);
106 rng, n, s, static_cast<RealType>(0), static_cast<RealType>(1));
114 template <
typename RealType,
typename RNGType>
116 RNGType &rng, std::size_t n, RealType *r, RealType df)
118 static_assert(std::is_floating_point<RealType>::value,
119 "**student_t_distribution** USED WITH RealType OTHER THAN FLOATING " 122 const std::size_t k = 1024;
123 const std::size_t m = n / k;
124 const std::size_t l = n % k;
125 for (std::size_t i = 0; i != m; ++i, r += k)
126 internal::student_t_distribution_impl<k>(rng, k, r, df);
127 internal::student_t_distribution_impl<k>(rng, l, r, df);
134 #endif // VSMC_RNG_STUDENT_T_DISTRIBUTION_HPP
void mul(std::size_t n, const float *a, const float *b, float *y)
void sqrt(std::size_t n, const float *a, float *y)
void student_t_distribution(RNGType &, std::size_t, RealType *, RealType)
Generating student-t random variates.
void normal_distribution(RNGType &, std::size_t, RealType *, RealType, RealType)
Generating Normal random variates.
void student_t_distribution_impl(RNGType &rng, std::size_t n, RealType *r, RealType df)
void div(std::size_t n, const float *a, const float *b, float *y)
void chi_squared_distribution(RNGType &rng, std::size_t n, RealType *r, RealType df)
Generating random variates.
bool student_t_distribution_check_param(RealType n)
#define VSMC_DEFINE_RNG_DISTRIBUTION_RAND_1(Name, name, p1)
#define VSMC_DEFINE_RNG_DISTRIBUTION_1(Name, name, p1, v1)