Implement ordschur with arbitrary reordering of eigenvalues#1654
Draft
aravindh-krishnamoorthy wants to merge 1 commit into
Draft
Implement ordschur with arbitrary reordering of eigenvalues#1654aravindh-krishnamoorthy wants to merge 1 commit into
ordschur with arbitrary reordering of eigenvalues#1654aravindh-krishnamoorthy wants to merge 1 commit into
Conversation
Contributor
Author
Optimisation Tracker(This comment will be continually updated with the current optimisation status) 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Potential fix for #1047
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