Skip to content

Commit d153aed

Browse files
committed
fix bdschur (see issue #911)
1 parent 56b9402 commit d153aed

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

control/canonical.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -450,9 +450,7 @@ def bdschur(a, condmax=None, sort=None):
450450
aschur, tschur, condmax)
451451

452452
if sort in ('continuous', 'discrete'):
453-
454453
idxs = np.cumsum(np.hstack([0, blksizes[:-1]]))
455-
456454
ev_per_blk = [complex(eigvals[i].real, abs(eigvals[i].imag))
457455
for i in idxs]
458456

@@ -470,7 +468,7 @@ def bdschur(a, condmax=None, sort=None):
470468
permidx = np.hstack([blkidxs[i] for i in sortidx])
471469
rperm = np.eye(amodal.shape[0])[permidx]
472470

473-
tmodal = tmodal @ rperm
471+
tmodal = tmodal @ rperm.T
474472
amodal = rperm @ amodal @ rperm.T
475473
blksizes = blksizes[sortidx]
476474

control/tests/canonical_test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,8 @@ def test_bdschur_sort(eigvals, sorted_blk_eigvals, sort):
287287

288288
b, t, blksizes = bdschur(a, sort=sort)
289289
assert len(blksizes) == len(sorted_blk_eigvals)
290+
np.testing.assert_allclose(a, t @ b @ t.T)
291+
np.testing.assert_allclose(t.T, np.linalg.inv(t))
290292

291293
blocks = extract_bdiag(b, blksizes)
292294
for block, blk_eigval in zip(blocks, sorted_blk_eigvals):

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy