32 #ifndef VSMC_RNG_EXPONENTIAL_DISTRIBUTION_HPP 33 #define VSMC_RNG_EXPONENTIAL_DISTRIBUTION_HPP 44 template <
typename RealType>
54 template <
typename RealType>
66 return std::numeric_limits<result_type>::max
VSMC_MNE();
72 template <
typename RNGType>
84 template <
typename RealType,
typename RNGType>
86 RNGType &rng, std::size_t n, RealType *r, RealType lambda)
90 mul(n, -1 / lambda, r, r);
97 template <
typename RealType,
typename RNGType>
99 RNGType &rng, std::size_t n, RealType *r, RealType lambda)
101 const std::size_t k = 1000;
102 const std::size_t m = n / k;
103 const std::size_t l = n % k;
104 for (std::size_t i = 0; i != m; ++i)
109 template <
typename RealType,
typename RNGType>
111 std::size_t n, RealType *r)
118 #endif // VSMC_RNG_EXPONENTIAL_DISTRIBUTION_HPP
Standard uniform distribution with open/closed variants.
#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)
bool exponential_distribution_check_param(RealType lambda)
void rng_rand(RNGType &rng, BernoulliDistribution< IntType > &dist, std::size_t n, IntType *r)
void exponential_distribution(RNGType &rng, std::size_t n, RealType *r, RealType lambda)
Generating exponential random variates.
#define VSMC_DEFINE_RNG_DISTRIBUTION_OPERATORS
result_type lambda() const
Exponential distribution.
void exponential_distribution_impl(RNGType &rng, std::size_t n, RealType *r, RealType lambda)
void u01_oc_distribution(RNGType &rng, std::size_t n, RealType *r)
Generate standard uniform random variates on open-closed interval.
void log(std::size_t n, const float *a, float *y)