1 #ifndef STAN_MATH_PRIM_SCAL_PROB_DOUBLE_EXPONENTIAL_RNG_HPP 2 #define STAN_MATH_PRIM_SCAL_PROB_DOUBLE_EXPONENTIAL_RNG_HPP 4 #include <boost/random/uniform_01.hpp> 5 #include <boost/random/variate_generator.hpp> 36 static const char*
function(
"double_exponential_rng");
38 using boost::variate_generator;
39 using boost::random::uniform_01;
46 variate_generator<RNG&, uniform_01<> >
47 rng_unit_01(rng, uniform_01<>());
49 double laplaceRN = rng_unit_01();
50 if (0.5 - laplaceRN > 0)
52 else if (0.5 - laplaceRN < 0)
54 return mu - sigma * a *
log1m(2 *
abs(0.5 - laplaceRN));
fvar< T > abs(const fvar< T > &x)
void check_finite(const char *function, const char *name, const T_y &y)
Check if y is finite.
double double_exponential_rng(double mu, double sigma, RNG &rng)
Return a pseudorandom double exponential variate with the given location and scale using the specifie...
fvar< T > log(const fvar< T > &x)
void check_positive_finite(const char *function, const char *name, const T_y &y)
Check if y is positive and finite.
fvar< T > log1m(const fvar< T > &x)