1 #ifndef STAN_MATH_PRIM_MAT_PROB_CATEGORICAL_LOGIT_RNG_HPP 2 #define STAN_MATH_PRIM_MAT_PROB_CATEGORICAL_LOGIT_RNG_HPP 5 #include <boost/random/uniform_01.hpp> 6 #include <boost/random/variate_generator.hpp> 30 using boost::uniform_01;
31 using boost::variate_generator;
33 static const char*
function =
"categorical_logit_rng";
37 variate_generator<RNG&, uniform_01<> > uniform01_rng(rng, uniform_01<>());
38 Eigen::VectorXd theta =
softmax(beta);
41 double c = uniform01_rng();
std::vector< T > cumulative_sum(const std::vector< T > &x)
Return the cumulative sum of the specified vector.
void check_finite(const char *function, const char *name, const T_y &y)
Check if y is finite.
Eigen::Matrix< fvar< T >, Eigen::Dynamic, 1 > softmax(const Eigen::Matrix< fvar< T >, Eigen::Dynamic, 1 > &alpha)
int categorical_logit_rng(const Eigen::VectorXd &beta, RNG &rng)
Return a draw from a Categorical distribution given a a vector of unnormalized log probabilities and ...
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.