sub(sub(A,...),...) violates type-stability of range indexes #4284

Closed
timholy opened this Issue Sep 16, 2013 · 3 comments

Projects

None yet

2 participants

@timholy
Member
timholy commented Sep 16, 2013

Below, note that C has Range{Int} indexes, not Range1{Int} indexes:

julia> A = rand(5,8)
5x8 Array{Float64,2}:
 0.193495   0.30075   0.35577   0.732839  0.0630376  0.557629  0.796763  0.189508 
 0.0549164  0.956992  0.110021  0.784863  0.997136   0.85131   0.918621  0.0749185
 0.139314   0.397999  0.716274  0.895523  0.831972   0.676884  0.467294  0.210944 
 0.997668   0.452485  0.611425  0.854269  0.249668   0.286255  0.260939  0.441991 
 0.147179   0.294705  0.226399  0.331314  0.263987   0.937     0.205331  0.434741 

julia> B = slice(A, 1:5, 1:8)
5x8 SubArray{Float64,2,Array{Float64,2},(Range1{Int64},Range1{Int64})}:
 0.193495   0.30075   0.35577   0.732839  0.0630376  0.557629  0.796763  0.189508 
 0.0549164  0.956992  0.110021  0.784863  0.997136   0.85131   0.918621  0.0749185
 0.139314   0.397999  0.716274  0.895523  0.831972   0.676884  0.467294  0.210944 
 0.997668   0.452485  0.611425  0.854269  0.249668   0.286255  0.260939  0.441991 
 0.147179   0.294705  0.226399  0.331314  0.263987   0.937     0.205331  0.434741 

julia> C = slice(B, 1:5, 1:8)
5x8 SubArray{Float64,2,Array{Float64,2},(Range{Int64},Range{Int64})}:
 0.193495   0.30075   0.35577   0.732839  0.0630376  0.557629  0.796763  0.189508 
 0.0549164  0.956992  0.110021  0.784863  0.997136   0.85131   0.918621  0.0749185
 0.139314   0.397999  0.716274  0.895523  0.831972   0.676884  0.467294  0.210944 
 0.997668   0.452485  0.611425  0.854269  0.249668   0.286255  0.260939  0.441991 
 0.147179   0.294705  0.226399  0.331314  0.263987   0.937     0.205331  0.434741 
@timholy timholy added a commit that closed this issue Sep 16, 2013
@timholy timholy Fix #4284 a4088e0
@timholy timholy closed this in a4088e0 Sep 16, 2013
@timholy timholy added a commit that referenced this issue Sep 16, 2013
@timholy timholy Fix #4284 for slices, too 219e60f
@ivarne
Collaborator
ivarne commented Sep 16, 2013

The commit a4088e0 did not change anything in the example for me on OSX.

see: https://gist.github.com/ivarne/047711ccc285335e4468

@timholy
Member
timholy commented Sep 16, 2013

Sorry, I tested a different example than the one I posted, then pushed too hastily. To fix this example, you also need 219e60f, which applies the same fix to another spot in the code.

@ivarne
Collaborator
ivarne commented Sep 16, 2013

OK. Just wanted to notify you in case you didn't notice.
Den 16. sep. 2013 23:49 skrev "Tim Holy" notifications@github.com
følgende:

Sorry, I tested a different example than the one I posted, then pushed too
hastily. To fix this example, you also need 219e60fhttps://github.com/JuliaLang/julia/commit/219e60f7a958fb1fbee352cc15f8e3df4356b30c,
which applies the same fix to another spot in the code.


Reply to this email directly or view it on GitHubhttps://github.com/JuliaLang/julia/issues/4284#issuecomment-24547652
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment