Skip to content

Commit f48fa24

Browse files
committed
fix with empty tensors
1 parent 61990ee commit f48fa24

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

src/auxiliary/blockarrays.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
copy_dense(A) = copy_dense!(similar(first(A.blocks), size(A)), A)
21
function copy_dense!(Adense, A)
32
for block_index in Iterators.product(blockaxes(A)...)
43
a = view(A, block_index...)

src/linalg/factorizations.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ for f! in (
2525
)
2626
@eval function MAK.$f!(t::AbstractBlockTensorMap, F, alg::AbstractAlgorithm)
2727
TensorKit.foreachblock(t, F...) do _, (tblock, Fblocks...)
28-
Fblocks′ = MAK.$f!(copy_dense(tblock), alg)
28+
Fblocks′ = MAK.$f!(copy_dense!(similar(tblock, size(tblock)), tblock), alg)
2929
# deal with the case where the output is not in-place
3030
for (b′, b) in zip(Fblocks′, Fblocks)
3131
b === b′ || copy!(b, b′)
@@ -44,7 +44,7 @@ for f! in (
4444
)
4545
@eval function MAK.$f!(t::AbstractBlockTensorMap, N, alg::AbstractAlgorithm)
4646
TensorKit.foreachblock(t, N) do _, (tblock, Nblock)
47-
Nblock′ = MAK.$f!(copy_dense(tblock), alg)
47+
Nblock′ = MAK.$f!(copy_dense!(similar(tblock, size(tblock)), tblock), alg)
4848
# deal with the case where the output is not the same as the input
4949
Nblock === Nblock′ || copy!(Nblock, Nblock′)
5050
return nothing

0 commit comments

Comments
 (0)