Skip to content

Commit bd67625

Browse files
github-actions[bot]CompatHelper Juliamtfishman
authored
CompatHelper: bump compat for SparseArraysBase to 0.6, (keep existing compat) (#160)
Co-authored-by: CompatHelper Julia <[email protected]> Co-authored-by: Matt Fishman <[email protected]> Co-authored-by: mtfishman <[email protected]>
1 parent 44574b8 commit bd67625

File tree

7 files changed

+31
-28
lines changed

7 files changed

+31
-28
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
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.7.22"
4+
version = "0.8.0"
55

66
[deps]
77
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
@@ -40,7 +40,7 @@ LinearAlgebra = "1.10"
4040
MacroTools = "0.5.13"
4141
MapBroadcast = "0.1.5"
4242
MatrixAlgebraKit = "0.2.2"
43-
SparseArraysBase = "0.5"
43+
SparseArraysBase = "0.7.1"
4444
SplitApplyCombine = "1.2.3"
4545
TensorAlgebra = "0.3.2"
4646
Test = "1.10"

docs/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
66

77
[compat]
88
BlockArrays = "1"
9-
BlockSparseArrays = "0.7"
9+
BlockSparseArrays = "0.8"
1010
Documenter = "1"
1111
Literate = "2"

examples/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
55

66
[compat]
77
BlockArrays = "1"
8-
BlockSparseArrays = "0.7"
8+
BlockSparseArrays = "0.8"
99
Test = "1"

src/blocksparsearray/blocksparsearray.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ using BlockArrays:
88
undef_blocks
99
using DerivableInterfaces: @interface
1010
using Dictionaries: Dictionary
11-
using SparseArraysBase: SparseArrayDOK
11+
using SparseArraysBase: SparseArrayDOK, Unstored
1212
using TypeParameterAccessors: similartype
1313

1414
"""
@@ -25,7 +25,7 @@ and should be imported from that package to use it as an input to this construct
2525
function SparseArraysBase.SparseArrayDOK{T,N}(
2626
::UndefBlocksInitializer, ax::Tuple{Vararg{AbstractUnitRange{<:Integer},N}}
2727
) where {T,N}
28-
return SparseArrayDOK{T,N}(undef, blocklength.(ax); getunstored=GetUnstoredBlock(ax))
28+
return SparseArrayDOK{T,N}(undef, Unstored(ZeroBlocks{N,T}(ax)))
2929
end
3030
function SparseArraysBase.SparseArrayDOK{T,N}(
3131
::UndefBlocksInitializer, ax::Vararg{AbstractUnitRange{<:Integer},N}

src/blocksparsearrayinterface/blocksparsearrayinterface.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,9 @@ function SparseArraysBase.getunstoredindex(
410410
_perm(a.array),
411411
)
412412
end
413-
function SparseArraysBase.eachstoredindex(a::SparsePermutedDimsArrayBlocks)
413+
function SparseArraysBase.eachstoredindex(
414+
::IndexCartesian, a::SparsePermutedDimsArrayBlocks
415+
)
414416
return map(I -> _getindices(I, _perm(a.array)), eachstoredindex(blocks(parent(a.array))))
415417
end
416418
## TODO: Define `storedvalues` instead.

src/blocksparsearrayinterface/getunstoredblock.jl

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,41 @@
11
using BlockArrays: Block
22
using DerivableInterfaces: zero!
33

4-
struct GetUnstoredBlock{Axes}
5-
axes::Axes
4+
struct ZeroBlocks{
5+
N,A<:AbstractArray{<:Any,N},ParentAxes<:Tuple{Vararg{AbstractUnitRange{<:Integer},N}}
6+
} <: AbstractArray{A,N}
7+
parentaxes::ParentAxes
8+
end
9+
function ZeroBlocks{N,A}(
10+
ax::Ax
11+
) where {N,A<:AbstractArray{<:Any,N},Ax<:Tuple{Vararg{AbstractUnitRange{<:Integer},N}}}
12+
return ZeroBlocks{N,A,Ax}(ax)
13+
end
14+
Base.size(a::ZeroBlocks) = map(blocklength, a.parentaxes)
15+
16+
function Base.AbstractArray{A}(a::ZeroBlocks{N}) where {N,A}
17+
return ZeroBlocks{N,A}(a.parentaxes)
618
end
719

8-
@inline function (f::GetUnstoredBlock)(
9-
::Type{<:AbstractArray{A,N}}, I::Vararg{Int,N}
10-
) where {A,N}
20+
@inline function Base.getindex(a::ZeroBlocks{N,A}, I::Vararg{Int,N}) where {N,A}
21+
# TODO: Use `BlockArrays.eachblockaxes`.
1122
ax = ntuple(N) do d
12-
return only(axes(f.axes[d][Block(I[d])]))
23+
return only(axes(a.parentaxes[d][Block(I[d])]))
1324
end
1425
!isconcretetype(A) && return zero!(similar(Array{eltype(A),N}, ax))
1526
return zero!(similar(A, ax))
1627
end
17-
@inline function (f::GetUnstoredBlock)(
18-
a::AbstractArray{<:Any,N}, I::Vararg{Int,N}
19-
) where {N}
20-
return f(typeof(a), I...)
21-
end
2228
# TODO: Use `Base.to_indices`.
23-
@inline function (f::GetUnstoredBlock)(
24-
a::AbstractArray{<:Any,N}, I::CartesianIndex{N}
25-
) where {N}
26-
return f(a, Tuple(I)...)
29+
@inline function Base.getindex(a::ZeroBlocks{N,A}, I::CartesianIndex{N}) where {N,A}
30+
return a[Tuple(I)...]
2731
end
2832

2933
# TODO: this is a hack and is also type-unstable
3034
using LinearAlgebra: Diagonal
3135
using TypeParameterAccessors: similartype
32-
function (f::GetUnstoredBlock)(
33-
::Type{<:AbstractMatrix{<:Diagonal{<:Any,V}}}, I::Vararg{Int,2}
34-
) where {V}
36+
function Base.getindex(a::ZeroBlocks{2,A}, I::Vararg{Int,2}) where {V,A<:Diagonal{<:Any,V}}
3537
ax = ntuple(2) do d
36-
return only(axes(f.axes[d][Block(I[d])]))
38+
return only(axes(a.parentaxes[d][Block(I[d])]))
3739
end
3840
if allequal(I)
3941
return Diagonal(zero!(similar(V, first(ax))))

test/Project.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ Adapt = "4"
2525
Aqua = "0.8"
2626
ArrayLayouts = "1"
2727
BlockArrays = "1"
28-
BlockSparseArrays = "0.7"
2928
DerivableInterfaces = "0.5"
3029
DiagonalArrays = "0.3"
3130
GPUArraysCore = "0.2"
@@ -34,7 +33,7 @@ LinearAlgebra = "1"
3433
MatrixAlgebraKit = "0.2.5"
3534
Random = "1"
3635
SafeTestsets = "0.1"
37-
SparseArraysBase = "0.5.11"
36+
SparseArraysBase = "0.7"
3837
StableRNGs = "1"
3938
Suppressor = "0.2"
4039
TensorAlgebra = "0.3.2"

0 commit comments

Comments
 (0)