Skip to content

Commit c9a2f7e

Browse files
committed
add back resize instead of reserve
1 parent b64957c commit c9a2f7e

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

stan/math/rev/functor/adj_jac_apply.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,8 @@ inline void build_y_adj(vari** y_vi, const std::array<int, size>& M,
3939
template <size_t size>
4040
inline void build_y_adj(vari** y_vi, const std::array<int, size>& M,
4141
std::vector<double>& y_adj) {
42-
y_adj.clear();
43-
y_adj.reserve(M[0]);
44-
for (size_t m = 0; m < M[0]; ++m) {
42+
y_adj.resize(M[0]);
43+
for (size_t m = 0; m < y_adj.size(); ++m) {
4544
y_adj[m] = y_vi[m]->adj_;
4645
}
4746
}

0 commit comments

Comments
 (0)