Skip to content

Commit 4c322e4

Browse files
committed
Revert changes to ITensorsNamedDimsArraysExt
1 parent a48f7e7 commit 4c322e4

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/lib/ITensorsNamedDimsArraysExt/src/to_nameddimsarray.jl

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,17 @@ function to_nameddimsarray(x::DiagTensor)
3434
return named(DiagonalArray(data(x), size(x)), name.(inds(x)))
3535
end
3636

37-
using ..NDTensors.BlockSparseArrays.BlockArrays: BlockArrays, blockedrange
38-
using ..NDTensors: BlockSparseTensor, array, blockdim, datatype, nblocks, nzblocks
37+
using ..NDTensors: BlockSparseTensor
3938
using ..NDTensors.BlockSparseArrays: BlockSparseArray
40-
using ..NDTensors.TypeParameterAccessors: set_ndims
4139
# TODO: Delete once `BlockSparse` is removed.
4240
function to_nameddimsarray(x::BlockSparseTensor)
43-
blockinds = map(i -> blockedrange([blockdim(i, b) for b in 1:nblocks(i)]), inds(x))
41+
blockinds = map(i -> [blockdim(i, b) for b in 1:nblocks(i)], inds(x))
4442
blocktype = set_ndims(datatype(x), ndims(x))
4543
# TODO: Make a simpler constructor:
4644
# BlockSparseArray(blocktype, blockinds)
47-
arraystorage = BlockSparseArray{eltype(x),ndims(x),blocktype}(undef, blockinds)
45+
arraystorage = BlockSparseArray{eltype(x),ndims(x),blocktype}(blockinds)
4846
for b in nzblocks(x)
49-
arraystorage[BlockArrays.Block(Int.(Tuple(b))...)] = array(x[b])
47+
arraystorage[BlockArrays.Block(Tuple(b)...)] = x[b]
5048
end
5149
return named(arraystorage, name.(inds(x)))
5250
end

0 commit comments

Comments
 (0)