1 #ifndef STAN_MATH_PRIM_MAT_PROB_MULTINOMIAL_LPMF_HPP 2 #define STAN_MATH_PRIM_MAT_PROB_MULTINOMIAL_LPMF_HPP 16 template <
bool propto,
typename T_prob>
18 const std::vector<int>& ns,
19 const Eigen::Matrix<T_prob, Eigen::Dynamic, 1>& theta) {
20 static const char*
function =
"multinomial_lpmf";
22 using boost::math::tools::promote_args;
24 typename promote_args<T_prob>::type lp(0.0);
28 "rows of probabilities parameter", theta.rows());
39 for (
unsigned int i = 0; i < ns.size(); ++i)
45 template <
typename T_prob>
47 const std::vector<int>& ns,
48 const Eigen::Matrix<T_prob, Eigen::Dynamic, 1>& theta) {
49 return multinomial_lpmf<false>(ns, theta);
fvar< T > sum(const std::vector< fvar< T > > &m)
Return the sum of the entries of the specified standard vector.
void check_simplex(const char *function, const char *name, const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &theta)
Check if the specified vector is simplex.
fvar< T > lgamma(const fvar< T > &x)
Return the natural logarithm of the gamma function applied to the specified argument.
void check_size_match(const char *function, const char *name_i, T_size1 i, const char *name_j, T_size2 j)
Check if the provided sizes match.
Template metaprogram to calculate whether a summand needs to be included in a proportional (log) prob...
void check_nonnegative(const char *function, const char *name, const T_y &y)
Check if y is non-negative.
fvar< T > multiply_log(const fvar< T > &x1, const fvar< T > &x2)
boost::math::tools::promote_args< T_prob >::type multinomial_lpmf(const std::vector< int > &ns, const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &theta)