1#ifndef STAN_MATH_PRIM_PROB_POISSON_RNG_HPP
2#define STAN_MATH_PRIM_PROB_POISSON_RNG_HPP
10#include <boost/random/poisson_distribution.hpp>
11#include <boost/random/variate_generator.hpp>
29template <
typename T_rate,
class RNG>
31 const T_rate& lambda, RNG& rng) {
32 using boost::variate_generator;
33 using boost::random::poisson_distribution;
34 static constexpr const char* function =
"poisson_rng";
35 const auto& lambda_ref =
to_ref(lambda);
43 for (
size_t n = 0; n < N; ++n) {
44 variate_generator<RNG&, poisson_distribution<> >
poisson_rng(
45 rng, poisson_distribution<>(lambda_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, 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...
int64_t size(const T &m)
Returns the size (number of the elements) of a matrix_cl or var_value<matrix_cl<T>>.
const double POISSON_MAX_RATE
Largest rate parameter allowed in Poisson RNG.
ref_type_t< T && > to_ref(T &&a)
This evaluates expensive Eigen expressions.
void check_positive(const char *function, const char *name, const T_y &y)
Check if y is positive.
void check_less(const char *function, const char *name, const T_y &y, const T_high &high, Idxs... idxs)
Throw an exception if y is not strictly less than high.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...