Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with subarray indexing #3755

Closed
rsrock opened this issue Jul 18, 2013 · 2 comments
Closed

Problems with subarray indexing #3755

rsrock opened this issue Jul 18, 2013 · 2 comments

Comments

@rsrock
Copy link
Member

rsrock commented Jul 18, 2013

Seems to affect ndims >= 3. This works:


julia> a = reshape(1:12, 3, 4)
3x4 Int64 Array:
 1  4  7  10
 2  5  8  11
 3  6  9  12

julia> b = slice(a, 1:2, 1:2)
2x2 SubArray of 3x4 Int64 Array:
 1  4
 2  5

julia> b[:]
4-element Int64 Array:
 1
 2
 4
 5

This does not:


julia> a = reshape(1:12, 3, 2, 2)
3x2x2 Int64 Array:
[:, :, 1] =
 1  4
 2  5
 3  6

[:, :, 2] =
 7  10
 8  11
 9  12

julia> b = slice(a, 1:2, 1:2, 1)
2x2 SubArray of 3x2x2 Int64 Array:
 1  4
 2  5

julia> b[:]
ERROR: BoundsError()
 in parentdims at subarray.jl:254
 in translate_linear_indexes at subarray.jl:240
 in translate_indexes at subarray.jl:223
 in getindex at subarray.jl:263

Perhaps related to #2844?

@timholy
Copy link
Member

timholy commented Jul 18, 2013

I almost have a fix ready, hold tight.

@timholy
Copy link
Member

timholy commented Jul 18, 2013

How do I hate index gymnastics? Let me count the ways...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants