1#ifndef STAN_MATH_PRIM_PROB_POISSON_BINOMIAL_RNG_HPP
2#define STAN_MATH_PRIM_PROB_POISSON_BINOMIAL_RNG_HPP
7#include <boost/random/bernoulli_distribution.hpp>
8#include <boost/random/variate_generator.hpp>
24template <
typename T_theta,
typename RNG>
26 static constexpr const char* function =
"poisson_binomial_rng";
28 check_finite(function,
"Probability parameters", theta_ref);
29 check_bounded(function,
"Probability parameters", theta_ref, 0.0, 1.0);
32 for (
size_t i = 0; i < theta.size(); ++i) {
33 boost::variate_generator<RNG&, boost::bernoulli_distribution<> >
34 bernoulli_rng(rng, boost::bernoulli_distribution<>(theta_ref[i]));
VectorBuilder< true, int, T_theta >::type bernoulli_rng(const T_theta &theta, RNG &rng)
Return a Bernoulli random variate with specified chance of success parameter using the specified rand...
int poisson_binomial_rng(const T_theta &theta, RNG &rng)
Return a pseudorandom Poisson binomial random variable for the given vector of success parameters usi...
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.
void check_finite(const char *function, const char *name, const T_y &y)
Return true if all values in y are 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 ...