File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -70,10 +70,16 @@ function eachstoredparentindex(a::SubArray)
7070 return all (d -> I[d] ∈ parentindices (a)[d], 1 : ndims (parent (a)))
7171 end
7272end
73- function index_to_parentindex (a:: SubArray{<:Any,N} , I:: CartesianIndex{N} ) where {N}
73+ # Don't constrain the number of dimensions of the array
74+ # and index since the parent array can have a different
75+ # number of dimensions than the `SubArray`.
76+ function index_to_parentindex (a:: SubArray , I:: CartesianIndex )
7477 return CartesianIndex (Base. reindex (parentindices (a), Tuple (I)))
7578end
76- function parentindex_to_index (a:: SubArray{<:Any,N} , I:: CartesianIndex{N} ) where {N}
79+ # Don't constrain the number of dimensions of the array
80+ # and index since the parent array can have a different
81+ # number of dimensions than the `SubArray`.
82+ function parentindex_to_index (a:: SubArray , I:: CartesianIndex )
7783 nonscalardims = filter (tuple_oneto (ndims (parent (a)))) do d
7884 return ! (parentindices (a)[d] isa Real)
7985 end
You can’t perform that action at this time.
0 commit comments