Skip to content

Commit aa15615

Browse files
Refactor LU tests for consistency and clarity in pivot checks
1 parent 19f661a commit aa15615

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

test/array/linalg/lu.jl

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@
66
# Out-of-place
77
lu_A = lu(A, pivot)
88
lu_DA = lu(DA, pivot)
9-
@test lu_DA isa LU{T,DMatrix{T},DVector{Int}}
10-
if !(T in (Float32, ComplexF32, ComplexF64)) # FIXME: NoPivot is unstable for FP32
9+
@test lu_DA isa LU{T,DMatrix{T},DVector{Int}}
10+
if !(T in (Float32, ComplexF32)) && pivot == NoPivot() # FIXME: NoPivot is unstable for FP32
1111
@test lu_A.L lu_DA.L
1212
@test lu_A.U lu_DA.U
1313
end
14-
if !(T in (ComplexF32, ComplexF64))
15-
@test lu_A.P lu_DA.P
16-
@test lu_A.p lu_DA.p
17-
end
14+
@test lu_A.P lu_DA.P
15+
@test lu_A.p lu_DA.p
1816
# Check that lu did not modify A or DA
1917
@test A DA B
2018

@@ -23,14 +21,12 @@
2321
lu_A = lu!(A_copy, pivot)
2422
lu_DA = lu!(DA, pivot)
2523
@test lu_DA isa LU{T,DMatrix{T},DVector{Int}}
26-
if !(T in (Float32, ComplexF32, ComplexF64)) # FIXME: NoPivot is unstable for FP32
24+
if !(T in (Float32, ComplexF32)) && pivot == NoPivot() # FIXME: NoPivot is unstable for FP32
2725
@test lu_A.L lu_DA.L
2826
@test lu_A.U lu_DA.U
2927
end
30-
if !(T in (ComplexF32, ComplexF64))
31-
@test lu_A.P lu_DA.P
32-
@test lu_A.p lu_DA.p
33-
end
28+
@test lu_A.P lu_DA.P
29+
@test lu_A.p lu_DA.p
3430
# Check that changes propagated to A
3531
@test DA A
3632
@test !(B A)

0 commit comments

Comments
 (0)