Skip to content

Commit

Permalink
Fix #2844
Browse files Browse the repository at this point in the history
  • Loading branch information
timholy committed Apr 12, 2013
1 parent d3c66e9 commit db48dae
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion base/subarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ function translate_indexes(s::SubArray, I::Union(Real,AbstractArray)...)
j = 1
for i = 1:ndp
t = s.indexes[i]
if s.strides[j] == sp[i]
if j <= nds && s.strides[j] == sp[i]
#TODO: don't generate the dense vector indexes if they can be ranges
if j==n && n < nds
newindexes[i] = translate_linear_indexes(s, j, I[j])
Expand Down
3 changes: 3 additions & 0 deletions test/arrayops.jl
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ sA = sub(A, 2, 1:5, 1:8)
sA[2:5:end] = -1
@test all(sA[2:5:end] .== -1)
@test all(A[5:15:120] .== -1)
sA = sub(A, 1:3, 1:5, 5)
sA[1:3,1:5] = -2
@test all(A[:,:,5] .== -2)

# slice
A = reshape(1:120, 3, 5, 8)
Expand Down

0 comments on commit db48dae

Please sign in to comment.