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> 25 static const char*
function(
"double_exponential_rng");
27 using boost::variate_generator;
28 using boost::random::uniform_01;
35 variate_generator<RNG&, uniform_01<> >
36 rng_unit_01(rng, uniform_01<>());
38 double laplaceRN = rng_unit_01();
39 if (0.5 - laplaceRN > 0)
41 else if (0.5 - laplaceRN < 0)
43 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)
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)