Skip to content

Commit 42f7a80

Browse files
committed
Merge branch 'fix-inv-wishart-cholesky-rng' of https://github.com/stan-dev/math into fix-inv-wishart-cholesky-rng
2 parents 428bd15 + 80168bb commit 42f7a80

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

stan/math/prim/prob/inv_wishart_cholesky_rng.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ namespace math {
1414
* from the inverse Wishart distribution with the specified degrees of freedom
1515
* using the specified random number generator.
1616
*
17-
* Axen, Seth D. "Efficiently generating inverse-Wishart matrices and their Cholesky factors."
18-
* arXiv preprint arXiv:2310.15884 (2023).
19-
*
17+
* Axen, Seth D. "Efficiently generating inverse-Wishart matrices and their
18+
* Cholesky factors." arXiv preprint arXiv:2310.15884 (2023).
19+
*
2020
* @tparam RNG Random number generator type
2121
* @param[in] nu scalar degrees of freedom
2222
* @param[in] L_S lower Cholesky factor of the scale matrix

test/unit/math/prim/prob/inv_wishart_cholesky_rng_test.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ TEST(ProbDistributionsInvWishartCholesky, SpecialRNGTest) {
9898
MatrixXd L = MatrixXd::Identity(k, k);
9999
MatrixXd Z = MatrixXd::Zero(k, k);
100100
for (int i = 0; i < N; i++) {
101-
Z += multiply_lower_tri_self_transpose(inv_wishart_cholesky_rng(k + 2, L, rng));
101+
Z += multiply_lower_tri_self_transpose(
102+
inv_wishart_cholesky_rng(k + 2, L, rng));
102103
}
103104
Z /= N;
104105
for (int j = 0; j < k; j++) {
@@ -113,7 +114,7 @@ TEST(ProbDistributionsInvWishartCholesky, SpecialRNGTest) {
113114
}
114115

115116
TEST(ProbDistributionsInvWishartCholesky, compareToInvWishart) {
116-
// Compare the marginal mean
117+
// Compare the marginal mean
117118

118119
using Eigen::MatrixXd;
119120
using Eigen::VectorXd;
@@ -132,12 +133,13 @@ TEST(ProbDistributionsInvWishartCholesky, compareToInvWishart) {
132133
MatrixXd Z_mean = sigma / (k + 3);
133134
MatrixXd Z_est = MatrixXd::Zero(k, k);
134135
for (int i = 0; i < N; i++) {
135-
Z_est += multiply_lower_tri_self_transpose(inv_wishart_cholesky_rng(k + 4, L, rng));
136+
Z_est += multiply_lower_tri_self_transpose(
137+
inv_wishart_cholesky_rng(k + 4, L, rng));
136138
}
137139
Z_est /= N;
138140
for (int j = 0; j < k; j++) {
139141
for (int i = 0; i < j; i++) {
140-
EXPECT_NEAR(Z_est(i, j), Z_mean(i, j), tol);
142+
EXPECT_NEAR(Z_est(i, j), Z_mean(i, j), tol);
141143
}
142144
}
143145
}

0 commit comments

Comments
 (0)