@@ -106,10 +106,6 @@ function storedparentvalues(a::SubArray)
106106 return StoredValues (parent (a), collect (eachstoredparentindex (a)))
107107end
108108
109- @interface :: AbstractArrayInterface function isstored (a:: SubArray , I:: Int... )
110- return isstored (parent (a), index_to_parentindex (a, I... )... )
111- end
112-
113109using LinearAlgebra: Transpose
114110function parentindex_to_index (a:: Transpose , I:: CartesianIndex{2} )
115111 return cartesianindex_reverse (I)
@@ -124,13 +120,30 @@ function value_to_parentvalue(a::Transpose, value)
124120 return transpose (value)
125121end
126122
123+ function isstored_wrapped (a:: AbstractArray{<:Any,N} , I:: Vararg{Int,N} ) where {N}
124+ return isstored (parent (a), index_to_parentindex (a, I... )... )
125+ end
126+
127+ function isstored (a:: Adjoint , I:: Vararg{Int,2} )
128+ return isstored_wrapped (a, I... )
129+ end
130+ function isstored (a:: PermutedDimsArray{<:Any,N} , I:: Vararg{Int,N} ) where {N}
131+ return isstored_wrapped (a, I... )
132+ end
133+ function isstored (a:: ReshapedArray{<:Any,N} , I:: Vararg{Int,N} ) where {N}
134+ return isstored_wrapped (a, I... )
135+ end
136+ function isstored (a:: SubArray{<:Any,N} , I:: Vararg{Int,N} ) where {N}
137+ return isstored_wrapped (a, I... )
138+ end
139+ function isstored (a:: Transpose , I:: Vararg{Int,2} )
140+ return isstored_wrapped (a, I... )
141+ end
142+
127143# TODO : Turn these into `AbstractWrappedSparseArrayInterface` functions?
128144for type in (:Adjoint , :PermutedDimsArray , :ReshapedArray , :SubArray , :Transpose )
129145 @eval begin
130146 @interface :: AbstractSparseArrayInterface storedvalues (a:: $type ) = storedparentvalues (a)
131- @interface :: AbstractSparseArrayInterface function isstored (a:: $type , I:: Int... )
132- return isstored (parent (a), index_to_parentindex (a, I... )... )
133- end
134147 @interface :: AbstractSparseArrayInterface function eachstoredindex (a:: $type )
135148 # TODO : Make lazy with `Iterators.map`.
136149 return map (collect (eachstoredparentindex (a))) do I
180193@interface :: AbstractArrayInterface eachstoredindex (D:: Diagonal ) =
181194 _diagind (D, IndexCartesian ())
182195
183- @interface :: AbstractArrayInterface isstored (D:: Diagonal , i:: Int , j:: Int ) =
184- i == j && Base. checkbounds (Bool, D, i, j)
196+ function isstored (D:: Diagonal , i:: Int , j:: Int )
197+ return i == j && checkbounds (Bool, D, i, j)
198+ end
185199@interface :: AbstractArrayInterface function getstoredindex (D:: Diagonal , i:: Int , j:: Int )
186200 return D. diag[i]
187201end
0 commit comments