Skip to content

Commit

Permalink
Merge pull request #28733 from JuliaLang/ksh/parentinds
Browse files Browse the repository at this point in the history
Example for parentindices
  • Loading branch information
kshyatt authored Aug 19, 2018
2 parents 640fc09 + 24df8fb commit 80a170a
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion base/subarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,20 @@ parentindices(V::SubArray) = V.indices
"""
parentindices(A)
From an array view `A`, returns the corresponding indices in the parent.
Return the indices in the [`parent`](@ref) which correspond to the array view `A`.
# Examples
```jldoctest
julia> A = [1 2; 3 4];
julia> V = view(A, 1, :)
2-element view(::Array{Int64,2}, 1, :) with eltype Int64:
1
2
julia> parentindices(V)
(1, Base.Slice(Base.OneTo(2)))
```
"""
parentindices(a::AbstractArray) = map(OneTo, size(a))

Expand Down

0 comments on commit 80a170a

Please sign in to comment.