Skip to content

Commit bf41a6c

Browse files
authored
Fix for BlockSparseArrays v0.9 (#56)
1 parent 67c2272 commit bf41a6c

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "GradedArrays"
22
uuid = "bc96ca6e-b7c8-4bb6-888e-c93f838762c2"
33
authors = ["ITensor developers <support@itensor.org> and contributors"]
4-
version = "0.4.18"
4+
version = "0.4.19"
55

66
[deps]
77
BlockArrays = "8e7c35d0-a365-5155-bbbb-fb81a777f24e"
@@ -24,7 +24,7 @@ GradedArraysTensorAlgebraExt = "TensorAlgebra"
2424

2525
[compat]
2626
BlockArrays = "1.6"
27-
BlockSparseArrays = "0.8"
27+
BlockSparseArrays = "0.8, 0.9.3"
2828
Compat = "4.16"
2929
FillArrays = "1.13"
3030
HalfIntegers = "1.6"

src/gradedarray.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,12 @@ function similar_blocksparse(
4848
similar_blocktype = Base.promote_op(
4949
similar, blocktype(a), Type{elt}, Tuple{blockaxistypes...}
5050
)
51-
return BlockSparseArray{elt,length(axes),similar_blocktype}(undef, axes)
51+
similar_blocktype′ = if !isconcretetype(similar_blocktype)
52+
AbstractArray{elt,length(axes)}
53+
else
54+
similar_blocktype
55+
end
56+
return BlockSparseArray{elt,length(axes),similar_blocktype′}(undef, axes)
5257
end
5358

5459
function Base.similar(

src/sectorunitrange.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,7 @@ sector_multiplicities(sr::SectorUnitRange) = [sector_multiplicity(sr)] # TBD re
155155
function Base.similar(A::Type{<:AbstractArray}, ax::Tuple{SectorOneTo,Vararg{SectorOneTo}})
156156
return similar(A, ungrade.(ax))
157157
end
158+
159+
function Base.reshape(A::AbstractArray, ax::Tuple{SectorOneTo,Vararg{SectorOneTo}})
160+
return reshape(A, ungrade.(ax))
161+
end

test/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ TestExtras = "5ed8adda-3752-4e41-b88a-e8b09835ee3a"
1717
[compat]
1818
Aqua = "0.8.11"
1919
BlockArrays = "1.6"
20-
BlockSparseArrays = "0.8"
20+
BlockSparseArrays = "0.8, 0.9"
2121
GradedArrays = "0.4"
2222
LinearAlgebra = "1.10"
2323
MatrixAlgebraKit = "0.2"

0 commit comments

Comments
 (0)