@@ -22,11 +22,21 @@ void expect(const T1& x, const T2& lb, const T3& ub) {
2222 auto xx = stan::math::lub_constrain<true >(x, lb, ub, lp);
2323 return stan::math::add (lp, stan::math::sum (xx));
2424 };
25+ auto f5 = [](const auto & x, const auto & lb, const auto & ub) {
26+ stan::return_type_t <decltype (x), decltype (lb), decltype (ub)> lp = 0 ;
27+ return stan::math::lub_constrain<false >(x, std::make_tuple (lb, ub), lp);
28+ };
29+ auto f6 = [](const auto & x, const auto & lb, const auto & ub) {
30+ stan::return_type_t <decltype (x), decltype (lb), decltype (ub)> lp = 0 ;
31+ return stan::math::lub_constrain<true >(x, std::make_tuple (lb, ub), lp);
32+ };
2533
2634 stan::test::expect_ad (f1, x, lb, ub);
2735 stan::test::expect_ad (f2, x, lb, ub);
2836 stan::test::expect_ad (f3, x, lb, ub);
2937 stan::test::expect_ad (f4, x, lb, ub);
38+ stan::test::expect_ad (f5, x, lb, ub);
39+ stan::test::expect_ad (f6, x, lb, ub);
3040}
3141template <typename T1, typename T2, typename T3>
3242void expect_vec (const T1& x, const T2& lb, const T3& ub) {
@@ -52,11 +62,21 @@ void expect_vec(const T1& x, const T2& lb, const T3& ub) {
5262 }
5363 return stan::math::add (lp, xx_acc);
5464 };
65+ auto f5 = [](const auto & x, const auto & lb, const auto & ub) {
66+ stan::return_type_t <decltype (x), decltype (lb), decltype (ub)> lp = 0 ;
67+ return stan::math::lub_constrain<false >(x, std::make_tuple (lb, ub), lp);
68+ };
69+ auto f6 = [](const auto & x, const auto & lb, const auto & ub) {
70+ stan::return_type_t <decltype (x), decltype (lb), decltype (ub)> lp = 0 ;
71+ return stan::math::lub_constrain<true >(x, std::make_tuple (lb, ub), lp);
72+ };
5573
5674 stan::test::expect_ad (f1, x, lb, ub);
5775 stan::test::expect_ad (f2, x, lb, ub);
5876 stan::test::expect_ad (f3, x, lb, ub);
5977 stan::test::expect_ad (f4, x, lb, ub);
78+ stan::test::expect_ad (f5, x, lb, ub);
79+ stan::test::expect_ad (f6, x, lb, ub);
6080}
6181} // namespace lub_constrain_tests
6282
0 commit comments