diff --git a/stan/math/prim/prob/wiener4_lccdf_defective.hpp b/stan/math/prim/prob/wiener4_lccdf_defective.hpp index dd907a8bc00..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); } @@ -226,14 +226,14 @@ 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>; - 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 747f072c08b..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; @@ -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..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; @@ -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< diff --git a/test/sig_utils.py b/test/sig_utils.py index 2018f6e4809..deb26fa1482 100644 --- a/test/sig_utils.py +++ b/test/sig_utils.py @@ -145,7 +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], + "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 @@ -180,6 +182,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