1#ifndef STAN_MATH_PRIM_PROB_INV_WISHART_RNG_HPP
2#define STAN_MATH_PRIM_PROB_INV_WISHART_RNG_HPP
15 using Eigen::MatrixXd;
16 static constexpr const char* function =
"inv_wishart_rng";
18 check_greater(function,
"degrees of freedom > dims - 1", nu, k - 1);
22 MatrixXd S_inv = MatrixXd::Identity(k, k);
23 Eigen::LDLT<Eigen::MatrixXd> ldlt_of_S = S.ldlt();
25 S_inv = ldlt_of_S.solve(S_inv);
27 return 0.5 * (asym.transpose() + asym);
void check_symmetric(const char *function, const char *name, const matrix_cl< T > &y)
Check if the matrix_cl is symmetric.
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.
Eigen::MatrixXd inv_wishart_rng(double nu, const Eigen::MatrixXd &S, RNG &rng)
Eigen::Matrix< value_type_t< EigMat >, Eigen::Dynamic, Eigen::Dynamic > inverse_spd(const EigMat &m)
Returns the inverse of the specified symmetric, pos/neg-definite matrix.
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 ...