Skip to content

Commit 35bda04

Browse files
committed
update tests
1 parent ec41b88 commit 35bda04

File tree

7 files changed

+28
-25
lines changed

7 files changed

+28
-25
lines changed

stdlib/LinearAlgebra/test/diagonal.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ end
565565
D = Diagonal(randn(5))
566566
Q = qr(randn(5, 5)).Q
567567
@test D * Q' == Array(D) * Q'
568-
Q = qr(randn(5, 5), Val(true)).Q
568+
Q = qr(randn(5, 5), :colnorm).Q
569569
@test_throws ArgumentError lmul!(Q, D)
570570
end
571571

stdlib/LinearAlgebra/test/generic.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -361,13 +361,13 @@ LinearAlgebra.Transpose(a::ModInt{n}) where {n} = transpose(a)
361361
A = [ModInt{2}(1) ModInt{2}(0); ModInt{2}(1) ModInt{2}(1)]
362362
b = [ModInt{2}(1), ModInt{2}(0)]
363363

364-
@test A*(lu(A, Val(false))\b) == b
364+
@test A*(lu(A, :none)\b) == b
365365

366366
# Needed for pivoting:
367367
Base.abs(a::ModInt{n}) where {n} = a
368368
Base.:<(a::ModInt{n}, b::ModInt{n}) where {n} = a.k < b.k
369369

370-
@test A*(lu(A, Val(true))\b) == b
370+
@test A*(lu(A, :rowmax)\b) == b
371371
end
372372

373373
@testset "Issue 18742" begin

stdlib/LinearAlgebra/test/lq.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ rectangularQ(Q::LinearAlgebra.LQPackedQ) = convert(Array, Q)
4040
lqa = lq(a)
4141
x = lqa\b
4242
l,q = lqa.L, lqa.Q
43-
qra = qr(a, Val(true))
43+
qra = qr(a, :colnorm)
4444
@testset "Basic ops" begin
4545
@test size(lqa,1) == size(a,1)
4646
@test size(lqa,3) == 1

stdlib/LinearAlgebra/test/lu.jl

+7-7
Original file line numberDiff line numberDiff line change
@@ -229,12 +229,12 @@ end
229229
@test_throws SingularException lu!(copy(A); check = true)
230230
@test !issuccess(lu(A; check = false))
231231
@test !issuccess(lu!(copy(A); check = false))
232-
@test_throws ZeroPivotException lu(A, Val(false))
233-
@test_throws ZeroPivotException lu!(copy(A), Val(false))
234-
@test_throws ZeroPivotException lu(A, Val(false); check = true)
235-
@test_throws ZeroPivotException lu!(copy(A), Val(false); check = true)
236-
@test !issuccess(lu(A, Val(false); check = false))
237-
@test !issuccess(lu!(copy(A), Val(false); check = false))
232+
@test_throws ZeroPivotException lu(A, :none)
233+
@test_throws ZeroPivotException lu!(copy(A), :none)
234+
@test_throws ZeroPivotException lu(A, :none; check = true)
235+
@test_throws ZeroPivotException lu!(copy(A), :none; check = true)
236+
@test !issuccess(lu(A, :none; check = false))
237+
@test !issuccess(lu!(copy(A), :none; check = false))
238238
F = lu(A; check = false)
239239
@test sprint((io, x) -> show(io, "text/plain", x), F) ==
240240
"Failed factorization of type $(typeof(F))"
@@ -320,7 +320,7 @@ include("trickyarithmetic.jl")
320320
@testset "lu with type whose sum is another type" begin
321321
A = TrickyArithmetic.A[1 2; 3 4]
322322
ElT = TrickyArithmetic.D{TrickyArithmetic.C,TrickyArithmetic.C}
323-
B = lu(A, Val(false))
323+
B = lu(A, :none)
324324
@test B isa LinearAlgebra.LU{ElT,Matrix{ElT}}
325325
end
326326

stdlib/LinearAlgebra/test/qr.jl

+14-11
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,9 @@ rectangularQ(Q::LinearAlgebra.AbstractQ) = convert(Array, Q)
7777
@test Base.propertynames(qra) == (:R, :Q)
7878
end
7979
@testset "Thin QR decomposition (without pivoting)" begin
80-
qra = @inferred qr(a[:, 1:n1], Val(false))
81-
@inferred qr(a[:, 1:n1], Val(false))
80+
# test inference within function calls, otherwise const prop won't work
81+
qrnone(A) = qr(A, :none)
82+
qra = @inferred qrnone(a[:, 1:n1])
8283
q,r = qra.Q, qra.R
8384
@test_throws ErrorException qra.Z
8485
@test q'*squareQ(q) Matrix(I, a_1, a_1)
@@ -103,7 +104,9 @@ rectangularQ(Q::LinearAlgebra.AbstractQ) = convert(Array, Q)
103104
@test Base.propertynames(qra) == (:R, :Q)
104105
end
105106
@testset "(Automatic) Fat (pivoted) QR decomposition" begin
106-
@inferred qr(a, Val(true))
107+
qrcolnorm(A) = qr(A, :colnorm)
108+
# test inference within function calls
109+
@inferred qrcolnorm(a)
107110

108111
qrpa = factorize(a[1:n1,:])
109112
q,r = qrpa.Q, qrpa.R
@@ -189,7 +192,7 @@ rectangularQ(Q::LinearAlgebra.AbstractQ) = convert(Array, Q)
189192
@test mul!(c, b, q') b*q'
190193
@test_throws DimensionMismatch mul!(Matrix{eltya}(I, n+1, n), q, b)
191194

192-
qra = qr(a[:,1:n1], Val(false))
195+
qra = qr(a[:,1:n1], :none)
193196
q, r = qra.Q, qra.R
194197
@test rmul!(copy(squareQ(q)'), q) Matrix(I, n, n)
195198
@test_throws DimensionMismatch rmul!(Matrix{eltya}(I, n+1, n+1),q)
@@ -214,8 +217,8 @@ end
214217
@testset "transpose errors" begin
215218
@test_throws MethodError transpose(qr(randn(3,3)))
216219
@test_throws MethodError adjoint(qr(randn(3,3)))
217-
@test_throws MethodError transpose(qr(randn(3,3), Val(false)))
218-
@test_throws MethodError adjoint(qr(randn(3,3), Val(false)))
220+
@test_throws MethodError transpose(qr(randn(3,3), :none))
221+
@test_throws MethodError adjoint(qr(randn(3,3), :none))
219222
@test_throws MethodError transpose(qr(big.(randn(3,3))))
220223
@test_throws MethodError adjoint(qr(big.(randn(3,3))))
221224
end
@@ -255,7 +258,7 @@ end
255258
A = zeros(1, 2)
256259
B = zeros(1, 1)
257260
@test A \ B == zeros(2, 1)
258-
@test qr(A, Val(true)) \ B == zeros(2, 1)
261+
@test qr(A, :colnorm) \ B == zeros(2, 1)
259262
end
260263

261264
@testset "Issue 24107" begin
@@ -277,7 +280,7 @@ end
277280
@test A \b ldiv!(c, qr(A ), b)
278281
@test b == b0
279282
c0 = copy(c)
280-
@test Ac\c ldiv!(b, qr(Ac, Val(true)), c)
283+
@test Ac\c ldiv!(b, qr(Ac, :colnorm), c)
281284
@test c0 == c
282285
end
283286

@@ -294,19 +297,19 @@ end
294297

295298
@testset "det(Q::Union{QRCompactWYQ, QRPackedQ})" begin
296299
# 40 is the number larger than the default block size 36 of QRCompactWY
297-
@testset for n in [1:3; 40], m in [1:3; 40], pivot in [false, true]
300+
@testset for n in [1:3; 40], m in [1:3; 40], pivot in (:none, :colnorm)
298301
@testset "real" begin
299302
@testset for k in 0:min(n, m, 5)
300303
A = cat(Array(I(k)), randn(n - k, m - k); dims=(1, 2))
301-
Q, = qr(A, Val(pivot))
304+
Q, = qr(A, pivot)
302305
@test det(Q) det(collect(Q))
303306
@test abs(det(Q)) 1
304307
end
305308
end
306309
@testset "complex" begin
307310
@testset for k in 0:min(n, m, 5)
308311
A = cat(Array(I(k)), randn(ComplexF64, n - k, m - k); dims=(1, 2))
309-
Q, = qr(A, Val(pivot))
312+
Q, = qr(A, pivot)
310313
@test det(Q) det(collect(Q))
311314
@test abs(det(Q)) 1
312315
end

stdlib/LinearAlgebra/test/special.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,10 @@ end
192192
a = rand(n,n)
193193
atri = typ(a)
194194
b = rand(n,n)
195-
qrb = qr(b,Val(true))
195+
qrb = qr(b, :colnorm)
196196
@test *(atri, adjoint(qrb.Q)) Matrix(atri) * qrb.Q'
197197
@test rmul!(copy(atri), adjoint(qrb.Q)) Matrix(atri) * qrb.Q'
198-
qrb = qr(b,Val(false))
198+
qrb = qr(b, :none)
199199
@test *(atri, adjoint(qrb.Q)) Matrix(atri) * qrb.Q'
200200
@test rmul!(copy(atri), adjoint(qrb.Q)) Matrix(atri) * qrb.Q'
201201
end

stdlib/LinearAlgebra/test/uniformscaling.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ end
489489

490490
@testset "Factorization solutions" begin
491491
J = complex(randn(),randn()) * I
492-
qrp = A -> qr(A, Val(true))
492+
qrp = A -> qr(A, :colnorm)
493493

494494
# thin matrices
495495
X = randn(3,2)

0 commit comments

Comments
 (0)