Skip to content

Commit

Permalink
Additional simplification
Browse files Browse the repository at this point in the history
  • Loading branch information
andrjohns committed Oct 9, 2023
1 parent e769630 commit a054665
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions stan/math/prim/fun/grad_pFq.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ auto grad_pFq(const TpFq& pfq_val, const Ta& a, const Tb& b, const Tz& z,
std::tuple<promote_scalar_t<T_Rtn, plain_type_t<Ta>>,
promote_scalar_t<T_Rtn, plain_type_t<Tb>>, T_Rtn>
ret_tuple;
std::get<0>(ret_tuple).setConstant(a.size(), 0.0);
std::get<1>(ret_tuple).setConstant(b.size(), 0.0);
std::get<0>(ret_tuple).setConstant(a.size(), -pfq_val);
std::get<1>(ret_tuple).setConstant(b.size(), pfq_val);
std::get<2>(ret_tuple) = 0.0;

if (CalcA || CalcB) {
Expand Down Expand Up @@ -152,13 +152,6 @@ auto grad_pFq(const TpFq& pfq_val, const Ta& a, const Tb& b, const Tz& z,
b_k += 1.0;
k += 1;
}

if (CalcA) {
std::get<0>(ret_tuple).array() -= pfq_val;
}
if (CalcB) {
std::get<1>(ret_tuple).array() += pfq_val;
}
}
if (CalcZ) {
T_Rtn pfq_p1_val
Expand Down

0 comments on commit a054665

Please sign in to comment.