You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#TODO: uncomment when deprecation period for partial linear indexing has ended
836
+
# function _to_linear_index(A::AbstractVector, J::Tuple, Jrem::Tuple{})
837
+
# throw(ArgumentError("partial linear indexing is not allowed. Use `reshape(A, Val{$(length(J))})` to make the dimensionality of the array match the number of indices"))
838
+
# end
839
+
# function _to_linear_index(A::AbstractArray, J::Tuple, Jrem::Tuple{})
840
+
# throw(ArgumentError("partial linear indexing is not allowed. Use `reshape(A, Val{$(length(J))})` to make the dimensionality of the array match the number of indices"))
841
+
# end
839
842
840
843
## LinearSlow Scalar indexing: Canonical method is full dimensionality of Ints
J, _ = IteratorsMD.split(I, Val{N}) # (maybe) drop any trailing indices
857
-
sz =_remaining_size(J, size(A)) # compute trailing size (overlapping the final index)
858
-
(front(J)..., _unsafe_ind2sub(sz, last(J))...) # (maybe) extend the last index
859
-
end
857
+
J, Jrem = IteratorsMD.split(I, Val{N})
858
+
_to_subscript_indices(A, J, Jrem)
859
+
end
860
+
_to_subscript_indices(A, J::Tuple, Jrem::Tuple) = J # already bounds-checked, safe to drop Jrem
861
+
#TODO: uncomment when deprecation period for partial linear indexing has ended
862
+
# function _to_subscript_indices(A::AbstractArray, J::Tuple, Jrem::Tuple{})
863
+
# throw(ArgumentError("partial linear indexing is not allowed. Use `reshape(A, Val{$(length(J))})` to make the dimensionality of the array match the number of indices"))
864
+
# end
860
865
_to_subscript_indices{T,N}(A::AbstractArray{T,N}, I::Vararg{Int,N}) = I
check_oneto(inds::Tuple{AbstractUnitRange,Vararg{AbstractUnitRange}}) =error("partial linear indexing is not supported for arrays with non-1 indexing")
depwarn("partial linear indexing is deprecated. Use `reshape(A, Val{$(length(J))})` to make the dimensionality of the array match the number of indices", :_to_linear_index)
1041
+
sub2ind(A, J...)
1069
1042
end
1070
-
functionpartial_linear_indexing_warning(n)
1071
-
depwarn("Partial linear indexing is deprecated. Use `reshape(A, Val{$n})` to make the dimensionality of the array match the number of indices.", (:getindex, :setindex!, :view))
depwarn("partial linear indexing is deprecated. Use `reshape(A, Val{$(length(J))})` to make the dimensionality of the array match the number of indices", :_to_subscript_indices)
1046
+
sz =_remaining_size(J, indices(A)) # compute trailing size (overlapping the final index)
1047
+
(front(J)..., _unsafe_ind2sub(sz, last(J))...)
1072
1048
end
1073
1049
1074
1050
# Deprecate Array(T, dims...) in favor of proper type constructors
@@ -1262,6 +1238,8 @@ for f in (:airyai, :airyaiprime, :airybi, :airybiprime, :airyaix, :airyaiprimex,
1262
1238
end
1263
1239
1264
1240
# END 0.6 deprecations
1241
+
# IMPORTANT: when the 0.6 deprecations are removed, uncomment error messages for
1242
+
# _to_linear_index and _to_subscript_indices in abstractarray.jl
0 commit comments