From 883b5f9c789f74aa748e18306b6254592a4e9387 Mon Sep 17 00:00:00 2001 From: Brian Ward Date: Thu, 11 Dec 2025 15:37:36 -0500 Subject: [PATCH 1/7] Update sig_utils.py --- test/sig_utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/sig_utils.py b/test/sig_utils.py index 2018f6e4809..2de365dee4f 100644 --- a/test/sig_utils.py +++ b/test/sig_utils.py @@ -145,7 +145,7 @@ def get_cpp_type(stan_type): "uniform_lcdf": [None, 0.2, 0.9], "uniform_lpdf": [None, 0.2, 0.9], "uniform_rng": [0.2, 1.9, None], - "wiener_lpdf": [0.8, None, 0.4, None, None, None, None, None], + "wiener_lpdf": [0.8, None, 0.4, None, None, None, None, None, 1e-4], } # list of functions we do not test. These are mainly functions implemented in compiler @@ -180,6 +180,9 @@ def get_cpp_type(stan_type): "ode_adams_tol": [4, 5, 6], "ode_bdf_tol": [4, 5, 6], "ode_rk45_tol": [4, 5, 6], + "wiener_lpdf": [6, 8], + "wiener_lccdf_defective": [5, 8], + "wiener_lcdf_defective": [5, 8], } # lists of functions that do not support fwd or rev autodiff From 02e180f7aaeba187f1a49c3eb65e055396f332c9 Mon Sep 17 00:00:00 2001 From: Brian Ward Date: Thu, 11 Dec 2025 16:19:30 -0500 Subject: [PATCH 2/7] missing default --- stan/math/prim/prob/wiener4_lccdf_defective.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stan/math/prim/prob/wiener4_lccdf_defective.hpp b/stan/math/prim/prob/wiener4_lccdf_defective.hpp index dd907a8bc00..d4451f1a390 100644 --- a/stan/math/prim/prob/wiener4_lccdf_defective.hpp +++ b/stan/math/prim/prob/wiener4_lccdf_defective.hpp @@ -226,7 +226,7 @@ template inline auto wiener_lccdf_defective(const T_y& y, const T_a& a, const T_t0& t0, const T_w& w, const T_v& v, - const double& precision_derivatives) { + const double& precision_derivatives = 1e-4) { using T_partials_return = partials_return_t; using ret_t = return_type_t; using T_y_ref = ref_type_if_t::value, T_y>; From ecb1910a10960f83926b67b72d4a1564f0b80776 Mon Sep 17 00:00:00 2001 From: Brian Ward Date: Thu, 11 Dec 2025 16:34:23 -0500 Subject: [PATCH 3/7] More sig utils --- test/sig_utils.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/sig_utils.py b/test/sig_utils.py index 2de365dee4f..e24e28a3ba7 100644 --- a/test/sig_utils.py +++ b/test/sig_utils.py @@ -146,6 +146,8 @@ def get_cpp_type(stan_type): "uniform_lpdf": [None, 0.2, 0.9], "uniform_rng": [0.2, 1.9, None], "wiener_lpdf": [0.8, None, 0.4, None, None, None, None, None, 1e-4], + "wiener_lccdf_defective": [0.8, None, 0.4, None, None, None, None, 1e-4], + "wiener_lcdf_defective": [0.8, None, 0.4, None, None, None, None, 1e-4], } # list of functions we do not test. These are mainly functions implemented in compiler From c215f98df4c6bc115d6a757d4eabfa80f3f4f61e Mon Sep 17 00:00:00 2001 From: Brian Ward Date: Thu, 11 Dec 2025 16:38:14 -0500 Subject: [PATCH 4/7] More sig utils --- test/sig_utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/sig_utils.py b/test/sig_utils.py index e24e28a3ba7..deb26fa1482 100644 --- a/test/sig_utils.py +++ b/test/sig_utils.py @@ -145,9 +145,9 @@ def get_cpp_type(stan_type): "uniform_lcdf": [None, 0.2, 0.9], "uniform_lpdf": [None, 0.2, 0.9], "uniform_rng": [0.2, 1.9, None], - "wiener_lpdf": [0.8, None, 0.4, None, None, None, None, None, 1e-4], - "wiener_lccdf_defective": [0.8, None, 0.4, None, None, None, None, 1e-4], - "wiener_lcdf_defective": [0.8, None, 0.4, None, None, None, None, 1e-4], + "wiener_lpdf": [0.8, None, 0.4, None, None, None, None, None, 1e-4], + "wiener_lccdf_defective": [0.8, None, 0.4, None, None, None, None, None, 1e-4], + "wiener_lcdf_defective": [0.8, None, 0.4, None, None, None, None, None, 1e-4], } # list of functions we do not test. These are mainly functions implemented in compiler From 80bfa2af9f96a67dcb6daf5d5410220a3ef9e6ab Mon Sep 17 00:00:00 2001 From: Brian Ward Date: Fri, 12 Dec 2025 10:32:28 -0500 Subject: [PATCH 5/7] remove unused values --- stan/math/prim/prob/wiener_full_lccdf_defective.hpp | 4 +--- stan/math/prim/prob/wiener_full_lcdf_defective.hpp | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/stan/math/prim/prob/wiener_full_lccdf_defective.hpp b/stan/math/prim/prob/wiener_full_lccdf_defective.hpp index 747f072c08b..65a70ca597b 100644 --- a/stan/math/prim/prob/wiener_full_lccdf_defective.hpp +++ b/stan/math/prim/prob/wiener_full_lccdf_defective.hpp @@ -267,9 +267,7 @@ inline auto wiener_lccdf_defective(const T_y& y, const T_a& a, const T_t0& t0, // computation of derivative for t and precision check in order to give // the value as deriv_t to edge1 and as -deriv_t to edge5 - const auto params_dt7 = std::make_tuple( - y_value, a_value, v_value, w_value, t0_value, sv_value, sw_value, - st0_value, log_error_absolute - LOG_TWO - 9 * LOG_TWO); + // computation of derivatives and precision checks if (!is_constant_all::value || !is_constant_all::value) { const T_partials_return deriv_t_7 diff --git a/stan/math/prim/prob/wiener_full_lcdf_defective.hpp b/stan/math/prim/prob/wiener_full_lcdf_defective.hpp index a75a0200021..3d872d11b4d 100644 --- a/stan/math/prim/prob/wiener_full_lcdf_defective.hpp +++ b/stan/math/prim/prob/wiener_full_lcdf_defective.hpp @@ -445,9 +445,7 @@ inline auto wiener_lcdf_defective(const T_y& y, const T_a& a, const T_t0& t0, // computation of derivative for t and precision check in order to give // the value as deriv_t to edge1 and as -deriv_t to edge5 - const auto params_dt7 = std::make_tuple( - y_value, a_value, v_value, w_value, t0_value, sv_value, sw_value, - st0_value, log_error_absolute - LOG_TWO - 9 * LOG_TWO); + if (!is_constant_all::value || !is_constant_all::value) { T_partials_return deriv_t_7 = internal::wiener7_integrate_cdf< From b0b3008f56e1d949b2012054c8f09a092f7cf62b Mon Sep 17 00:00:00 2001 From: Brian Ward Date: Fri, 12 Dec 2025 10:40:12 -0500 Subject: [PATCH 6/7] Fix double expression template evaluation --- stan/math/prim/prob/wiener4_lccdf_defective.hpp | 10 +++++----- stan/math/prim/prob/wiener4_lcdf_defective.hpp | 10 +++++----- .../prim/prob/wiener_full_lccdf_defective.hpp | 16 ++++++++-------- .../prim/prob/wiener_full_lcdf_defective.hpp | 16 ++++++++-------- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/stan/math/prim/prob/wiener4_lccdf_defective.hpp b/stan/math/prim/prob/wiener4_lccdf_defective.hpp index d4451f1a390..e8f76edde5d 100644 --- a/stan/math/prim/prob/wiener4_lccdf_defective.hpp +++ b/stan/math/prim/prob/wiener4_lccdf_defective.hpp @@ -229,11 +229,11 @@ inline auto wiener_lccdf_defective(const T_y& y, const T_a& a, const T_t0& t0, const double& precision_derivatives = 1e-4) { using T_partials_return = partials_return_t; using ret_t = return_type_t; - using T_y_ref = ref_type_if_t::value, T_y>; - using T_a_ref = ref_type_if_t::value, T_a>; - using T_t0_ref = ref_type_if_t::value, T_t0>; - using T_w_ref = ref_type_if_t::value, T_w>; - using T_v_ref = ref_type_if_t::value, T_v>; + using T_y_ref = ref_type_t; + using T_a_ref = ref_type_t; + using T_t0_ref = ref_type_t; + using T_w_ref = ref_type_t; + using T_v_ref = ref_type_t; using internal::GradientCalc; T_y_ref y_ref = y; diff --git a/stan/math/prim/prob/wiener4_lcdf_defective.hpp b/stan/math/prim/prob/wiener4_lcdf_defective.hpp index 150f05bfd36..2142930475e 100644 --- a/stan/math/prim/prob/wiener4_lcdf_defective.hpp +++ b/stan/math/prim/prob/wiener4_lcdf_defective.hpp @@ -590,11 +590,11 @@ inline auto wiener_lcdf_defective(const T_y& y, const T_a& a, const T_t0& t0, const T_w& w, const T_v& v, const double& precision_derivatives = 1e-4) { using T_partials_return = partials_return_t; - using T_y_ref = ref_type_if_t::value, T_y>; - using T_a_ref = ref_type_if_t::value, T_a>; - using T_t0_ref = ref_type_if_t::value, T_t0>; - using T_w_ref = ref_type_if_t::value, T_w>; - using T_v_ref = ref_type_if_t::value, T_v>; + using T_y_ref = ref_type_t; + using T_a_ref = ref_type_t; + using T_t0_ref = ref_type_t; + using T_w_ref = ref_type_t; + using T_v_ref = ref_type_t; using internal::GradientCalc; using ret_t = return_type_t; diff --git a/stan/math/prim/prob/wiener_full_lccdf_defective.hpp b/stan/math/prim/prob/wiener_full_lccdf_defective.hpp index 65a70ca597b..502322ef1bb 100644 --- a/stan/math/prim/prob/wiener_full_lccdf_defective.hpp +++ b/stan/math/prim/prob/wiener_full_lccdf_defective.hpp @@ -89,14 +89,14 @@ inline auto wiener_lccdf_defective(const T_y& y, const T_a& a, const T_t0& t0, const T_sw& sw, const T_st0& st0, const double& precision_derivatives = 1e-8) { using ret_t = return_type_t; - using T_y_ref = ref_type_if_t::value, T_y>; - using T_a_ref = ref_type_if_t::value, T_a>; - using T_v_ref = ref_type_if_t::value, T_v>; - using T_w_ref = ref_type_if_t::value, T_w>; - using T_t0_ref = ref_type_if_t::value, T_t0>; - using T_sv_ref = ref_type_if_t::value, T_sv>; - using T_sw_ref = ref_type_if_t::value, T_sw>; - using T_st0_ref = ref_type_if_t::value, T_st0>; + using T_y_ref = ref_type_t; + using T_a_ref = ref_type_t; + using T_v_ref = ref_type_t; + using T_w_ref = ref_type_t; + using T_t0_ref = ref_type_t; + using T_sv_ref = ref_type_t; + using T_sw_ref = ref_type_t; + using T_st0_ref = ref_type_t; using internal::GradientCalc; using T_partials_return = partials_return_t; diff --git a/stan/math/prim/prob/wiener_full_lcdf_defective.hpp b/stan/math/prim/prob/wiener_full_lcdf_defective.hpp index 3d872d11b4d..aa52cd11314 100644 --- a/stan/math/prim/prob/wiener_full_lcdf_defective.hpp +++ b/stan/math/prim/prob/wiener_full_lcdf_defective.hpp @@ -265,14 +265,14 @@ inline auto wiener_lcdf_defective(const T_y& y, const T_a& a, const T_t0& t0, const T_sw& sw, const T_st0& st0, const double& precision_derivatives = 1e-8) { using ret_t = return_type_t; - using T_y_ref = ref_type_if_t::value, T_y>; - using T_a_ref = ref_type_if_t::value, T_a>; - using T_v_ref = ref_type_if_t::value, T_v>; - using T_w_ref = ref_type_if_t::value, T_w>; - using T_t0_ref = ref_type_if_t::value, T_t0>; - using T_sv_ref = ref_type_if_t::value, T_sv>; - using T_sw_ref = ref_type_if_t::value, T_sw>; - using T_st0_ref = ref_type_if_t::value, T_st0>; + using T_y_ref = ref_type_t; + using T_a_ref = ref_type_t; + using T_v_ref = ref_type_t; + using T_w_ref = ref_type_t; + using T_t0_ref = ref_type_t; + using T_sv_ref = ref_type_t; + using T_sw_ref = ref_type_t; + using T_st0_ref = ref_type_t; using internal::GradientCalc; using T_partials_return = partials_return_t; From 3d7f67c8b5d5762e0c44660029a722225a011c14 Mon Sep 17 00:00:00 2001 From: Brian Ward Date: Fri, 12 Dec 2025 12:50:53 -0500 Subject: [PATCH 7/7] silence use-before-init variable warning --- stan/math/prim/prob/wiener4_lccdf_defective.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stan/math/prim/prob/wiener4_lccdf_defective.hpp b/stan/math/prim/prob/wiener4_lccdf_defective.hpp index e8f76edde5d..953807de075 100644 --- a/stan/math/prim/prob/wiener4_lccdf_defective.hpp +++ b/stan/math/prim/prob/wiener4_lccdf_defective.hpp @@ -75,7 +75,7 @@ inline auto wiener_prob_derivative_term(const T_a& a, const T_v& v, if (neg_v < 0) { ans = LOG_TWO + exponent_with_1mw - log1m_exp(exponent_with_1mw); diff_term = log1m_exp(exponent_with_w) - log1m_exp(exponent); - } else if (neg_v > 0) { + } else /* neg_v > 0 */ { ans = LOG_TWO - log1m_exp(exponent_with_1mw); diff_term = log_diff_exp(exponent_with_1mw, exponent) - log1m_exp(exponent); }