Skip to content

Commit c19bef3

Browse files
committed
Kwargs for SVD
1 parent ed71fba commit c19bef3

2 files changed

Lines changed: 19 additions & 16 deletions

File tree

test/svd.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ for T in (BLASFloats..., GenericFloats...), m in (0, 54), n in (0, 37, m, 63)
5555
)
5656
TestSuite.test_svd(T, (m, n))
5757
TestSuite.test_svd_algs(T, (m, n), LAPACK_SVD_ALGS)
58-
m n && TestSuite.test_svd_algs(T, (m, n), (LAPACK_Jacobi(),))
58+
m n && TestSuite.test_svd_algs(T, (m, n), (LAPACK_Jacobi(),); test_full = false, test_vals = false)
5959
elseif T GenericFloats
6060
TestSuite.test_svd(T, (m, n))
6161
TestSuite.test_svd_algs(T, (m, n), (GLA_QRIteration(),))

test/testsuite/decompositions/svd.jl

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,28 @@ using TestExtras
22
using GenericLinearAlgebra
33
using LinearAlgebra: opnorm
44

5-
function test_svd(T::Type, sz; kwargs...)
5+
function test_svd(T::Type, sz; test_compact::Bool = true, test_full::Bool = true, test_trunc::Bool = true, kwargs...)
66
summary_str = testargs_summary(T, sz)
77
return @testset "svd $summary_str" begin
8-
test_svd_compact(T, sz; kwargs...)
9-
test_svd_full(T, sz; kwargs...)
10-
test_svd_trunc(T, sz; kwargs...)
8+
test_compact && test_svd_compact(T, sz; kwargs...)
9+
test_full && test_svd_full(T, sz; kwargs...)
10+
test_trunc && test_svd_trunc(T, sz; kwargs...)
1111
end
1212
end
1313

14-
function test_svd_algs(T::Type, sz, algs; kwargs...)
14+
function test_svd_algs(T::Type, sz, algs; test_compact::Bool = true, test_full::Bool = true, test_trunc::Bool = true, kwargs...)
1515
summary_str = testargs_summary(T, sz)
1616
return @testset "svd algorithms $summary_str" begin
17-
test_svd_compact_algs(T, sz, algs; kwargs...)
18-
test_svd_full_algs(T, sz, algs; kwargs...)
19-
test_svd_trunc_algs(T, sz, algs; kwargs...)
17+
test_compact && test_svd_compact_algs(T, sz, algs; kwargs...)
18+
test_full && test_svd_full_algs(T, sz, algs; kwargs...)
19+
test_trunc && test_svd_trunc_algs(T, sz, algs; kwargs...)
2020
end
2121
end
2222

2323
function test_svd_compact(
2424
T::Type, sz;
2525
atol::Real = 0, rtol::Real = precision(eltype(T)),
26-
kwargs...
26+
test_vals::Bool = true, kwargs...
2727
)
2828
summary_str = testargs_summary(T, sz)
2929
return @testset "svd_compact! $summary_str" begin
@@ -47,15 +47,17 @@ function test_svd_compact(
4747
@test isisometric(V2ᴴ; side = :right)
4848
@test isposdef(S2)
4949

50-
Sd = @testinferred svd_vals(A)
51-
@test S Diagonal(Sd)
50+
if test_vals
51+
Sd = @testinferred svd_vals(A)
52+
@test S Diagonal(Sd)
53+
end
5254
end
5355
end
5456

5557
function test_svd_compact_algs(
5658
T::Type, sz, algs;
5759
atol::Real = 0, rtol::Real = precision(eltype(T)),
58-
kwargs...
60+
test_vals::Bool = true, kwargs...
5961
)
6062
summary_str = testargs_summary(T, sz)
6163
return @testset "svd_compact! algorithm $alg $summary_str" for alg in algs
@@ -78,8 +80,10 @@ function test_svd_compact_algs(
7880
@test isisometric(V2ᴴ; side = :right)
7981
@test isposdef(S2)
8082

81-
Sd = @testinferred svd_vals(A; alg)
82-
@test S Diagonal(Sd)
83+
if test_vals
84+
Sd = @testinferred svd_vals(A; alg)
85+
@test S Diagonal(Sd)
86+
end
8387
end
8488
end
8589

@@ -123,7 +127,6 @@ function test_svd_full_algs(
123127
)
124128
summary_str = testargs_summary(T, sz)
125129
return @testset "svd_full! algorithm $alg $summary_str" for alg in algs
126-
isa(alg, LAPACK_Jacobi) && continue
127130
A = instantiate_matrix(T, sz)
128131
Ac = deepcopy(A)
129132
m, n = size(A)

0 commit comments

Comments
 (0)