Skip to content

Commit 9024530

Browse files
committed
Fix type instability
1 parent 3695956 commit 9024530

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

src/tensors/linalg.jl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,8 @@ function LinearAlgebra.rank(
290290
t::AbstractTensorMap;
291291
atol::Real = 0, rtol::Real = atol > 0 ? 0 : _default_rtol(t)
292292
)
293-
r = dim(t)
294-
iszero(r) && return r
295-
r = zero(r)
293+
r = zero(dimscalartype(sectortype(t)))
294+
iszero(dim(t)) && return r
296295
S = MatrixAlgebraKit.svd_vals(t)
297296
tol = max(atol, rtol * maximum(parent(S)))
298297
for (c, b) in pairs(S)
@@ -301,7 +300,6 @@ function LinearAlgebra.rank(
301300
end
302301
end
303302
return r
304-
# return sum(((c, b),) -> dim(c) * count(>(tol), b), S; init)
305303
end
306304

307305
function LinearAlgebra.cond(t::AbstractTensorMap, p::Real = 2)

0 commit comments

Comments
 (0)