1 #ifndef __STAN__PROB__DISTRIBUTIONS__MULTIVARIATE__CONTINUOUS__DIRICHLET_HPP__
2 #define __STAN__PROB__DISTRIBUTIONS__MULTIVARIATE__CONTINUOUS__DIRICHLET_HPP__
39 template <
bool propto,
40 typename T_prob,
typename T_prior_sample_size,
42 typename boost::math::tools::promote_args<T_prob,T_prior_sample_size>::type
44 const Eigen::Matrix<T_prior_sample_size,Eigen::Dynamic,1>& alpha,
47 using boost::math::tools::promote_args;
48 typename promote_args<T_prob,T_prior_sample_size>::type lp(0.0);
53 for (
int k = 0; k < alpha.rows(); ++k)
57 for (
int k = 0; k < theta.rows(); ++k)
62 template <
bool propto,
63 typename T_prob,
typename T_prior_sample_size>
65 typename boost::math::tools::promote_args<T_prob,T_prior_sample_size>::type
67 const Eigen::Matrix<T_prior_sample_size,Eigen::Dynamic,1>& alpha) {
72 template <
typename T_prob,
typename T_prior_sample_size,
75 typename boost::math::tools::promote_args<T_prob,T_prior_sample_size>::type
77 const Eigen::Matrix<T_prior_sample_size,Eigen::Dynamic,1>& alpha,
79 return dirichlet_log<false>(theta,alpha,Policy());
82 template <
typename T_prob,
typename T_prior_sample_size>
84 typename boost::math::tools::promote_args<T_prob,T_prior_sample_size>::type
86 const Eigen::Matrix<T_prior_sample_size,Eigen::Dynamic,1>& alpha) {
var multiply_log(const var &a, const var &b)
Return the value of a*log(b).
var lgamma(const stan::agrad::var &a)
The log gamma function for variables (C99).
boost::math::tools::promote_args< T_a, T_b >::type multiply_log(T_a a, T_b b)
boost::math::policies::policy default_policy
Default error-handling policy from Boost.
boost::math::tools::promote_args< T_prob, T_prior_sample_size >::type dirichlet_log(const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &theta, const Eigen::Matrix< T_prior_sample_size, Eigen::Dynamic, 1 > &alpha, const Policy &)
The log of the Dirichlet density for the given theta and a vector of prior sample sizes,...
Probability, optimization and sampling library.
Template metaprogram to calculate whether a summand needs to be included in a proportional (log) prob...