32 #ifndef VSMC_RNG_LOGISTIC_DISTRIBUTION_HPP 33 #define VSMC_RNG_LOGISTIC_DISTRIBUTION_HPP 44 template <
typename RealType>
54 template <
typename RealType>
64 return -std::numeric_limits<result_type>::max
VSMC_MNE();
69 return std::numeric_limits<result_type>::max
VSMC_MNE();
75 template <
typename RNGType>
81 return param.
a() + param.
b() *
std::log(u / (1 - u));
88 template <std::
size_t K,
typename RealType,
typename RNGType>
90 RNGType &rng, std::size_t n, RealType *r, RealType a, RealType b)
94 sub(n, static_cast<RealType>(1), r, s);
104 template <
typename RealType,
typename RNGType>
106 RNGType &rng, std::size_t n, RealType *r, RealType a, RealType b)
108 const std::size_t k = 1000;
109 const std::size_t m = n / k;
110 const std::size_t l = n % k;
111 for (std::size_t i = 0; i != m; ++i)
112 internal::logistic_distribution_impl<k>(rng, k, r + i * k, a, b);
113 internal::logistic_distribution_impl<k>(rng, l, r + m * k, a, b);
116 template <
typename RealType,
typename RNGType>
118 std::size_t n, RealType *r)
125 #endif // VSMC_RNG_LOGISTIC_DISTRIBUTION_HPP
Standard uniform distribution with open/closed variants.
void logistic_distribution(RNGType &, std::size_t, RealType *, RealType, RealType)
Generating logistic random variates.
bool logistic_distribution_check_param(RealType, RealType b)
void u01_oo_distribution(RNGType &rng, std::size_t n, RealType *r)
Generate standard uniform random variates on open-open interval.
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 sub(std::size_t n, const float *a, const float *b, float *y)
void fma(std::size_t n, const T *a, const T *b, const T *c, T *y)
For , compute .
void log(std::size_t n, const float *a, float *y)
void logistic_distribution_impl(RNGType &rng, std::size_t n, RealType *r, RealType a, RealType b)