32 #ifndef MCKL_RANDOM_LAPLACE_DISTRIBUTION_HPP 33 #define MCKL_RANDOM_LAPLACE_DISTRIBUTION_HPP 42 template <
typename RealType>
48 template <std::
size_t K,
typename RealType,
typename RNGType>
50 RNGType &rng, std::size_t n, RealType *r, RealType a, RealType b)
54 sub(n, r, static_cast<RealType>(0.5), r);
55 for (std::size_t i = 0; i != n; ++i) {
65 muladd(n, s.data(), r, a, r);
71 Laplace, laplace, RealType, RealType, a, RealType, b)
73 template <
typename RealType>
86 return std::numeric_limits<result_type>::lowest();
94 template <
typename RNGType>
100 return u > 0 ? param.
a() - param.
b() *
std::log(1 - 2 * u) :
109 #endif // MCKL_RANDOM_LAPLACE_DISTRIBUTION_HPP #define MCKL_DEFINE_RANDOM_DISTRIBUTION_2( Name, name, T, T1, p1, v1, T2, p2, v2)
void laplace_distribution_impl(RNGType &rng, std::size_t n, RealType *r, RealType a, RealType b)
bool laplace_distribution_check_param(RealType, RealType b)
void log(std::size_t n, const float *a, float *y)
void u01_oo_distribution(RNGType &rng, std::size_t n, RealType *r)
#define MCKL_DEFINE_RANDOM_DISTRIBUTION_RAND(Name, T)
RealType u01(UIntType u)
Convert uniform unsigned integers to floating points within [0, 1].
void sub(std::size_t n, const float *a, const float *b, float *y)
Standard uniform distribution on (0, 1)
#define MCKL_DEFINE_RANDOM_DISTRIBUTION_BATCH_2( Name, name, T, T1, p1, T2, p2)
#define MCKL_ALIGNMENT
The default alignment for scalar type.
#define MCKL_DEFINE_RANDOM_DISTRIBUTION_MEMBER_0
#define MCKL_DEFINE_RANDOM_DISTRIBUTION_ASSERT_REAL_TYPE(Name)