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
help?> ind2sub
search: ind2sub
ind2sub(a, index) -> subscripts
Returns a tuple of subscripts into array a corresponding to the linear index index.
Examples
≡≡≡≡≡≡≡≡≡≡
julia> A = ones(5,6,7);
julia> ind2sub(A,35)
(5, 1, 2)
julia> ind2sub(A,70)
(5, 2, 3)
ind2sub(dims, index) -> subscripts
Returns a tuple of subscripts into an array with dimensions dims, corresponding to the linear index index.
Examples
≡≡≡≡≡≡≡≡≡≡
i, j, ... = ind2sub(size(A), indmax(A))
...
What happens when you run the last line in the above example:
julia> A = ones(5, 6, 7);
julia> ind2sub(size(A), indmax(A))
ERROR: MethodError: no method matching ind2sub(::Tuple{Int64,Int64,Int64}, ::CartesianIndex{3})
Closest candidates are:
ind2sub(::AbstractArray, ::Any) at abstractarray.jl:1617
ind2sub(::Tuple{Vararg{Integer,N}} where N, ::Integer) at abstractarray.jl:1694
ind2sub(::Union{Tuple{Vararg{Integer,N}}, Tuple{Vararg{AbstractUnitRange,N}}}, ::AbstractArray{#s51,1} where #s51<:Integer) where N at abstractarray.jl:1750
The change happened in #22907, which changed the output of indmax from a linear index to a Cartesian index if the input is multidimensional.
The text was updated successfully, but these errors were encountered:
This is great --- we can remove the example, since you no longer need ind2sub in that case. Once all the examples are removed, we can remove the function :)
The help text:
What happens when you run the last line in the above example:
The change happened in #22907, which changed the output of
indmax
from a linear index to a Cartesian index if the input is multidimensional.The text was updated successfully, but these errors were encountered: