Skip to content

Commit c7c7b47

Browse files
authored
only call np.delete with actual removal (#430)
1 parent a9d869e commit c7c7b47

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

control/iosys.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1645,8 +1645,10 @@ def rootfun(z):
16451645
# and were processed above.
16461646

16471647
# Get the states and inputs that were not listed as fixed
1648-
state_vars = np.delete(np.array(range(nstates)), ix)
1649-
input_vars = np.delete(np.array(range(ninputs)), iu)
1648+
state_vars = (range(nstates) if not len(ix)
1649+
else np.delete(np.array(range(nstates)), ix))
1650+
input_vars = (range(ninputs) if not len(iu)
1651+
else np.delete(np.array(range(ninputs)), iu))
16501652

16511653
# Set the outputs and derivs that will serve as constraints
16521654
output_vars = np.array(iy)

0 commit comments

Comments
 (0)