Skip to content

Commit 601a96a

Browse files
committed
Add failing test
1 parent d959c81 commit 601a96a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/unit/math/prim/fun/cholesky_decompose_test.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,18 @@ TEST(MathMatrixPrimMat, cholesky_decompose_exception) {
3535
EXPECT_THROW_MSG(stan::math::cholesky_decompose(m), std::domain_error,
3636
"is not symmetric");
3737
}
38+
39+
TEST(MathMatrixPrimMat, cholesky_decompose_expressions) {
40+
// Test for https://github.com/stan-dev/math/issues/3198
41+
stan::math::matrix_d A(2, 3);
42+
A << 1, 2, 3, 4, 5, 6;
43+
44+
stan::math::vector_d L_u(3);
45+
L_u << 1, 0, 0.5;
46+
47+
auto L = stan::math::cholesky_corr_constrain(L_u, 3);
48+
49+
EXPECT_NO_THROW(stan::math::cholesky_decompose(stan::math::multiply(
50+
stan::math::multiply(A, stan::math::multiply_lower_tri_self_transpose(L)),
51+
stan::math::transpose(A))));
52+
}

0 commit comments

Comments
 (0)