Skip to content

Commit d32bcdd

Browse files
committed
Test algorithms for Schur too
1 parent 2e8052b commit d32bcdd

3 files changed

Lines changed: 61 additions & 2 deletions

File tree

src/yalapack.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,7 +1423,7 @@ for (gees, geesx, geev, geevx, ggev, elty, celty, relty) in
14231423
(:zgees_, :zgeesx_, :zgeev_, :zgeevx_, :zggev_, :ComplexF64, :ComplexF64, :Float64),
14241424
)
14251425
@eval begin
1426-
#=function gees!(
1426+
function gees!(
14271427
A::AbstractMatrix{$elty},
14281428
V::AbstractMatrix{$elty} = similar(A),
14291429
vals::AbstractVector{$celty} = similar(A, $celty, size(A, 1))
@@ -1501,7 +1501,7 @@ for (gees, geesx, geev, geevx, ggev, elty, celty, relty) in
15011501
_reorder_realeigendecomposition!(vals, valsR, valsI, work, V, 'N')
15021502
end
15031503
return A, V, vals
1504-
end=#
1504+
end
15051505
function geesx!(
15061506
A::AbstractMatrix{$elty},
15071507
V::AbstractMatrix{$elty} = similar(A),

test/schur.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ for T in (BLASFloats..., GenericFloats...)
2727
end
2828
if !is_buildkite
2929
TestSuite.test_schur(T, (m, m))
30+
if T BLASFloats
31+
LAPACK_SCHUR_ALGS = (LAPACK_Simple(), LAPACK_Expert())
32+
TestSuite.test_schur_algs(T, (m, m), LAPACK_SCHUR_ALGS)
33+
end
3034
#AT = Diagonal{T, Vector{T}}
3135
#TestSuite.test_schur(AT, m) # not supported yet
3236
end

test/testsuite/decompositions/schur.jl

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ function test_schur(T::Type, sz; kwargs...)
99
end
1010
end
1111

12+
function test_schur_algs(T::Type, sz, algs; kwargs...)
13+
summary_str = testargs_summary(T, sz)
14+
return @testset "schur algorithms $summary_str" begin
15+
test_schur_full_algs(T, sz, algs; kwargs...)
16+
test_schur_vals_algs(T, sz, algs; kwargs...)
17+
end
18+
end
19+
1220
function test_schur_full(
1321
T::Type, sz;
1422
atol::Real = 0, rtol::Real = precision(T),
@@ -34,6 +42,31 @@ function test_schur_full(
3442
end
3543
end
3644

45+
function test_schur_full_algs(
46+
T::Type, sz, algs;
47+
atol::Real = 0, rtol::Real = precision(T),
48+
kwargs...
49+
)
50+
summary_str = testargs_summary(T, sz)
51+
return @testset "schur_full! algorithm $alg $summary_str" for alg in algs
52+
A = instantiate_matrix(T, sz)
53+
Ac = deepcopy(A)
54+
Tc = isa(A, Diagonal) ? eltype(T) : complex(eltype(T))
55+
56+
TA, Z, vals = @testinferred schur_full(A; alg)
57+
@test eltype(TA) == eltype(Z) == eltype(T)
58+
@test eltype(vals) == Tc
59+
@test isisometric(Z)
60+
@test A * Z Z * TA
61+
62+
TA2, Z2, vals2 = @testinferred schur_full!(Ac, (TA, Z, vals); alg)
63+
@test TA2 === TA
64+
@test Z2 === Z
65+
@test vals2 === vals
66+
@test A * Z Z * TA
67+
end
68+
end
69+
3770
function test_schur_vals(
3871
T::Type, sz;
3972
atol::Real = 0, rtol::Real = precision(T),
@@ -55,3 +88,25 @@ function test_schur_vals(
5588
@test valsc eig_vals(A)
5689
end
5790
end
91+
92+
function test_schur_vals_algs(
93+
T::Type, sz, algs;
94+
atol::Real = 0, rtol::Real = precision(T),
95+
kwargs...
96+
)
97+
summary_str = testargs_summary(T, sz)
98+
return @testset "schur_vals! algorithm $alg $summary_str" for alg in algs
99+
A = instantiate_matrix(T, sz)
100+
Ac = deepcopy(A)
101+
Tc = isa(A, Diagonal) ? eltype(T) : complex(eltype(T))
102+
103+
valsc = @testinferred schur_vals(A; alg)
104+
@test eltype(valsc) == Tc
105+
@test valsc eig_vals(A)
106+
107+
valsc = similar(A, Tc, size(A, 1))
108+
valsc = @testinferred schur_vals!(Ac, valsc; alg)
109+
@test eltype(valsc) == Tc
110+
@test valsc eig_vals(A)
111+
end
112+
end

0 commit comments

Comments
 (0)