-
Notifications
You must be signed in to change notification settings - Fork 64
Indexing with negative step sizes #24
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
Comments
The C++ side can almost handle negative step sizes, the only obvious roadblock I see is there being no way to specify seq.begin at the end of the array. calcDims() needs a few changes to take the negative steps into account, in particular in the case when the begin and end are not specified. |
Can this be closed after the PR ? |
I'm afraid not, the issue is deeper. There's no easy way to do array[::-1] because there's no way (that I know) to specify that seq.begin corresponds to the end of the array in the C/C++ API. The fixes I did only handle cases where the begin and end are specified. |
af::seq(end,0, -1) does not work ? |
Nope it gives:
Code:
|
OK, I think I can still handle this in python itself. If you are not working on this and #26 I will give a shot at fixing them. |
If you look at calcDims when end is 0 you end up on: which will fail as af::end is smaller than -DBL_MIN |
I'm not working on it, I have workarounds for my code. |
Ok, I think I am going to handle this upstream. The workarounds are ugly. |
This is fixed in 3.1.1 release. I think we can safely close this. |
Currently arrays cannot be indexed with negative step sizes.
The text was updated successfully, but these errors were encountered: