@@ -9,6 +9,14 @@ function test_schur(T::Type, sz; kwargs...)
99 end
1010end
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+
1220function 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
3543end
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+
3770function 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
5790end
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