Skip to content

Commit 2275112

Browse files
committed
fix scalar indexing
1 parent fc7714a commit 2275112

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/tensors/blocktensor.jl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,13 @@ end
113113
function BlockTensorMap(t::AbstractTensorMap, space::TensorMapSumSpace)
114114
TT = tensormaptype(spacetype(t), numout(t), numin(t), storagetype(t))
115115
tdst = BlockTensorMap{TT}(undef, space)
116-
for (f₁, f₂) in fusiontrees(tdst)
117-
copy!(tdst[f₁, f₂], t[f₁, f₂])
116+
@inbounds for (f₁, f₂) in fusiontrees(t)
117+
dst = tdst[f₁, f₂]
118+
src = t[f₁, f₂]
119+
for block_index in Iterators.product(blockaxes(dst)...)
120+
indices = getindex.(axes(dst), block_index)
121+
dst[block_index...] .= @view src[indices...]
122+
end
118123
end
119124
return tdst
120125
end

0 commit comments

Comments
 (0)