1 #ifndef STAN_MATH_PRIM_MAT_PROB_LKJ_CORR_CHOLESKY_RNG_HPP 2 #define STAN_MATH_PRIM_MAT_PROB_LKJ_CORR_CHOLESKY_RNG_HPP 14 static const char*
function =
"lkj_corr_cholesky_rng";
18 Eigen::ArrayXd CPCs((K * (K - 1)) / 2);
19 double alpha = eta + 0.5 * (K - 1);
20 unsigned int count = 0;
21 for (
size_t i = 0; i < (K - 1); i++) {
23 for (
size_t j = i + 1; j < K; j++) {
24 CPCs(count) = 2.0 *
beta_rng(alpha, alpha, rng) - 1.0;
VectorBuilder< true, double, T_shape1, T_shape2 >::type beta_rng(const T_shape1 &alpha, const T_shape2 &beta, RNG &rng)
Return a Beta random variate with the supplied success and failure parameters using the given random ...
Eigen::MatrixXd lkj_corr_cholesky_rng(size_t K, double eta, RNG &rng)
void check_positive(const char *function, const char *name, const T_y &y)
Check if y is positive.
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > read_corr_L(const Eigen::Array< T, Eigen::Dynamic, 1 > &CPCs, size_t K)
Return the Cholesky factor of the correlation matrix of the specified dimensionality corresponding to...