diff --git a/Project.toml b/Project.toml index be23f73..48ec6c8 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "BlockSparseArrays" uuid = "2c9a651f-6452-4ace-a6ac-809f4280fbb4" authors = ["ITensor developers and contributors"] -version = "0.7.16" +version = "0.7.17" [deps] Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" diff --git a/src/blocksparsearrayinterface/map.jl b/src/blocksparsearrayinterface/map.jl index 3798254..03b5ec0 100644 --- a/src/blocksparsearrayinterface/map.jl +++ b/src/blocksparsearrayinterface/map.jl @@ -26,14 +26,14 @@ function viewblock_stored(a::AbstractArray{<:Any,N}, I::Block{N}) where {N} return viewblock_stored(a, Tuple(I)...) end -using FillArrays: Zeros +using FillArrays: Zeros, fillsimilar # Get a view of a block if it is stored, otherwise return a lazy zeros. function viewblock_or_zeros(a::AbstractArray{<:Any,N}, I::Vararg{Block{1},N}) where {N} if isstored(a, I...) return viewblock_stored(a, I...) else block_ax = map((ax, i) -> eachblockaxis(ax)[Int(i)], axes(a), I) - return Zeros{eltype(a)}(block_ax) + return fillsimilar(Zeros{eltype(a)}(block_ax), block_ax) end end function viewblock_or_zeros(a::AbstractArray{<:Any,N}, I::Block{N}) where {N}