@@ -188,10 +188,10 @@ _reshape(R::ReshapedArray, dims::Dims) = _reshape(R.parent, dims)
188188
189189function __reshape (p:: Tuple{AbstractArray,IndexStyle} , dims:: Dims )
190190 parent = p[1 ]
191- strds = front (size_to_strides ( map (length, axes ( parent)) ... , 1 ))
192- strds1 = map (s-> max (1 ,Int (s)), strds ) # for resizing empty arrays
193- mi = map (SignedMultiplicativeInverse, strds1 )
194- ReshapedArray (parent, dims, reverse (mi) )
191+ szs = front (size ( parent))
192+ szs1 = map (s-> max (1 ,Int (s)), szs ) # for resizing empty arrays
193+ mi = map (SignedMultiplicativeInverse, szs1 )
194+ ReshapedArray (parent, dims, mi )
195195end
196196
197197function __reshape (p:: Tuple{AbstractArray{<:Any,0},IndexCartesian} , dims:: Dims )
@@ -216,11 +216,11 @@ unaliascopy(A::ReshapedArray) = typeof(A)(unaliascopy(A.parent), A.dims, A.mi)
216216dataids (A:: ReshapedArray ) = dataids (A. parent)
217217
218218@inline ind2sub_rs (ax, :: Tuple{} , i:: Int ) = (i,)
219- @inline ind2sub_rs (ax, strds , i) = _ind2sub_rs (ax, strds , i - 1 )
220- @inline _ind2sub_rs (ax, :: Tuple{} , ind) = (ind + first (ax[end ]),)
221- @inline function _ind2sub_rs (ax, strds , ind)
222- d, r = divrem (ind, strds [1 ])
223- (_ind2sub_rs (front (ax), tail (strds ), r )... , d + first (ax[ end ]) )
219+ @inline ind2sub_rs (ax, szs , i) = _ind2sub_rs (ax, szs , i - 1 )
220+ @inline _ind2sub_rs (ax, :: Tuple{} , ind) = (ind + first (ax[1 ]),)
221+ @inline function _ind2sub_rs (ax, szs , ind)
222+ d, r = divrem (ind, szs [1 ])
223+ (r + first (ax[ 1 ]), _ind2sub_rs (tail (ax), tail (szs ), d )... )
224224end
225225offset_if_vec (i:: Integer , axs:: Tuple{<:AbstractUnitRange} ) = i + first (axs[1 ]) - 1
226226offset_if_vec (i:: Integer , axs:: Tuple ) = i
0 commit comments