@@ -13,7 +13,7 @@ using BlockArrays:
1313 blocks,
1414 findblockindex
1515using LinearAlgebra: Adjoint, Transpose
16- using SparseArraysBase: perm, iperm, stored_length , sparse_zero!
16+ using SparseArraysBase: perm, iperm, storedlength , sparse_zero!
1717
1818blocksparse_blocks (a:: AbstractArray ) = error (" Not implemented" )
1919
@@ -136,8 +136,8 @@ function blocksparse_fill!(a::AbstractArray, value)
136136 return a
137137end
138138
139- function block_stored_length (a:: AbstractArray )
140- return stored_length (blocks (a))
139+ function block_storedlength (a:: AbstractArray )
140+ return storedlength (blocks (a))
141141end
142142
143143# BlockArrays
@@ -169,18 +169,19 @@ function Base.getindex(
169169 blocks (parent (a. array))[_getindices (index, _invperm (a. array))... ], _perm (a. array)
170170 )
171171end
172- function SparseArraysBase. stored_indices (a:: SparsePermutedDimsArrayBlocks )
173- return map (I -> _getindices (I, _perm (a. array)), stored_indices (blocks (parent (a. array))))
172+ function SparseArraysBase. eachstoredindex (a:: SparsePermutedDimsArrayBlocks )
173+ return map (I -> _getindices (I, _perm (a. array)), eachstoredindex (blocks (parent (a. array))))
174174end
175175# TODO : Either make this the generic interface or define
176176# `SparseArraysBase.sparse_storage`, which is used
177177# to defined this.
178- function SparseArraysBase. stored_length (a:: SparsePermutedDimsArrayBlocks )
179- return length (stored_indices (a))
180- end
181- function SparseArraysBase. sparse_storage (a:: SparsePermutedDimsArrayBlocks )
182- return error (" Not implemented" )
178+ function SparseArraysBase. storedlength (a:: SparsePermutedDimsArrayBlocks )
179+ return length (eachstoredindex (a))
183180end
181+ # # TODO : Delete.
182+ # # function SparseArraysBase.sparse_storage(a::SparsePermutedDimsArrayBlocks)
183+ # # return error("Not implemented")
184+ # # end
184185
185186reverse_index (index) = reverse (index)
186187reverse_index (index:: CartesianIndex ) = CartesianIndex (reverse (Tuple (index)))
@@ -240,25 +241,32 @@ function Base.isassigned(a::SparseSubArrayBlocks{<:Any,N}, I::Vararg{Int,N}) whe
240241 # TODO : Implement this properly.
241242 return true
242243end
243- function SparseArraysBase. stored_indices (a:: SparseSubArrayBlocks )
244- return stored_indices (view (blocks (parent (a. array)), blockrange (a)... ))
244+ function SparseArraysBase. eachstoredindex (a:: SparseSubArrayBlocks )
245+ return eachstoredindex (view (blocks (parent (a. array)), blockrange (a)... ))
245246end
246247# TODO : Either make this the generic interface or define
247248# `SparseArraysBase.sparse_storage`, which is used
248249# to defined this.
249- SparseArraysBase. stored_length (a:: SparseSubArrayBlocks ) = length (stored_indices (a))
250+ SparseArraysBase. storedlength (a:: SparseSubArrayBlocks ) = length (eachstoredindex (a))
250251
251252# # struct SparseSubArrayBlocksStorage{Array<:SparseSubArrayBlocks}
252253# # array::Array
253254# # end
254- function SparseArraysBase. sparse_storage (a:: SparseSubArrayBlocks )
255- return map (I -> a[I], stored_indices (a))
256- end
257255
258- function SparseArraysBase. getindex_zero_function (a:: SparseSubArrayBlocks )
259- # TODO : Base it off of `getindex_zero_function(blocks(parent(a.array))`, but replace the
260- # axes with `axes(a.array)`.
261- return BlockZero (axes (a. array))
256+ # # TODO : Delete.
257+ # # function SparseArraysBase.sparse_storage(a::SparseSubArrayBlocks)
258+ # # return map(I -> a[I], eachstoredindex(a))
259+ # # end
260+
261+ # # TODO : Delete.
262+ # # function SparseArraysBase.getindex_zero_function(a::SparseSubArrayBlocks)
263+ # # # TODO : Base it off of `getindex_zero_function(blocks(parent(a.array))`, but replace the
264+ # # # axes with `axes(a.array)`.
265+ # # return BlockZero(axes(a.array))
266+ # # end
267+
268+ function SparseArraysBase. getunstoredindex (a:: SparseSubArrayBlocks{<:Any,N} , I:: Vararg{Int,N} ) where {N}
269+ error (" Not implemented." )
262270end
263271
264272to_blocks_indices (I:: BlockSlice{<:BlockRange{1}} ) = Int .(I. block)
@@ -271,4 +279,4 @@ function blocksparse_blocks(
271279end
272280
273281using BlockArrays: BlocksView
274- SparseArraysBase. stored_length (a:: BlocksView ) = length (a)
282+ SparseArraysBase. storedlength (a:: BlocksView ) = length (a)
0 commit comments