Skip to content

Implement ordschur with arbitrary reordering of eigenvalues#1654

Draft
aravindh-krishnamoorthy wants to merge 1 commit into
JuliaLang:masterfrom
aravindh-krishnamoorthy:arbordschur
Draft

Implement ordschur with arbitrary reordering of eigenvalues#1654
aravindh-krishnamoorthy wants to merge 1 commit into
JuliaLang:masterfrom
aravindh-krishnamoorthy:arbordschur

Conversation

@aravindh-krishnamoorthy

@aravindh-krishnamoorthy aravindh-krishnamoorthy commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Potential fix for #1047

function ordschur!(S::LinearAlgebra.Schur, p::AbstractVector{<:Integer})

Code implements the algorithm for arbitrary reordering of eigenvalues along the lines of Daniel Kressner, "Block algorithms for reordering standard and generalized Schur forms," ACM Transactions on Mathematical Software Volume 32 Issue 4 pp 521-532 https://doi.org/10.1145/1186785.1186787

  • First implementation
  • Optimised implementation
  • Documentation
  • Documentation compilation check
  • Unit test
  • Unit test check

@aravindh-krishnamoorthy

Copy link
Copy Markdown
Contributor Author

Optimisation Tracker

(This comment will be continually updated with the current optimisation status)

$1024\times1024$ matrix single reordering: about $3\times$ LAPACK

julia> using LinearAlgebra
julia> using BenchmarkTools
julia> N = 1024;
julia> X = randn(N,N);
julia> S = schur(X);
julia> idx = findlast(x->isreal(x), S.values);
julia> p = circshift(1:N,N-idx+1);
julia> b = falses(N);
julia> b[idx:end] .= true;
julia> S1 = ordschur(S,b);
julia> S2 = ordschur!(copy(S),p);
julia> norm(S1.values - S2.values)
1.5089416132685045e-13
julia> norm(S1.values - S.values)
1096.6594764777658
julia> norm(S1.Z*S1.T*S1.Z' - X)
1.892660374773724e-11
julia> norm(S2.Z*S2.T*S2.Z' - X)
1.8935267963444116e-11
julia> @btime ordschur(S,b);
  5.880 ms (27 allocations: 16.05 MiB)
julia> @btime ordschur!(copy(S),p);
  18.555 ms (6808 allocations: 46.56 MiB)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant