|
1 | 1 | parentvalue_to_value(a::AbstractArray, value) = value
|
2 | 2 | value_to_parentvalue(a::AbstractArray, value) = value
|
3 |
| -eachstoredparentindex(a::AbstractArray) = eachstoredparentindex(IndexStyle(a), a) |
| 3 | +eachstoredparentindex(a::AbstractArray) = eachstoredindex(parent(a)) |
4 | 4 | function eachstoredparentindex(style::IndexStyle, a::AbstractArray)
|
5 | 5 | return eachstoredindex(style, parent(a))
|
6 | 6 | end
|
@@ -147,13 +147,14 @@ end
|
147 | 147 | for type in (:Adjoint, :PermutedDimsArray, :ReshapedArray, :SubArray, :Transpose)
|
148 | 148 | @eval begin
|
149 | 149 | @interface ::AbstractSparseArrayInterface storedvalues(a::$type) = storedparentvalues(a)
|
| 150 | + @interface ::AbstractSparseArrayInterface function eachstoredindex(a::$type) |
| 151 | + return map(Base.Fix1(parentindex_to_index, a), eachstoredparentindex(a)) |
| 152 | + end |
150 | 153 | @interface ::AbstractSparseArrayInterface function eachstoredindex(
|
151 | 154 | style::IndexStyle, a::$type
|
152 | 155 | )
|
153 | 156 | # TODO: Make lazy with `Iterators.map`.
|
154 |
| - return map(eachstoredparentindex(style, a)) do I |
155 |
| - return parentindex_to_index(a, I) |
156 |
| - end |
| 157 | + return map(Base.Fix1(parentindex_to_index, a), eachstoredparentindex(style, a)) |
157 | 158 | end
|
158 | 159 | @interface ::AbstractSparseArrayInterface function getstoredindex(a::$type, I::Int...)
|
159 | 160 | return parentvalue_to_value(
|
|
0 commit comments