diff --git a/stan/math/prim/prob/wiener5_lpdf.hpp b/stan/math/prim/prob/wiener5_lpdf.hpp index 7799d53b6c1..1447a0f1653 100644 --- a/stan/math/prim/prob/wiener5_lpdf.hpp +++ b/stan/math/prim/prob/wiener5_lpdf.hpp @@ -679,12 +679,12 @@ inline auto wiener_lpdf(const T_y& y, const T_a& a, const T_t0& t0, if (!include_summand::value) { return ret_t(0.0); } - 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_sv_ref = ref_type_if_t::value, T_sv>; + 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 T_sv_ref = ref_type_t; static constexpr const char* function_name = "wiener5_lpdf"; @@ -725,12 +725,12 @@ inline auto wiener_lpdf(const T_y& y, const T_a& a, const T_t0& t0, return ret_t(0.0); } - scalar_seq_view y_vec(y_val); - scalar_seq_view a_vec(a_val); - scalar_seq_view v_vec(v_val); - scalar_seq_view w_vec(w_val); - scalar_seq_view t0_vec(t0_val); - scalar_seq_view sv_vec(sv_val); + scalar_seq_view y_vec(y_ref); + scalar_seq_view a_vec(a_ref); + scalar_seq_view t0_vec(t0_ref); + scalar_seq_view w_vec(w_ref); + scalar_seq_view v_vec(v_ref); + scalar_seq_view sv_vec(sv_ref); const size_t N_y_t0 = max_size(y, t0); for (size_t i = 0; i < N_y_t0; ++i) { diff --git a/stan/math/prim/prob/wiener_full_lpdf.hpp b/stan/math/prim/prob/wiener_full_lpdf.hpp index 340b3019fbb..20c925945c2 100644 --- a/stan/math/prim/prob/wiener_full_lpdf.hpp +++ b/stan/math/prim/prob/wiener_full_lpdf.hpp @@ -327,14 +327,14 @@ inline auto wiener_lpdf(const T_y& y, const T_a& a, const T_t0& t0, return ret_t(0); } - 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 T_partials_return = partials_return_t; @@ -385,14 +385,14 @@ inline auto wiener_lpdf(const T_y& y, const T_a& a, const T_t0& t0, if (N == 0) { return ret_t(0); } - scalar_seq_view y_vec(y_val); - scalar_seq_view a_vec(a_val); - scalar_seq_view v_vec(v_val); - scalar_seq_view w_vec(w_val); - scalar_seq_view t0_vec(t0_val); - scalar_seq_view sv_vec(sv_val); - scalar_seq_view sw_vec(sw_val); - scalar_seq_view st0_vec(st0_val); + scalar_seq_view y_vec(y_ref); + scalar_seq_view a_vec(a_ref); + scalar_seq_view v_vec(v_ref); + scalar_seq_view w_vec(w_ref); + scalar_seq_view t0_vec(t0_ref); + scalar_seq_view sv_vec(sv_ref); + scalar_seq_view sw_vec(sw_ref); + scalar_seq_view st0_vec(st0_ref); const size_t N_y_t0 = max_size(y, t0, st0); for (size_t i = 0; i < N_y_t0; ++i) { @@ -449,6 +449,9 @@ inline auto wiener_lpdf(const T_y& y, const T_a& a, const T_t0& t0, // calculate density and partials for (size_t i = 0; i < N; i++) { if (sw_vec[i] == 0 && st0_vec[i] == 0) { + // note: because we're delegating to wiener5_lpdf, + // we need to make sure is_constant is consistent between + // our inputs and these result += wiener_lpdf(y_vec[i], a_vec[i], t0_vec[i], w_vec[i], v_vec[i], sv_vec[i], precision_derivatives); continue;