Skip to content

Commit 7cfae1a

Browse files
authored
Rewrite svd to avoid empty blocks (#191)
1 parent 7254747 commit 7cfae1a

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/utility/svd.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,9 @@ function TensorKit._compute_svddata!(
286286
I = sectortype(f)
287287
dims = SectorDict{I,Int}()
288288

289-
generator = Base.Iterators.map(blocks(f)) do (c, b)
289+
sectors = trunc isa NoTruncation ? blocksectors(f) : blocksectors(trunc.space)
290+
generator = Base.Iterators.map(sectors) do c
291+
b = block(f, c)
290292
howmany = trunc isa NoTruncation ? minimum(size(b)) : blockdim(trunc.space, c)
291293

292294
if howmany / minimum(size(b)) > alg.fallback_threshold # Use dense SVD for small blocks

0 commit comments

Comments
 (0)