65
65
)
66
66
# TODO : Use `Block()[]` once https://github.com/JuliaArrays/BlockArrays.jl/issues/430
67
67
# is fixed.
68
- return a[BlockIndex {0,Tuple{},Tuple{}} ((), () )]
68
+ return a[BlockIndex ( )]
69
69
end
70
70
71
71
# a[1:2, 1:2]
135
135
)
136
136
# TODO : Use `Block()[]` once https://github.com/JuliaArrays/BlockArrays.jl/issues/430
137
137
# is fixed.
138
- a[BlockIndex {0,Tuple{},Tuple{}} ((), () )] = value
138
+ a[BlockIndex ( )] = value
139
139
return a
140
140
end
141
141
301
301
function Base. size (a:: SparseSubArrayBlocks )
302
302
return length .(axes (a))
303
303
end
304
+ # TODO : Define `isstored`.
305
+ # TODO : Define `getstoredindex`, `getunstoredindex` instead.
304
306
function Base. getindex (a:: SparseSubArrayBlocks{<:Any,N} , I:: Vararg{Int,N} ) where {N}
305
307
# TODO : Should this be defined as `@view a.array[Block(I)]` instead?
306
308
return @view a. array[Block (I)]
@@ -312,9 +314,11 @@ function Base.getindex(a::SparseSubArrayBlocks{<:Any,N}, I::Vararg{Int,N}) where
312
314
# # return @view parent_block[blockindices(parent(a.array), block, a.array.indices)...]
313
315
end
314
316
# TODO : This should be handled by generic `AbstractSparseArray` code.
317
+ # TODO : Define `getstoredindex`, `getunstoredindex` instead.
315
318
function Base. getindex (a:: SparseSubArrayBlocks{<:Any,N} , I:: CartesianIndex{N} ) where {N}
316
319
return a[Tuple (I)... ]
317
320
end
321
+ # TODO : Define `setstoredindex!`, `setunstoredindex!` instead.
318
322
function Base. setindex! (a:: SparseSubArrayBlocks{<:Any,N} , value, I:: Vararg{Int,N} ) where {N}
319
323
parent_blocks = @view blocks (parent (a. array))[blockrange (a)... ]
320
324
# TODO : The following line is required to instantiate
@@ -345,18 +349,11 @@ SparseArraysBase.storedlength(a::SparseSubArrayBlocks) = length(eachstoredindex(
345
349
# # array::Array
346
350
# # end
347
351
348
- # # TODO : Delete .
352
+ # # TODO : Define `storedvalues` instead .
349
353
# # function SparseArraysBase.sparse_storage(a::SparseSubArrayBlocks)
350
354
# # return map(I -> a[I], eachstoredindex(a))
351
355
# # end
352
356
353
- # # TODO : Delete.
354
- # # function SparseArraysBase.getindex_zero_function(a::SparseSubArrayBlocks)
355
- # # # TODO : Base it off of `getindex_zero_function(blocks(parent(a.array))`, but replace the
356
- # # # axes with `axes(a.array)`.
357
- # # return BlockZero(axes(a.array))
358
- # # end
359
-
360
357
function SparseArraysBase. getunstoredindex (
361
358
a:: SparseSubArrayBlocks{<:Any,N} , I:: Vararg{Int,N}
362
359
) where {N}
0 commit comments