BUG: sorting by imaginary part does not work for real Schur form in scipy.linalg.schur
#15016
Labels
defect
A clear bug or issue that prevents SciPy from being installed or used as expected
scipy.linalg
Describe your issue.
For a 3x3 matrix A I want to find its sorted real Schur form T ((quasi-)upper-triangular matrix) and the corresponding unitary Schur transformation matrix Z. I want the sorting to be done according to a rule defined in the callable kwarg sort such that the complex conjugate eigenvalue pair (if existent) will be placed at the top left of the Schur form. Therefore I use:
This returns
True
if the eigenvalue has (a reasonable) complex component.Schur decomposition can be constructed either in real or in complex form. However, if constructed using
scipy.linalg.schur
in real form, sorting by whether or not the eigenvalue was complex does not work. It will return sdim = 0 which means the sorting criterion did not apply to any of the eigenvalues, even though they are initially complex.LAPACK gees() (which scipy uses (?)) suggests though, that it can order the eigenvalues on the diagonal of the real Schur form so that selected eigenvalues are at the top left. Liu et al. 2018 use the LAPACK dgees() to get the real Schur form sorted in a way so that the real part of the complex conjugate eigenvalue pair appears on the top left of the Schur form.
Is the fact, that in
scipy.linalg.schur
the real Schur form cannot be sorted by thesorting_criterion
by design or by accident?Or am I missing something and this can already be done in
scipy.linalg.schur
too?Example code with my sorting criterion below.
Reproducing Code Example
Error message
SciPy/NumPy/Python version information
1.7.1 1.20.3 sys.version_info(major=3, minor=8, micro=2, releaselevel='final', serial=0)
The text was updated successfully, but these errors were encountered: