Skip to content

Commit 31d2d80

Browse files
authored
Add getproperty for Schur to extract Schur factor (#50)
Fixes #48
1 parent 5c39d32 commit 31d2d80

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/eigenGeneral.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ struct Schur{T,S<:StridedMatrix} <: Factorization{T}
6565
R::Rotation
6666
end
6767

68+
function Base.getproperty(F::Schur, s::Symbol)
69+
if s === :T || s === :Schur
70+
return triu(F.data, -1)
71+
else
72+
return getfield(F, s)
73+
end
74+
end
75+
6876
function wilkinson(Hmm, t, d)
6977
λ1 = (t + sqrt(t*t - 4d))/2
7078
λ2 = (t - sqrt(t*t - 4d))/2

test/eigengeneral.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,10 @@ end
4848
@test sort(GenericLinearAlgebra._eigvals!(GenericLinearAlgebra._schur!(copy(A))), by = t -> (real(t), imag(t))) sort(eigvals(A), by = t -> (real(t), imag(t)))
4949
end
5050

51+
@testset "Extract Schur factor" begin
52+
A = randn(5, 5)
53+
@test sum(eigvals(schur(A).T)) sum(eigvals(Float64.(schur(big.(A)).T)))
54+
@test sum(eigvals(schur(A).Schur)) sum(eigvals(Float64.(schur(big.(A)).Schur)))
55+
end
56+
5157
end

0 commit comments

Comments
 (0)