1 #ifndef STAN_MATH_PRIM_MAT_PROB_INV_WISHART_RNG_HPP
2 #define STAN_MATH_PRIM_MAT_PROB_INV_WISHART_RNG_HPP
14 inline Eigen::MatrixXd
16 static const char*
function(
"inv_wishart_rng");
18 using Eigen::MatrixXd;
21 check_greater(
function,
"degrees of freedom > dims - 1", nu, k - 1);
24 MatrixXd S_inv = MatrixXd::Identity(k, k);
25 S_inv = S.ldlt().solve(S_inv);
27 return 0.5 * (asym.transpose() + asym);
Eigen::MatrixXd wishart_rng(double nu, const Eigen::MatrixXd &S, RNG &rng)
Primary template class for the metaprogram to compute the index type of a container.
Eigen::MatrixXd inv_wishart_rng(const double nu, const Eigen::MatrixXd &S, RNG &rng)
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > inverse_spd(const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &m)
Returns the inverse of the specified symmetric, pos/neg-definite matrix.
bool check_square(const char *function, const char *name, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y)
Return true if the specified matrix is square.
bool check_greater(const char *function, const char *name, const T_y &y, const T_low &low)
Return true if y is strictly greater than low.