Triangular Schur decomposition for a matrix with complex eigenvalues?

Is it possible to compute a (strictly) triangular Schur decomposition for a matrix with complex eigenvalues?

With the code below I create such a matrix:

T = rand(2,2)
λ = rand() + rand()*im
D = [real(λ) imag(λ); -imag(λ) real(λ)]
A = T*D/T

schur then returns a quasitriangular decomposition. In my case of a 2x2 matrix with complex eigenvalues:

S,U,Λ = schur(A)
Schur{Float64,Array{Float64,2}}
T factor:
2×2 Array{Float64,2}:
 0.921219  -0.0444826
 4.41202    0.921219 
Z factor:
2×2 Array{Float64,2}:
  0.774798  0.632209
 -0.632209  0.774798
eigenvalues:
2-element Array{Complex{Float64},1}:
 0.9212193623156234 + 0.44301030411320136im
 0.9212193623156234 - 0.44301030411320136im

Yes. Do schur(complex(A)).

It would be nice to have a function to get this directly from the quasitriangular decomposition, since that would probably be faster (taking advantage of A being real for most of the computation), but I don’t think that is implemented? (Should be very straightforward to implement since you just need the Schur decompositions of a bunch of 2x2 blocks.)

1 Like

Many thanks. Exactly what I needed.

The conversion is implemented as triangularize in the GenericSchur package.

2 Likes

We might want to move that into the LinearAlgebra stdlib, because some of the matrix-function calculations in LinearAlgebra already need the triangular Schur form and resort to the expensive schur(complex(A)) method to get it IIRC.

1 Like

Update: there is a now a PR https://github.com/JuliaLang/julia/pull/40573