diff --git a/src/yalapack.jl b/src/yalapack.jl index 576fe3c5..25be9d80 100644 --- a/src/yalapack.jl +++ b/src/yalapack.jl @@ -99,7 +99,7 @@ for (geqr, gelq, geqrf, gelqf, geqlf, gerqf, geqrt, gelqt, latsqr, laswlq, geqp3 #! format: on @eval begin # Flexible QR / LQ - function geqr!(A::AbstractMatrix{$elty}) + #=function geqr!(A::AbstractMatrix{$elty}) require_one_based_indexing(A) chkstride1(A) m, n = size(A) @@ -162,7 +162,7 @@ for (geqr, gelq, geqrf, gelqf, geqlf, gerqf, geqrt, gelqt, latsqr, laswlq, geqp3 end end return A, t - end + end=# # Classic QR / LQ / QL / RQ function geqrf!( @@ -231,7 +231,7 @@ for (geqr, gelq, geqrf, gelqf, geqlf, gerqf, geqrt, gelqt, latsqr, laswlq, geqp3 end return A, tau end - function geqlf!( + #=function geqlf!( A::AbstractMatrix{$elty}, tau::AbstractVector{$elty} = similar(A, $elty, min(size(A)...)) ) @@ -296,7 +296,7 @@ for (geqr, gelq, geqrf, gelqf, geqlf, gerqf, geqrt, gelqt, latsqr, laswlq, geqp3 end end return A, tau - end + end=# # QR and LQ with block reflectors #! format: off @@ -441,7 +441,7 @@ for (gemqr, gemlq, ungqr, unglq, ungql, ungrq, unmqr, unmlq, unmql, unmrq, gemqr #! format: on @eval begin # multiply with Q factor of flexible QR / LQ - function gemqr!( + #=function gemqr!( side::AbstractChar, trans::AbstractChar, A::AbstractMatrix{$elty}, T::AbstractVector{$elty}, C::AbstractVecOrMat{$elty} ) @@ -544,7 +544,7 @@ for (gemqr, gemlq, ungqr, unglq, ungql, ungrq, unmqr, unmlq, unmql, unmrq, gemqr end end return C - end + end=# # Build Q factor of classic QR / LQ / QL / RQ in the space of `A` function ungqr!(A::AbstractMatrix{$elty}, tau::AbstractVector{$elty}) @@ -615,7 +615,7 @@ for (gemqr, gemlq, ungqr, unglq, ungql, ungrq, unmqr, unmlq, unmql, unmrq, gemqr end return A end - function ungql!(A::AbstractMatrix{$elty}, tau::AbstractVector{$elty}) + #=function ungql!(A::AbstractMatrix{$elty}, tau::AbstractVector{$elty}) require_one_based_indexing(A, tau) chkstride1(A, tau) m, n = size(A) @@ -682,7 +682,7 @@ for (gemqr, gemlq, ungqr, unglq, ungql, ungrq, unmqr, unmlq, unmql, unmrq, gemqr end end return A - end + end=# # multiply with Q factor of classic QR / LQ / QL / RQ function unmqr!( @@ -781,7 +781,7 @@ for (gemqr, gemlq, ungqr, unglq, ungql, ungrq, unmqr, unmlq, unmql, unmrq, gemqr end return C end - function unmql!( + #=function unmql!( side::AbstractChar, trans::AbstractChar, A::AbstractMatrix{$elty}, tau::AbstractVector{$elty}, C::AbstractVecOrMat{$elty} @@ -876,7 +876,7 @@ for (gemqr, gemlq, ungqr, unglq, ungql, ungrq, unmqr, unmlq, unmql, unmrq, gemqr end end return C - end + end=# # Multiply with blocked Q factor from QR / LQ function gemqrt!( diff --git a/test/schur.jl b/test/schur.jl index d306e3d8..6bb5a1ae 100644 --- a/test/schur.jl +++ b/test/schur.jl @@ -27,6 +27,10 @@ for T in (BLASFloats..., GenericFloats...) end if !is_buildkite TestSuite.test_schur(T, (m, m)) + if T ∈ BLASFloats + LAPACK_SCHUR_ALGS = (LAPACK_Simple(), LAPACK_Expert()) + TestSuite.test_schur_algs(T, (m, m), LAPACK_SCHUR_ALGS) + end #AT = Diagonal{T, Vector{T}} #TestSuite.test_schur(AT, m) # not supported yet end diff --git a/test/svd.jl b/test/svd.jl index 800f191b..41ad8c09 100644 --- a/test/svd.jl +++ b/test/svd.jl @@ -55,6 +55,9 @@ for T in (BLASFloats..., GenericFloats...), m in (0, 54), n in (0, 37, m, 63) ) TestSuite.test_svd(T, (m, n)) TestSuite.test_svd_algs(T, (m, n), LAPACK_SVD_ALGS) + @static if VERSION > v"1.11-" # Jacobi broken on 1.10 + m ≥ n && TestSuite.test_svd_algs(T, (m, n), (LAPACK_Jacobi(),); test_full = false, test_vals = false) + end elseif T ∈ GenericFloats TestSuite.test_svd(T, (m, n)) TestSuite.test_svd_algs(T, (m, n), (GLA_QRIteration(),)) diff --git a/test/testsuite/decompositions/schur.jl b/test/testsuite/decompositions/schur.jl index 572b9501..76b5c140 100644 --- a/test/testsuite/decompositions/schur.jl +++ b/test/testsuite/decompositions/schur.jl @@ -9,6 +9,14 @@ function test_schur(T::Type, sz; kwargs...) end end +function test_schur_algs(T::Type, sz, algs; kwargs...) + summary_str = testargs_summary(T, sz) + return @testset "schur algorithms $summary_str" begin + test_schur_full_algs(T, sz, algs; kwargs...) + test_schur_vals_algs(T, sz, algs; kwargs...) + end +end + function test_schur_full( T::Type, sz; atol::Real = 0, rtol::Real = precision(T), @@ -34,6 +42,31 @@ function test_schur_full( end end +function test_schur_full_algs( + T::Type, sz, algs; + atol::Real = 0, rtol::Real = precision(T), + kwargs... + ) + summary_str = testargs_summary(T, sz) + return @testset "schur_full! algorithm $alg $summary_str" for alg in algs + A = instantiate_matrix(T, sz) + Ac = deepcopy(A) + Tc = isa(A, Diagonal) ? eltype(T) : complex(eltype(T)) + + TA, Z, vals = @testinferred schur_full(A; alg) + @test eltype(TA) == eltype(Z) == eltype(T) + @test eltype(vals) == Tc + @test isisometric(Z) + @test A * Z ≈ Z * TA + + TA2, Z2, vals2 = @testinferred schur_full!(Ac, (TA, Z, vals); alg) + @test TA2 === TA + @test Z2 === Z + @test vals2 === vals + @test A * Z ≈ Z * TA + end +end + function test_schur_vals( T::Type, sz; atol::Real = 0, rtol::Real = precision(T), @@ -55,3 +88,25 @@ function test_schur_vals( @test valsc ≈ eig_vals(A) end end + +function test_schur_vals_algs( + T::Type, sz, algs; + atol::Real = 0, rtol::Real = precision(T), + kwargs... + ) + summary_str = testargs_summary(T, sz) + return @testset "schur_vals! algorithm $alg $summary_str" for alg in algs + A = instantiate_matrix(T, sz) + Ac = deepcopy(A) + Tc = isa(A, Diagonal) ? eltype(T) : complex(eltype(T)) + + valsc = @testinferred schur_vals(A; alg) + @test eltype(valsc) == Tc + @test valsc ≈ eig_vals(A) + + valsc = similar(A, Tc, size(A, 1)) + valsc = @testinferred schur_vals!(Ac, valsc; alg) + @test eltype(valsc) == Tc + @test valsc ≈ eig_vals(A) + end +end diff --git a/test/testsuite/decompositions/svd.jl b/test/testsuite/decompositions/svd.jl index a6aa4fb9..4b89d497 100644 --- a/test/testsuite/decompositions/svd.jl +++ b/test/testsuite/decompositions/svd.jl @@ -2,28 +2,28 @@ using TestExtras using GenericLinearAlgebra using LinearAlgebra: opnorm -function test_svd(T::Type, sz; kwargs...) +function test_svd(T::Type, sz; test_compact::Bool = true, test_full::Bool = true, test_trunc::Bool = true, kwargs...) summary_str = testargs_summary(T, sz) return @testset "svd $summary_str" begin - test_svd_compact(T, sz; kwargs...) - test_svd_full(T, sz; kwargs...) - test_svd_trunc(T, sz; kwargs...) + test_compact && test_svd_compact(T, sz; kwargs...) + test_full && test_svd_full(T, sz; kwargs...) + test_trunc && test_svd_trunc(T, sz; kwargs...) end end -function test_svd_algs(T::Type, sz, algs; kwargs...) +function test_svd_algs(T::Type, sz, algs; test_compact::Bool = true, test_full::Bool = true, test_trunc::Bool = true, kwargs...) summary_str = testargs_summary(T, sz) return @testset "svd algorithms $summary_str" begin - test_svd_compact_algs(T, sz, algs; kwargs...) - test_svd_full_algs(T, sz, algs; kwargs...) - test_svd_trunc_algs(T, sz, algs; kwargs...) + test_compact && test_svd_compact_algs(T, sz, algs; kwargs...) + test_full && test_svd_full_algs(T, sz, algs; kwargs...) + test_trunc && test_svd_trunc_algs(T, sz, algs; kwargs...) end end function test_svd_compact( T::Type, sz; atol::Real = 0, rtol::Real = precision(eltype(T)), - kwargs... + test_vals::Bool = true, kwargs... ) summary_str = testargs_summary(T, sz) return @testset "svd_compact! $summary_str" begin @@ -47,15 +47,17 @@ function test_svd_compact( @test isisometric(V2ᴴ; side = :right) @test isposdef(S2) - Sd = @testinferred svd_vals(A) - @test S ≈ Diagonal(Sd) + if test_vals + Sd = @testinferred svd_vals(A) + @test S ≈ Diagonal(Sd) + end end end function test_svd_compact_algs( T::Type, sz, algs; atol::Real = 0, rtol::Real = precision(eltype(T)), - kwargs... + test_vals::Bool = true, kwargs... ) summary_str = testargs_summary(T, sz) return @testset "svd_compact! algorithm $alg $summary_str" for alg in algs @@ -78,8 +80,10 @@ function test_svd_compact_algs( @test isisometric(V2ᴴ; side = :right) @test isposdef(S2) - Sd = @testinferred svd_vals(A; alg) - @test S ≈ Diagonal(Sd) + if test_vals + Sd = @testinferred svd_vals(A; alg) + @test S ≈ Diagonal(Sd) + end end end