1 #ifndef __STAN__PROB__DISTRIBUTIONS__MULTIVARIATE__DISCRETE__CATEGORICAL_HPP__
2 #define __STAN__PROB__DISTRIBUTIONS__MULTIVARIATE__DISCRETE__CATEGORICAL_HPP__
15 template <
bool propto,
18 typename boost::math::tools::promote_args<T_prob>::type
20 const Eigen::Matrix<T_prob,Eigen::Dynamic,1>& theta,
22 static const char*
function =
"stan::prob::categorical_log(%1%)";
26 using boost::math::tools::promote_args;
30 typename promote_args<T_prob>::type lp(0.0);
32 "Number of categories",
36 "Probabilities parameter",
41 return log(theta(n-1));
45 template <
bool propto,
48 typename boost::math::tools::promote_args<T_prob>::type
50 const Eigen::Matrix<T_prob,Eigen::Dynamic,1>& theta) {
55 template <
typename T_prob,
58 typename boost::math::tools::promote_args<T_prob>::type
60 const Eigen::Matrix<T_prob,Eigen::Dynamic,1>& theta,
62 return categorical_log<false>(n,theta,Policy());
65 template <
typename T_prob>
67 typename boost::math::tools::promote_args<T_prob>::type
69 const Eigen::Matrix<T_prob,Eigen::Dynamic,1>& theta) {