|
1 | 1 | #include <stan/math/prim/functor.hpp>
|
2 | 2 | #include <stan/math/prim/fun.hpp>
|
| 3 | +#include <stan/math/prim/prob/wiener_full_lpdf.hpp> |
3 | 4 |
|
4 | 5 | #include <gtest/gtest.h>
|
5 | 6 | #include <vector>
|
@@ -163,3 +164,22 @@ TEST(StanMath_hcubature_prim, test1) {
|
163 | 164 | std::make_tuple((1 + sqrt(10.0)) / 9.0), dim, a_4, b_4,
|
164 | 165 | 20000, 0.0, reqRelError_3, 0.999998);
|
165 | 166 | }
|
| 167 | + |
| 168 | +TEST(StanMath_hcubature_prim, test_issue_3075) { |
| 169 | + // test for regressions against issue |
| 170 | + // https://github.com/stan-dev/math/issues/3075 |
| 171 | + using stan::math::internal::GradientCalc; |
| 172 | + using stan::math::internal::wiener5_density; |
| 173 | + using stan::math::internal::wiener7_integrate; |
| 174 | + |
| 175 | + auto params_st = std::make_tuple(0.553273, 1, -3.5, 0.55, 0.553161, 1.06423, |
| 176 | + 0.0941929, 0.0, -28.3242); |
| 177 | + Eigen::VectorXd xmin = Eigen::VectorXd::Zero(2); |
| 178 | + Eigen::VectorXd xmax = Eigen::VectorXd::Ones(2); |
| 179 | + |
| 180 | + auto f = wiener7_integrate<GradientCalc::OFF, GradientCalc::OFF>( |
| 181 | + [](auto&&... args) { return wiener5_density<GradientCalc::ON>(args...); }, |
| 182 | + -18.3029, params_st, 1, xmin, xmax, 6000, 0, 4.5e-05); |
| 183 | + |
| 184 | + ASSERT_FLOAT_EQ(f, 4.97571e-312); |
| 185 | +} |
0 commit comments