Skip to content

Commit 5a39292

Browse files
authored
More robust blockreshape (#169)
1 parent c96c064 commit 5a39292

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "BlockSparseArrays"
22
uuid = "2c9a651f-6452-4ace-a6ac-809f4280fbb4"
33
authors = ["ITensor developers <[email protected]> and contributors"]
4-
version = "0.9.1"
4+
version = "0.9.2"
55

66
[deps]
77
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"

src/BlockArraysExtensions/BlockArraysExtensions.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,11 @@ function _blockreshape(a::AbstractArray, axes::Tuple{Vararg{AbstractUnitRange}})
278278
return reshape(reshaped_blocks_a[I], block_axes_I)
279279
end
280280
bs = Dict(Block(Tuple(I)) => f(I) for I in eachstoredindex(reshaped_blocks_a))
281+
if !isconcretetype(eltype(bs))
282+
# This branch only seems to be required in Julia 1.10, not Julia 1.11.
283+
# TODO: Remove this branch once Julia 1.10 support is dropped.
284+
bs = Dict{Block{length(axes),Int},AbstractArray{eltype(a),length(axes)}}()
285+
end
281286
return blocksparse(bs, axes)
282287
end
283288

0 commit comments

Comments
 (0)