32 #ifndef VSMC_RNG_CAUCHY_DISTRIBUTION_HPP 33 #define VSMC_RNG_CAUCHY_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 param.
b() *
std::tan(const_pi<result_type>() * runif(rng));
88 template <
typename RealType,
typename RNGType>
90 RNGType &rng, std::size_t n, RealType *r, RealType a, RealType b)
93 mul(n, const_pi<RealType>(), r, r);
95 for (std::size_t i = 0; i != n; ++i)
103 template <
typename RealType,
typename RNGType>
105 RNGType &rng, std::size_t n, RealType *r, RealType a, RealType b)
107 const std::size_t k = 1000;
108 const std::size_t m = n / k;
109 const std::size_t l = n % k;
110 for (std::size_t i = 0; i != m; ++i)
115 template <
typename RealType,
typename RNGType>
117 std::size_t n, RealType *r)
124 #endif // VSMC_RNG_CAUCHY_DISTRIBUTION_HPP
Standard uniform distribution with open/closed variants.
bool cauchy_distribution_check_param(RealType, RealType b)
void mul(std::size_t n, const float *a, const float *b, float *y)
void cauchy_distribution_impl(RNGType &rng, std::size_t n, RealType *r, RealType a, RealType b)
void cauchy_distribution(RNGType &rng, std::size_t n, RealType *r, RealType a, RealType b)
Generating cauchy random variates.
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 u01_co_distribution(RNGType &rng, std::size_t n, RealType *r)
Generate standard uniform random variates on closed-open interval.
void tan(std::size_t n, const float *a, float *y)