Skip to content

Commit fd1e84e

Browse files
committed
Fixed some indexing in test_ad_matvar (Issue #2245)
1 parent 57ae03f commit fd1e84e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/unit/math/test_ad.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1579,8 +1579,8 @@ inline void test_matvar_gradient(const ad_tolerances& tols,
15791579
const MatVar& A_mv, const VarMat& A_vm) {
15801580
for (Eigen::Index i = 0; i < A_vm_f.size(); ++i) {
15811581
for (Eigen::Index j = 0; j < A_mv_f.size(); ++j) {
1582-
A_vm_f.adj()(i) = 1;
1583-
A_mv_f.adj()(i) = 1;
1582+
A_vm_f.adj()(i, j) = 1;
1583+
A_mv_f.adj()(i, j) = 1;
15841584
stan::math::grad();
15851585
expect_near_rel_var("var<Matrix> vs Matrix<var> input", A_vm, A_mv, tols);
15861586
stan::math::set_zero_all_adjoints();

0 commit comments

Comments
 (0)