1 #ifndef STAN_MATH_PRIM_SCAL_PROB_POISSON_LOG_RNG_HPP 2 #define STAN_MATH_PRIM_SCAL_PROB_POISSON_LOG_RNG_HPP 7 #include <boost/random/poisson_distribution.hpp> 8 #include <boost/random/variate_generator.hpp> 26 template <
typename T_rate,
class RNG>
28 const T_rate& alpha, RNG& rng) {
29 using boost::random::poisson_distribution;
30 using boost::variate_generator;
32 static const char*
function =
"poisson_log_rng";
33 static const double POISSON_MAX_LOG_RATE = 30 *
std::log(2);
36 check_less(
function,
"Log rate parameter", alpha, POISSON_MAX_LOG_RATE);
42 for (
size_t n = 0; n < N; ++n) {
43 variate_generator<RNG&, poisson_distribution<> >
poisson_rng(
44 rng, poisson_distribution<>(
std::exp(alpha_vec[n])));
void check_finite(const char *function, const char *name, const T_y &y)
Check if y is finite.
fvar< T > log(const fvar< T > &x)
scalar_seq_view provides a uniform sequence-like wrapper around either a scalar or a sequence of scal...
VectorBuilder< true, int, T_rate >::type poisson_rng(const T_rate &lambda, RNG &rng)
Return a Poisson random variate with specified rate parameter using the given random number generator...
size_t length(const std::vector< T > &x)
Returns the length of the provided std::vector.
VectorBuilder< true, int, T_rate >::type poisson_log_rng(const T_rate &alpha, RNG &rng)
Return a Poisson random variate with specified log rate parameter using the given random number gener...
fvar< T > exp(const fvar< T > &x)
VectorBuilder allocates type T1 values to be used as intermediate values.
void check_less(const char *function, const char *name, const T_y &y, const T_high &high)
Check if y is strictly less than high.