Skip to content

Commit 475a022

Browse files
committed
Add crashing test
1 parent f98e093 commit 475a022

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,22 @@ TEST(MathFunctions, log_modified_bessel_first_kind_vec) {
9191
in2 << 7.3, 0.7, 2.8;
9292
stan::test::binary_scalar_tester(f, in1, in2);
9393
}
94+
95+
TEST(MathFunctions, log_modified_bessel_first_kind_aki_regression) {
96+
// https://github.com/stan-dev/cmdstan/issues/1324#issuecomment-3206462728
97+
98+
using stan::math::log_modified_bessel_first_kind;
99+
double rho = 0.5;
100+
double alpha = 2.0;
101+
int M = 20;
102+
103+
double a = (1 / stan::math::pow(rho, 2));
104+
Eigen::Matrix<double, -1, 1> q = stan::math::exp(stan::math::add(
105+
stan::math::log(alpha),
106+
stan::math::multiply(
107+
0.5,
108+
stan::math::add(
109+
(stan::math::log(2) - a),
110+
stan::math::to_vector(stan::math::log_modified_bessel_first_kind(
111+
stan::math::linspaced_int_array(M, 1, M), a))))));
112+
}

0 commit comments

Comments
 (0)