Skip to content

Commit a68ad6c

Browse files
committed
BugFix: pole of stateless StateSpace object is empty array
1 parent 4efc318 commit a68ad6c

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

control/statesp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ def freqresp(self, omega):
399399
def pole(self):
400400
"""Compute the poles of a state space system."""
401401

402-
return eigvals(self.A)
402+
return eigvals(self.A) if self.states else np.array([])
403403

404404
def zero(self):
405405
"""Compute the zeros of a state space system."""

control/tests/statesp_test.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,12 @@ def testPole(self):
377377
self.assertTrue(abs(z) < 1)
378378

379379

380+
def testPoleStatic(self):
381+
"""Regression: pole() of static gain is empty array"""
382+
np.testing.assert_array_equal(np.array([]),
383+
StateSpace([],[],[],[[1]]).pole())
384+
385+
380386
def suite():
381387
return unittest.TestLoader().loadTestsFromTestCase(TestStateSpace)
382388

0 commit comments

Comments
 (0)