Skip to content

Commit 38f29c7

Browse files
authored
Consistent return values for lqe and lqr (#477)
* update lqe return values to match lqr * update lqe docstring
1 parent 120a926 commit 38f29c7

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

control/statefbk.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -282,19 +282,14 @@ def lqe(A, G, C, QN, RN, NN=None):
282282
283283
A P + P A^T - (P C^T + G N) R^{-1} (C P + N^T G^T) + G Q G^T = 0
284284
285-
E : 2D array (or matrix)
285+
E : 1D array
286286
Eigenvalues of estimator poles eig(A - L C)
287287
288288
Notes
289289
-----
290290
The return type for 2D arrays depends on the default class set for
291291
state space operations. See :func:`~control.use_numpy_matrix`.
292292
293-
The return type for `E` differs from the equivalent return values in the
294-
:func:`~control.lqr`, :func:`~control.care`, and other similar
295-
functions. The return type will be changed to a 1D array in a future
296-
release.
297-
298293
Examples
299294
--------
300295
>>> K, P, E = lqe(A, G, C, QN, RN)
@@ -317,7 +312,7 @@ def lqe(A, G, C, QN, RN, NN=None):
317312
A, G, C = np.array(A, ndmin=2), np.array(G, ndmin=2), np.array(C, ndmin=2)
318313
QN, RN = np.array(QN, ndmin=2), np.array(RN, ndmin=2)
319314
P, E, LT = care(A.T, C.T, np.dot(np.dot(G, QN), G.T), RN)
320-
return _ssmatrix(LT.T), _ssmatrix(P), _ssmatrix(E)
315+
return _ssmatrix(LT.T), _ssmatrix(P), E
321316

322317

323318
# Contributed by Roberto Bucher <roberto.bucher@supsi.ch>

control/tests/statefbk_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ def test_LQR_3args(self):
302302
def check_LQE(self, L, P, poles, G, QN, RN):
303303
P_expected = np.array(np.sqrt(G*QN*G * RN))
304304
L_expected = P_expected / RN
305-
poles_expected = np.array([-L_expected], ndmin=2)
305+
poles_expected = np.array([-L_expected])
306306
np.testing.assert_array_almost_equal(P, P_expected)
307307
np.testing.assert_array_almost_equal(L, L_expected)
308308
np.testing.assert_array_almost_equal(poles, poles_expected)

0 commit comments

Comments
 (0)