Skip to content

Commit d387fa4

Browse files
committed
enabled some non-slycot testing of dare and care functions in mateqn.py
1 parent 1f04c64 commit d387fa4

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

control/mateqn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,7 @@ def dare(A, B, Q, R=None, S=None, E=None, stabilizing=True):
824824
X = solve_discrete_are(A, B, Qmat, Rmat, E, S)
825825
if S is None:
826826
S = zeros((nstates, ninputs))
827-
G = solve(B.T.dot(X).dot(B) + Rmat, B.T.dot(X).dot(A))
827+
G = solve(B.T.dot(X).dot(B) + Rmat, B.T.dot(X).dot(A) + S.T)
828828
L = eigvals(A - B.dot(G), E)
829829
return _ssmatrix(X), L, _ssmatrix(G)
830830

control/tests/mateqn_test.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@
4343
from control.tests.conftest import slycotonly
4444

4545

46-
@slycotonly
4746
class TestMatrixEquations:
4847
"""These are tests for the matrix equation solvers in mateqn.py"""
4948

49+
@slycotonly
5050
def test_lyap(self):
5151
A = array([[-1, 1],[-1, 0]])
5252
Q = array([[1,0],[0,1]])
@@ -60,6 +60,7 @@ def test_lyap(self):
6060
# print("The solution obtained is ", X)
6161
assert_array_almost_equal(A.dot(X) + X.dot(A.T) + Q, zeros((2,2)))
6262

63+
@slycotonly
6364
def test_lyap_sylvester(self):
6465
A = 5
6566
B = array([[4, 3], [4, 3]])
@@ -75,6 +76,7 @@ def test_lyap_sylvester(self):
7576
# print("The solution obtained is ", X)
7677
assert_array_almost_equal(A.dot(X) + X.dot(B) + C, zeros((2,2)))
7778

79+
@slycotonly
7880
def test_lyap_g(self):
7981
A = array([[-1, 2],[-3, -4]])
8082
Q = array([[3, 1],[1, 1]])
@@ -84,6 +86,7 @@ def test_lyap_g(self):
8486
assert_array_almost_equal(A.dot(X).dot(E.T) + E.dot(X).dot(A.T) + Q,
8587
zeros((2,2)))
8688

89+
@slycotonly
8790
def test_dlyap(self):
8891
A = array([[-0.6, 0],[-0.1, -0.4]])
8992
Q = array([[1,0],[0,1]])
@@ -97,6 +100,7 @@ def test_dlyap(self):
97100
# print("The solution obtained is ", X)
98101
assert_array_almost_equal(A.dot(X).dot(A.T) - X + Q, zeros((2,2)))
99102

103+
@slycotonly
100104
def test_dlyap_g(self):
101105
A = array([[-0.6, 0],[-0.1, -0.4]])
102106
Q = array([[3, 1],[1, 1]])
@@ -106,6 +110,7 @@ def test_dlyap_g(self):
106110
assert_array_almost_equal(A.dot(X).dot(A.T) - E.dot(X).dot(E.T) + Q,
107111
zeros((2,2)))
108112

113+
@slycotonly
109114
def test_dlyap_sylvester(self):
110115
A = 5
111116
B = array([[4, 3], [4, 3]])
@@ -242,6 +247,7 @@ def test_dare_g2(self):
242247
lam = eigvals(A - B.dot(G), E)
243248
assert_array_less(abs(lam), 1.0)
244249

250+
@slycotonly
245251
def test_raise(self):
246252
""" Test exception raise for invalid inputs """
247253

0 commit comments

Comments
 (0)