32 #ifndef VSMC_RNG_FISHER_F_DISTRIBUTION_HPP 33 #define VSMC_RNG_FISHER_F_DISTRIBUTION_HPP 44 template <
typename RealType>
47 return m > 0 && n > 0;
54 template <
typename RealType>
66 return std::numeric_limits<result_type>::max
VSMC_MNE();
79 template <
typename RNGType>
83 return (chi_squared_m_(rng) / m()) / (chi_squared_n_(rng) / n());
88 return (chi_squared_m(rng) / param.
m()) /
89 (chi_squared_n(rng) / param.
n());
96 template <std::
size_t K,
typename RealType,
typename RNGType>
98 RNGType &rng, std::size_t n, RealType *r, RealType df1, RealType df2)
103 mul(n, 1 / df1, s, s);
104 mul(n, 1 / df2, r, r);
112 template <
typename RealType,
typename RNGType>
114 RNGType &rng, std::size_t n, RealType *r, RealType df1, RealType df2)
116 const std::size_t k = 1000;
117 const std::size_t m = n / k;
118 const std::size_t l = n % k;
119 for (std::size_t i = 0; i != m; ++i)
120 internal::fisher_f_distribution_impl<k>(rng, k, r + i * k, df1, df2);
121 internal::fisher_f_distribution_impl<k>(rng, l, r + m * k, df1, df2);
124 template <
typename RealType,
typename RNGType>
126 std::size_t n, RealType *r)
133 #endif // VSMC_RNG_FISHER_F_DISTRIBUTION_HPP bool fisher_f_distribution_check_param(RealType m, RealType n)
void mul(std::size_t n, const float *a, const float *b, float *y)
void rng_rand(RNGType &rng, BernoulliDistribution< IntType > &dist, std::size_t n, IntType *r)
#define VSMC_DEFINE_RNG_DISTRIBUTION_OPERATORS
#define VSMC_DEFINE_RNG_DISTRIBUTION_2(Name, name, T, T1, p1, v1, T2, p2, v2)
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.
void fisher_f_distribution(RNGType &rng, std::size_t n, RealType *r, RealType df1, RealType df2)
Generating Fisher-F random variates.
void fisher_f_distribution_impl(RNGType &rng, std::size_t n, RealType *r, RealType df1, RealType df2)