Skip to content

Commit 2048988

Browse files
committed
fix empty case in _count_svdvals
1 parent bef27f0 commit 2048988

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/svd.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ end
133133

134134
# count positive singular values S ≥ given tolerances, S assumed sorted
135135
function _count_svdvals(S, atol::Real, rtol::Real)
136-
tol = max(rtol * (isempty(S) ? zero(eltype(S)) : S[1]), atol)
136+
isempty(S) && return 0
137+
tol = max(rtol * S[1], atol)
137138
return iszero(S[1]) ? 0 : searchsortedlast(S, tol, rev=true)
138139
end
139140

0 commit comments

Comments
 (0)