Skip to content

Commit

Permalink
remove obsolete parentdims (#35047)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssikdar1 authored and KristofferC committed Apr 11, 2020
1 parent 89bb787 commit 8f93ded
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 25 deletions.
18 changes: 0 additions & 18 deletions base/subarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -408,21 +408,3 @@ function _indices_sub(i1::AbstractArray, I...)
@_inline_meta
(unsafe_indices(i1)..., _indices_sub(I...)...)
end

## Compatibility
# deprecate?
function parentdims(s::SubArray)
nd = ndims(s)
dimindex = Vector{Int}(undef, nd)
sp = strides(s.parent)
sv = strides(s)
j = 1
for i = 1:ndims(s.parent)
r = s.indices[i]
if j <= nd && (isa(r,AbstractRange) ? sp[i]*step(r) : sp[i]) == sv[j]
dimindex[j] = i
j += 1
end
end
dimindex
end
7 changes: 0 additions & 7 deletions test/subarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,6 @@ sA = view(A, 2:2, 1:5, :)
@test @inferred(strides(sA)) == (1, 3, 15)
@test parent(sA) == A
@test parentindices(sA) == (2:2, 1:5, Base.Slice(1:8))
@test Base.parentdims(sA) == [1:3;]
@test size(sA) == (1, 5, 8)
@test axes(sA) === (Base.OneTo(1), Base.OneTo(5), Base.OneTo(8))
@test sA[1, 2, 1:8][:] == [5:15:120;]
Expand All @@ -363,7 +362,6 @@ sA[2:5:end] .= -1
@test stride(sA,4) == 120
test_bounds(sA)
sA = view(A, 1:3, 1:5, 5)
@test Base.parentdims(sA) == [1:2;]
sA[1:3,1:5] .= -2
@test all(A[:,:,5] .== -2)
fill!(sA, -3)
Expand All @@ -373,14 +371,12 @@ sA[:] .= 4
@test @inferred(strides(sA)) == (1,3)
test_bounds(sA)
sA = view(A, 1:3, 3:3, 2:5)
@test Base.parentdims(sA) == [1:3;]
@test size(sA) == (3,1,4)
@test axes(sA) === (Base.OneTo(3), Base.OneTo(1), Base.OneTo(4))
@test sA == A[1:3,3:3,2:5]
@test sA[:] == A[1:3,3,2:5][:]
test_bounds(sA)
sA = view(A, 1:2:3, 1:3:5, 1:2:8)
@test Base.parentdims(sA) == [1:3;]
@test @inferred(strides(sA)) == (2,9,30)
@test sA[:] == A[1:2:3, 1:3:5, 1:2:8][:]
# issue #8807
Expand Down Expand Up @@ -409,7 +405,6 @@ A = copy(reshape(1:120, 3, 5, 8))
sA = view(A, 2, :, 1:8)
@test parent(sA) == A
@test parentindices(sA) == (2, Base.Slice(1:5), 1:8)
@test Base.parentdims(sA) == [2:3;]
@test size(sA) == (5, 8)
@test axes(sA) === (Base.OneTo(5), Base.OneTo(8))
@test @inferred(strides(sA)) == (3,15)
Expand All @@ -421,13 +416,11 @@ sA[2:5:end] .= -1
@test all(A[5:15:120] .== -1)
test_bounds(sA)
sA = view(A, 1:3, 1:5, 5)
@test Base.parentdims(sA) == [1:2;]
@test size(sA) == (3,5)
@test axes(sA) === (Base.OneTo(3),Base.OneTo(5))
@test @inferred(strides(sA)) == (1,3)
test_bounds(sA)
sA = view(A, 1:2:3, 3, 1:2:8)
@test Base.parentdims(sA) == [1,3]
@test size(sA) == (2,4)
@test axes(sA) === (Base.OneTo(2), Base.OneTo(4))
@test @inferred(strides(sA)) == (2,30)
Expand Down

0 comments on commit 8f93ded

Please sign in to comment.