Skip to content

Commit 8975fec

Browse files
committed
fix #34866
1 parent 1bd0593 commit 8975fec

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

stdlib/LinearAlgebra/src/svd.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ function inv(F::SVD{T}) where T
229229
@inbounds for i in eachindex(F.S)
230230
iszero(F.S[i]) && throw(SingularException(i))
231231
end
232-
k = searchsortedlast(F.S, eps(T)*F.S[1], rev=true)
232+
k = searchsortedlast(F.S, eps(real(T))*F.S[1], rev=true)
233233
@views (F.S[1:k] .\ F.Vt[1:k, :])' * F.U[:,1:k]'
234234
end
235235

stdlib/LinearAlgebra/test/svd.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ using LinearAlgebra: BlasComplex, BlasFloat, BlasReal, QRPivoted
3535
@test inv(svd([1 2; 3 4])) [-2.0 1.0; 1.5 -0.5]
3636
@test inv(svd([1 0 1; 0 1 0])) [0.5 0.0; 0.0 1.0; 0.5 0.0]
3737
@test_throws SingularException inv(svd([0 0; 0 0]))
38+
@test inv(svd([1+2im 3+4im; 5+6im 7+8im])) [-0.5 + 0.4375im 0.25 - 0.1875im; 0.375 - 0.3125im -0.125 + 0.0625im]
3839
end
3940

4041
n = 10

0 commit comments

Comments
 (0)