@@ -106,10 +106,6 @@ function storedparentvalues(a::SubArray)
106
106
return StoredValues (parent (a), collect (eachstoredparentindex (a)))
107
107
end
108
108
109
- @interface :: AbstractArrayInterface function isstored (a:: SubArray , I:: Int... )
110
- return isstored (parent (a), index_to_parentindex (a, I... )... )
111
- end
112
-
113
109
using LinearAlgebra: Transpose
114
110
function parentindex_to_index (a:: Transpose , I:: CartesianIndex{2} )
115
111
return cartesianindex_reverse (I)
@@ -124,13 +120,30 @@ function value_to_parentvalue(a::Transpose, value)
124
120
return transpose (value)
125
121
end
126
122
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
+
127
143
# TODO : Turn these into `AbstractWrappedSparseArrayInterface` functions?
128
144
for type in (:Adjoint , :PermutedDimsArray , :ReshapedArray , :SubArray , :Transpose )
129
145
@eval begin
130
146
@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
134
147
@interface :: AbstractSparseArrayInterface function eachstoredindex (a:: $type )
135
148
# TODO : Make lazy with `Iterators.map`.
136
149
return map (collect (eachstoredparentindex (a))) do I
180
193
@interface :: AbstractArrayInterface eachstoredindex (D:: Diagonal ) =
181
194
_diagind (D, IndexCartesian ())
182
195
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
185
199
@interface :: AbstractArrayInterface function getstoredindex (D:: Diagonal , i:: Int , j:: Int )
186
200
return D. diag[i]
187
201
end
0 commit comments