32 #ifndef VSMC_RNG_STUDENT_T_DISTRIBUTION_HPP 33 #define VSMC_RNG_STUDENT_T_DISTRIBUTION_HPP 45 template <
typename RealType>
55 template <
typename RealType>
65 return -std::numeric_limits<result_type>::max
VSMC_MNE();
70 return std::numeric_limits<result_type>::max
VSMC_MNE();
83 template <
typename RNGType>
88 if (param == param_) {
89 u = n() / chi_squared_(rng);
92 u = param.
n() / chi_squared(rng);
102 template <std::
size_t K,
typename RealType,
typename RNGType>
104 RNGType &rng, std::size_t n, RealType *r, RealType df)
108 mul(n, 1 / df, r, r);
111 rng, n, s, static_cast<RealType>(0), static_cast<RealType>(1));
119 template <
typename RealType,
typename RNGType>
121 RNGType &rng, std::size_t n, RealType *r, RealType df)
123 const std::size_t k = 1000;
124 const std::size_t m = n / k;
125 const std::size_t l = n % k;
126 for (std::size_t i = 0; i != m; ++i)
127 internal::student_t_distribution_impl<k>(rng, k, r + i * k, df);
128 internal::student_t_distribution_impl<k>(rng, l, r + m * k, df);
131 template <
typename RealType,
typename RNGType>
133 std::size_t n, RealType *r)
140 #endif // VSMC_RNG_STUDENT_T_DISTRIBUTION_HPP
#define VSMC_DEFINE_RNG_DISTRIBUTION_1(Name, name, T, T1, p1, v1)
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 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.
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)