Skip to content

Commit 21df7dd

Browse files
authored
early return after Jqvel contribution (google-deepmind#1244)
1 parent b1c6c88 commit 21df7dd

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

mujoco_warp/_src/constraint.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1878,11 +1878,11 @@ def _contact_pyramidal(
18781878
efc_J_colind_out[worldid, 0, sparseid] = dofid
18791879
efc_J_out[worldid, 0, sparseid] = J
18801880
nnz += 1
1881-
if nnz >= rownnz:
1882-
break
18831881
else:
18841882
efc_J_out[worldid, efcid, dofid] = J
18851883
Jqvel += J * qvel_in[worldid, dofid]
1884+
if is_sparse and nnz >= rownnz:
1885+
break
18861886

18871887
# Advance tree pointers and recompute da for next iteration
18881888
if da1 == da:
@@ -2124,11 +2124,11 @@ def _contact_elliptic(
21242124
efc_J_colind_out[worldid, 0, sparseid] = dofid
21252125
efc_J_out[worldid, 0, sparseid] = J
21262126
nnz += 1
2127-
if nnz >= rownnz:
2128-
break
21292127
else:
21302128
efc_J_out[worldid, efcid, dofid] = J
21312129
Jqvel += J * qvel_in[worldid, dofid]
2130+
if is_sparse and nnz >= rownnz:
2131+
break
21322132

21332133
# Advance tree pointers and recompute da for next iteration
21342134
if da1 == da:

0 commit comments

Comments
 (0)