Automatic Differentiation
 
Loading...
Searching...
No Matches

◆ dirichlet_rng()

template<class RNG >
Eigen::VectorXd stan::math::dirichlet_rng ( const Eigen::Matrix< double, Eigen::Dynamic, 1 > &  alpha,
RNG &  rng 
)
inline

Return a draw from a Dirichlet distribution with specified parameters and pseudo-random number generator.

For prior counts greater than zero, the usual algorithm that draws gamma variates and normalizes is used.

For prior counts less than zero (i.e., parameters with value less than one), a log-scale version of the following algorithm is used to deal with underflow:

G. Marsaglia and W. Tsang. A simple method for generating gamma variables. ACM Transactions on Mathematical Software. 26(3):363–372, 2000.

Template Parameters
RNGtype of pseudo-random number generator
Parameters
alphaPrior count (plus 1) parameter for Dirichlet.
rngPseudo-random number generator.

Definition at line 39 of file dirichlet_rng.hpp.