SubArray indexing with (integer valued) floats is broken #3148

Closed
toivoh opened this Issue May 19, 2013 · 0 comments

Projects

None yet

1 participant

@toivoh
The Julia Language member

Some examples:

julia> sub(eye(4),1:2,1:2)[1.0,1.0]
ERROR: indexing not defined for Range1{Int64}
 in error at error.jl:22
 in getindex at abstractarray.jl:475
 in translate_indexes at subarray.jl:210
 in getindex at subarray.jl:248

julia> sub(eye(4),1:2,1:2)[1.0]
ERROR: no method ind2sub((Int64,Int64),Float64)
 in translate_linear_indexes at subarray.jl:228
 in translate_indexes at subarray.jl:208
 in getindex at subarray.jl:248

julia> sub(eye(4),1:2:4,1:2:4)[1.0,1.0]
ERROR: reshape: invalid dimensions
 in reshape at array.jl:140
 in getindex at subarray.jl:255

julia> sub(eye(4),1:2:4,1:2:4)[1.0]
ERROR: reshape: invalid dimensions
 in reshape at array.jl:140
 in getindex at subarray.jl:255

The same examples with 1 as index instead of 1.0 work as expected.

@JeffBezanson JeffBezanson added a commit that closed this issue May 20, 2013
@JeffBezanson JeffBezanson fix #3148, SubArray indexing with floats
also add float indexing for Ranges
a59dfab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment