1#ifndef STAN_MATH_PRIM_PROB_BETA_NEG_BINOMIAL_RNG_HPP
2#define STAN_MATH_PRIM_PROB_BETA_NEG_BINOMIAL_RNG_HPP
32template <
typename T_r,
typename T_alpha,
typename T_beta,
typename RNG>
34 const T_beta &
beta, RNG &rng) {
38 static constexpr const char *function =
"beta_neg_binomial_rng";
40 "Prior success parameter", alpha,
41 "Prior failure parameter",
beta);
44 T_alpha_ref alpha_ref = alpha;
45 T_beta_ref beta_ref =
beta;
50 using T_p =
decltype(
beta_rng(alpha_ref, beta_ref, rng));
51 T_p p =
beta_rng(alpha_ref, beta_ref, rng);
56 for (
size_t n = 0; n < size_p; ++n) {
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_shape, T_inv >::type neg_binomial_rng(const T_shape &alpha, const T_inv &beta, RNG &rng)
Return a negative binomial random variate with the specified shape and inverse scale parameters using...
VectorBuilder< true, double, T_shape1, T_shape2 >::type beta_rng(const T_shape1 &alpha, const T_shape2 &beta, RNG &rng)
Return a Beta random variate with the supplied success and failure parameters using the given random ...
auto beta_neg_binomial_rng(const T_r &r, const T_alpha &alpha, const T_beta &beta, RNG &rng)
Return a beta-negative binomial random variate with the given number of successes,...
int64_t size(const T &m)
Returns the size (number of the elements) of a matrix_cl or var_value<matrix_cl<T>>.
fvar< T > log(const fvar< T > &x)
void check_consistent_sizes(const char *)
Trivial no input case, this function is a no-op.
fvar< T > log1m(const fvar< T > &x)
fvar< T > beta(const fvar< T > &x1, const fvar< T > &x2)
Return fvar with the beta function applied to the specified arguments and its gradient.
void check_positive_finite(const char *function, const char *name, const T_y &y)
Check if y is positive and finite.
fvar< T > exp(const fvar< T > &x)
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 ...