Skip to content

Commit c84debb

Browse files
committed
BugFix: pole of stateless StateSpace object is empty array
1 parent 09f9bab commit c84debb

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
@@ -378,6 +378,12 @@ def testPole(self):
378378
self.assertTrue(abs(z) < 1)
379379

380380

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

0 commit comments

Comments
 (0)