1#ifndef STAN_MATH_PRIM_PROB_WISHART_CHOLESKY_RNG_HPP
2#define STAN_MATH_PRIM_PROB_WISHART_CHOLESKY_RNG_HPP
32 const Eigen::MatrixXd& L_S,
34 using Eigen::MatrixXd;
35 static constexpr const char* function =
"wishart_cholesky_rng";
37 check_greater(function,
"degrees of freedom > dims - 1", nu, k - 1);
41 MatrixXd B = MatrixXd::Zero(k, k);
42 for (
int j = 0; j < k; ++j) {
43 for (
int i = 0; i < j; ++i) {
48 return L_S.template triangularView<Eigen::Lower>() * B.transpose();
Eigen::MatrixXd wishart_cholesky_rng(double nu, const Eigen::MatrixXd &L_S, RNG &rng)
Return a random Cholesky factor of the inverse covariance matrix of the specified dimensionality draw...
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_cholesky_factor(const char *function, const char *name, const Mat &y)
Throw an exception if the specified matrix is not a valid Cholesky factor.
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 ...