Skip to content

Commit fc2e1e1

Browse files
kshyattfredrikekre
authored andcommitted
Consolidate pinv tests (#23627)
1 parent 15b29bc commit fc2e1e1

File tree

1 file changed

+24
-26
lines changed

1 file changed

+24
-26
lines changed

test/linalg/pinv.jl

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,8 @@ end
142142
@test apinv isa Vector{eltya}
143143
end
144144
end
145-
end
146145

147-
@testset "zero valued numbers/vectors/matrices" begin
148-
@testset for eltya in (Float32, Float64, Complex64, Complex128)
146+
@testset "zero valued numbers/vectors/matrices" begin
149147
a = pinv(zero(eltya))
150148
@test a 0.0
151149

@@ -161,29 +159,29 @@ end
161159
@test a.diag[1] 0.0
162160
@test a.diag[2] 0.0
163161
end
164-
end
165162

166-
@testset "sub-normal numbers/vectors/matrices" begin
167-
@testset for eltya in (Float32, Float64)
168-
a = pinv(realmin(eltya)/100)
169-
@test a 0.0
170-
# Complex subnormal
171-
a = pinv(realmin(eltya)/100*(1+1im))
172-
@test a 0.0
173-
174-
a = pinv([realmin(eltya); realmin(eltya)]/100)
175-
@test a[1] 0.0
176-
@test a[2] 0.0
177-
# Complex subnormal
178-
a = pinv([realmin(eltya); realmin(eltya)]/100*(1+1im))
179-
@test a[1] 0.0
180-
@test a[2] 0.0
181-
a = pinv(Diagonal([realmin(eltya); realmin(eltya)]/100))
182-
@test a.diag[1] 0.0
183-
@test a.diag[2] 0.0
184-
# Complex subnormal
185-
a = pinv(Diagonal([realmin(eltya); realmin(eltya)]/100*(1+1im)))
186-
@test a.diag[1] 0.0
187-
@test a.diag[2] 0.0
163+
if eltya <: Base.LinAlg.BlasReal
164+
@testset "sub-normal numbers/vectors/matrices" begin
165+
a = pinv(realmin(eltya)/100)
166+
@test a 0.0
167+
# Complex subnormal
168+
a = pinv(realmin(eltya)/100*(1+1im))
169+
@test a 0.0
170+
171+
a = pinv([realmin(eltya); realmin(eltya)]/100)
172+
@test a[1] 0.0
173+
@test a[2] 0.0
174+
# Complex subnormal
175+
a = pinv([realmin(eltya); realmin(eltya)]/100*(1+1im))
176+
@test a[1] 0.0
177+
@test a[2] 0.0
178+
a = pinv(Diagonal([realmin(eltya); realmin(eltya)]/100))
179+
@test a.diag[1] 0.0
180+
@test a.diag[2] 0.0
181+
# Complex subnormal
182+
a = pinv(Diagonal([realmin(eltya); realmin(eltya)]/100*(1+1im)))
183+
@test a.diag[1] 0.0
184+
@test a.diag[2] 0.0
185+
end
188186
end
189187
end

0 commit comments

Comments
 (0)