1#ifndef STAN_MATH_PRIM_PROB_WISHART_RNG_HPP
2#define STAN_MATH_PRIM_PROB_WISHART_RNG_HPP
15inline Eigen::MatrixXd
wishart_rng(
double nu,
const Eigen::MatrixXd& S,
17 using Eigen::MatrixXd;
18 static constexpr const char* function =
"wishart_rng";
22 check_greater(function,
"degrees of freedom > dims - 1", nu, k - 1);
24 Eigen::LLT<Eigen::MatrixXd> llt_of_S = S.llt();
27 MatrixXd B = MatrixXd::Zero(k, k);
28 for (
int j = 0; j < k; ++j) {
29 for (
int i = 0; i < j; ++i) {
void check_symmetric(const char *function, const char *name, const matrix_cl< T > &y)
Check if the matrix_cl is symmetric.
VectorBuilder< true, double, T_loc, T_scale >::type normal_rng(const T_loc &mu, const T_scale &sigma, RNG &rng)
Return a Normal random variate for the given location and scale using the specified random number gen...
VectorBuilder< true, double, T_deg >::type chi_square_rng(const T_deg &nu, RNG &rng)
Return a chi squared random variate with nu degrees of freedom using the specified random number gene...
void check_square(const char *function, const char *name, const T_y &y)
Check if the specified matrix is square.
typename index_type< T >::type index_type_t
void check_pos_definite(const char *function, const char *name, const EigMat &y)
Check if the specified square, symmetric matrix is positive definite.
matrix_cl< typename std::decay_t< T_A >::Scalar > crossprod(T_A &&A)
Returns the result of pre-multiplying a matrix by its own transpose.
Eigen::MatrixXd wishart_rng(double nu, const Eigen::MatrixXd &S, RNG &rng)
void check_greater(const char *function, const char *name, const T_y &y, const T_low &low, Idxs... idxs)
Throw an exception if y is not strictly greater than low.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...