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

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

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

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

timholy opened this issue Sep 16, 2013 · 3 comments

Comments

@timholy
Copy link
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 added a commit that referenced this issue Sep 16, 2013
@ivarne
Copy link
Member

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
Copy link
Member Author

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
Copy link
Member

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//issues/4284#issuecomment-24547652
.

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