1#ifndef STAN_MATH_PRIM_PROB_SKEW_DOUBLE_EXPONENTIAL_RNG_HPP
2#define STAN_MATH_PRIM_PROB_SKEW_DOUBLE_EXPONENTIAL_RNG_HPP
8#include <boost/random/uniform_real_distribution.hpp>
9#include <boost/random/variate_generator.hpp>
36template <
typename T_loc,
typename T_scale,
typename T_skewness,
class RNG>
39 const T_skewness& tau, RNG& rng) {
40 using boost::variate_generator;
41 using boost::random::uniform_real_distribution;
45 static constexpr const char* function =
"skew_double_exponential_rng";
47 sigma,
"Skewness Parameter", tau);
49 T_sigma_ref sigma_ref = sigma;
50 T_tau_ref tau_ref = tau;
53 check_bounded(function,
"Skewness parameter", tau_ref, 0.0, 1.0);
61 variate_generator<RNG&, uniform_real_distribution<> > z_rng(
62 rng, uniform_real_distribution<>(0.0, 1.0));
63 for (
size_t n = 0; n < N; ++n) {
67 =
log(z / tau_vec[n]) * sigma_vec[n] / (2.0 * (1.0 - tau_vec[n]))
70 output[n] =
log((1.0 - z) / (1.0 - tau_vec[n])) * (-sigma_vec[n])
typename helper::type type
VectorBuilder allocates type T1 values to be used as intermediate values.
scalar_seq_view provides a uniform sequence-like wrapper around either a scalar or a sequence of scal...
VectorBuilder< true, double, T_loc, T_scale, T_skewness >::type skew_double_exponential_rng(const T_loc &mu, const T_scale &sigma, const T_skewness &tau, RNG &rng)
Return a skew double exponential random variate with the given location scale and skewness using the ...
void check_bounded(const char *function, const char *name, const T_y &y, const T_low &low, const T_high &high)
Check if the value is between the low and high values, inclusively.
fvar< T > log(const fvar< T > &x)
void check_consistent_sizes(const char *)
Trivial no input case, this function is a no-op.
void check_finite(const char *function, const char *name, const T_y &y)
Return true if all values in y are finite.
int64_t max_size(const T1 &x1, const Ts &... xs)
Calculate the size of the largest input.
void check_positive_finite(const char *function, const char *name, const T_y &y)
Check if y is positive and finite.
typename ref_type_if< true, T >::type ref_type_t
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...