From 4c322e4697e3477c1abe34e580f2853b596e11ae Mon Sep 17 00:00:00 2001 From: mtfishman Date: Tue, 12 Nov 2024 12:51:34 -0500 Subject: [PATCH] Revert changes to ITensorsNamedDimsArraysExt --- .../src/to_nameddimsarray.jl | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/lib/ITensorsNamedDimsArraysExt/src/to_nameddimsarray.jl b/src/lib/ITensorsNamedDimsArraysExt/src/to_nameddimsarray.jl index a150412f64..c4d7b237fb 100644 --- a/src/lib/ITensorsNamedDimsArraysExt/src/to_nameddimsarray.jl +++ b/src/lib/ITensorsNamedDimsArraysExt/src/to_nameddimsarray.jl @@ -34,19 +34,17 @@ function to_nameddimsarray(x::DiagTensor) return named(DiagonalArray(data(x), size(x)), name.(inds(x))) end -using ..NDTensors.BlockSparseArrays.BlockArrays: BlockArrays, blockedrange -using ..NDTensors: BlockSparseTensor, array, blockdim, datatype, nblocks, nzblocks +using ..NDTensors: BlockSparseTensor using ..NDTensors.BlockSparseArrays: BlockSparseArray -using ..NDTensors.TypeParameterAccessors: set_ndims # TODO: Delete once `BlockSparse` is removed. function to_nameddimsarray(x::BlockSparseTensor) - blockinds = map(i -> blockedrange([blockdim(i, b) for b in 1:nblocks(i)]), inds(x)) + blockinds = map(i -> [blockdim(i, b) for b in 1:nblocks(i)], inds(x)) blocktype = set_ndims(datatype(x), ndims(x)) # TODO: Make a simpler constructor: # BlockSparseArray(blocktype, blockinds) - arraystorage = BlockSparseArray{eltype(x),ndims(x),blocktype}(undef, blockinds) + arraystorage = BlockSparseArray{eltype(x),ndims(x),blocktype}(blockinds) for b in nzblocks(x) - arraystorage[BlockArrays.Block(Int.(Tuple(b))...)] = array(x[b]) + arraystorage[BlockArrays.Block(Tuple(b)...)] = x[b] end return named(arraystorage, name.(inds(x))) end