Skip to content

Commit ed9ef7c

Browse files
committed
improve backwards compatibility
1 parent 872e668 commit ed9ef7c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/wrappers.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
parentvalue_to_value(a::AbstractArray, value) = value
22
value_to_parentvalue(a::AbstractArray, value) = value
3-
eachstoredparentindex(a::AbstractArray) = eachstoredparentindex(IndexStyle(a), a)
3+
eachstoredparentindex(a::AbstractArray) = eachstoredindex(parent(a))
44
function eachstoredparentindex(style::IndexStyle, a::AbstractArray)
55
return eachstoredindex(style, parent(a))
66
end
@@ -147,13 +147,14 @@ end
147147
for type in (:Adjoint, :PermutedDimsArray, :ReshapedArray, :SubArray, :Transpose)
148148
@eval begin
149149
@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
150153
@interface ::AbstractSparseArrayInterface function eachstoredindex(
151154
style::IndexStyle, a::$type
152155
)
153156
# 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))
157158
end
158159
@interface ::AbstractSparseArrayInterface function getstoredindex(a::$type, I::Int...)
159160
return parentvalue_to_value(

0 commit comments

Comments
 (0)