Skip to content

Commit 4ac4315

Browse files
authored
[SparseArrayInterface] [BlockSparseArrays] Rename wrapper type unions (#1584)
* [SparseArrayInterface] [BlockSparseArrays] Rename wrapper type unions * [NDTensors] Bump to v0.3.66
1 parent 2e5da07 commit 4ac4315

File tree

15 files changed

+86
-75
lines changed

15 files changed

+86
-75
lines changed

NDTensors/Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "NDTensors"
22
uuid = "23ae76d9-e61a-49c4-8f12-3f1a16adf9cf"
33
authors = ["Matthew Fishman <[email protected]>"]
4-
version = "0.3.65"
4+
version = "0.3.66"
55

66
[deps]
77
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"

NDTensors/src/lib/BlockSparseArrays/src/abstractblocksparsearray/arraylayouts.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ using BlockArrays: BlockLayout
33
using ..SparseArrayInterface: SparseLayout
44
using ..TypeParameterAccessors: parenttype, similartype
55

6-
function ArrayLayouts.MemoryLayout(arraytype::Type{<:BlockSparseArrayLike})
6+
function ArrayLayouts.MemoryLayout(arraytype::Type{<:AnyAbstractBlockSparseArray})
77
outer_layout = typeof(MemoryLayout(blockstype(arraytype)))
88
inner_layout = typeof(MemoryLayout(blocktype(arraytype)))
99
return BlockLayout{outer_layout,inner_layout}()

NDTensors/src/lib/BlockSparseArrays/src/abstractblocksparsearray/broadcast.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using BlockArrays: AbstractBlockedUnitRange, BlockSlice
22
using Base.Broadcast: Broadcast
33

4-
function Broadcast.BroadcastStyle(arraytype::Type{<:BlockSparseArrayLike})
4+
function Broadcast.BroadcastStyle(arraytype::Type{<:AnyAbstractBlockSparseArray})
55
return BlockSparseArrayStyle{ndims(arraytype)}()
66
end
77

NDTensors/src/lib/BlockSparseArrays/src/abstractblocksparsearray/cat.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# TODO: Change to `AnyAbstractBlockSparseArray`.
2-
function Base.cat(as::BlockSparseArrayLike...; dims)
2+
function Base.cat(as::AnyAbstractBlockSparseArray...; dims)
33
# TODO: Use `sparse_cat` instead, currently
44
# that erroneously allocates too many blocks that are
55
# zero and shouldn't be stored.

NDTensors/src/lib/BlockSparseArrays/src/abstractblocksparsearray/map.jl

+9-9
Original file line numberDiff line numberDiff line change
@@ -92,27 +92,27 @@ end
9292
# function SparseArrayInterface.sparse_mapreduce(::BlockSparseArrayStyle, f, a_dest::AbstractArray, a_srcs::Vararg{AbstractArray})
9393
# end
9494

95-
function Base.map!(f, a_dest::AbstractArray, a_srcs::Vararg{BlockSparseArrayLike})
95+
function Base.map!(f, a_dest::AbstractArray, a_srcs::Vararg{AnyAbstractBlockSparseArray})
9696
sparse_map!(f, a_dest, a_srcs...)
9797
return a_dest
9898
end
9999

100-
function Base.map(f, as::Vararg{BlockSparseArrayLike})
100+
function Base.map(f, as::Vararg{AnyAbstractBlockSparseArray})
101101
return f.(as...)
102102
end
103103

104-
function Base.copy!(a_dest::AbstractArray, a_src::BlockSparseArrayLike)
104+
function Base.copy!(a_dest::AbstractArray, a_src::AnyAbstractBlockSparseArray)
105105
sparse_copy!(a_dest, a_src)
106106
return a_dest
107107
end
108108

109-
function Base.copyto!(a_dest::AbstractArray, a_src::BlockSparseArrayLike)
109+
function Base.copyto!(a_dest::AbstractArray, a_src::AnyAbstractBlockSparseArray)
110110
sparse_copyto!(a_dest, a_src)
111111
return a_dest
112112
end
113113

114114
# Fix ambiguity error
115-
function Base.copyto!(a_dest::LayoutArray, a_src::BlockSparseArrayLike)
115+
function Base.copyto!(a_dest::LayoutArray, a_src::AnyAbstractBlockSparseArray)
116116
sparse_copyto!(a_dest, a_src)
117117
return a_dest
118118
end
@@ -131,21 +131,21 @@ function Base.copyto!(
131131
return a_dest
132132
end
133133

134-
function Base.permutedims!(a_dest, a_src::BlockSparseArrayLike, perm)
134+
function Base.permutedims!(a_dest, a_src::AnyAbstractBlockSparseArray, perm)
135135
sparse_permutedims!(a_dest, a_src, perm)
136136
return a_dest
137137
end
138138

139-
function Base.mapreduce(f, op, as::Vararg{BlockSparseArrayLike}; kwargs...)
139+
function Base.mapreduce(f, op, as::Vararg{AnyAbstractBlockSparseArray}; kwargs...)
140140
return sparse_mapreduce(f, op, as...; kwargs...)
141141
end
142142

143143
# TODO: Why isn't this calling `mapreduce` already?
144-
function Base.iszero(a::BlockSparseArrayLike)
144+
function Base.iszero(a::AnyAbstractBlockSparseArray)
145145
return sparse_iszero(blocks(a))
146146
end
147147

148148
# TODO: Why isn't this calling `mapreduce` already?
149-
function Base.isreal(a::BlockSparseArrayLike)
149+
function Base.isreal(a::AnyAbstractBlockSparseArray)
150150
return sparse_isreal(blocks(a))
151151
end

NDTensors/src/lib/BlockSparseArrays/src/abstractblocksparsearray/sparsearrayinterface.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ function SparseArrayInterface.sparse_storage(a::AbstractBlockSparseArray)
3333
return BlockSparseStorage(a)
3434
end
3535

36-
function SparseArrayInterface.nstored(a::BlockSparseArrayLike)
36+
function SparseArrayInterface.nstored(a::AnyAbstractBlockSparseArray)
3737
return sum(nstored, sparse_storage(blocks(a)); init=zero(Int))
3838
end

NDTensors/src/lib/BlockSparseArrays/src/abstractblocksparsearray/views.jl

+9-7
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ end
2020

2121
# Override the default definition of `BlockArrays.blocksize`,
2222
# which is incorrect for certain slices.
23-
function BlockArrays.blocksize(a::SubArray{<:Any,<:Any,<:BlockSparseArrayLike})
23+
function BlockArrays.blocksize(a::SubArray{<:Any,<:Any,<:AnyAbstractBlockSparseArray})
2424
return blocklength.(axes(a))
2525
end
26-
function BlockArrays.blocksize(a::SubArray{<:Any,<:Any,<:BlockSparseArrayLike}, i::Int)
26+
function BlockArrays.blocksize(
27+
a::SubArray{<:Any,<:Any,<:AnyAbstractBlockSparseArray}, i::Int
28+
)
2729
# TODO: Maybe use `blocklength(axes(a, i))` which would be a bit faster.
2830
return blocksize(a)[i]
2931
end
@@ -33,22 +35,22 @@ end
3335
# which don't handle subslices of blocks properly.
3436
function Base.view(
3537
a::SubArray{
36-
<:Any,N,<:BlockSparseArrayLike,<:Tuple{Vararg{BlockSlice{<:BlockRange{1}},N}}
38+
<:Any,N,<:AnyAbstractBlockSparseArray,<:Tuple{Vararg{BlockSlice{<:BlockRange{1}},N}}
3739
},
3840
I::Block{N},
3941
) where {N}
4042
return blocksparse_view(a, I)
4143
end
4244
function Base.view(
4345
a::SubArray{
44-
<:Any,N,<:BlockSparseArrayLike,<:Tuple{Vararg{BlockSlice{<:BlockRange{1}},N}}
46+
<:Any,N,<:AnyAbstractBlockSparseArray,<:Tuple{Vararg{BlockSlice{<:BlockRange{1}},N}}
4547
},
4648
I::Vararg{Block{1},N},
4749
) where {N}
4850
return blocksparse_view(a, I...)
4951
end
5052
function Base.view(
51-
V::SubArray{<:Any,1,<:BlockSparseArrayLike,<:Tuple{BlockSlice{<:BlockRange{1}}}},
53+
V::SubArray{<:Any,1,<:AnyAbstractBlockSparseArray,<:Tuple{BlockSlice{<:BlockRange{1}}}},
5254
I::Block{1},
5355
)
5456
return blocksparse_view(a, I)
@@ -154,7 +156,7 @@ function BlockArrays.viewblock(
154156
return viewblock(a, to_tuple(block)...)
155157
end
156158

157-
# Fixes ambiguity error with `BlockSparseArrayLike` definition.
159+
# Fixes ambiguity error with `AnyAbstractBlockSparseArray` definition.
158160
function Base.view(
159161
a::SubArray{
160162
T,N,<:AbstractBlockSparseArray{T,N},<:Tuple{Vararg{BlockSlice{<:BlockRange{1}},N}}
@@ -163,7 +165,7 @@ function Base.view(
163165
) where {T,N}
164166
return viewblock(a, block)
165167
end
166-
# Fixes ambiguity error with `BlockSparseArrayLike` definition.
168+
# Fixes ambiguity error with `AnyAbstractBlockSparseArray` definition.
167169
function Base.view(
168170
a::SubArray{
169171
T,N,<:AbstractBlockSparseArray{T,N},<:Tuple{Vararg{BlockSlice{<:BlockRange{1}},N}}

0 commit comments

Comments
 (0)