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

"end" indexing not working properly #19

Open
Sixzero opened this issue Sep 10, 2020 · 7 comments
Open

"end" indexing not working properly #19

Sixzero opened this issue Sep 10, 2020 · 7 comments

Comments

@Sixzero
Copy link

Sixzero commented Sep 10, 2020

I believe there is something wrong with indexing.
Code:

using EllipsisNotation
A = randn(2,3,4);
@show size(A[.., 1:end]);

Output:

julia> using EllipsisNotation

julia> A = randn(2,3,4);

julia> @show size(A[.., 1:end]);
size(A[.., 1:end]) = (2, 3, 3)

The output should size should be (2, 3, 4) not (2, 3, 3).

I believe this is a critical issue and should be noted somewhere.

What is happeneing is that end will be equal to size(A, 2), which is 3 and not size(A, 3) which is 4 what is the real position of the "end" in this case.

Also worth noting:
@show size(A[.., 1:end-1]) # outputs: (2, 3, 2)

So basically at least the problem is with indexing positions and nothing more.

@ChrisRackauckas
Copy link
Member

Thanks the best thing to do would be to try and fix this. @mbauman might have ideas?

@mbauman
Copy link
Contributor

mbauman commented Sep 15, 2020

This is effectively the same as JuliaLang/julia#35681 and won't be fixable until that one is.

@cossio
Copy link
Contributor

cossio commented Jun 9, 2022

Can we add a note of this in the Readme? Like a warning admonition.

@ChrisRackauckas
Copy link
Member

Yeah, it's worth mentioning.

@cossio
Copy link
Contributor

cossio commented Jun 10, 2022

#44

@Socob
Copy link

Socob commented Mar 22, 2023

Would it make sense to add a pointer to EndpointRanges.jl in the README note? Using iend seems to be working correctly:

julia> using EllipsisNotation

julia> using EndpointRanges

julia> A = randn(2,3,4);

julia> @show size(A[.., 1:iend]);
size(A[.., 1:iend]) = (2, 3, 4)

julia> A[.., 1:iend] == A
true

@jishnub
Copy link

jishnub commented May 25, 2023

Sounds like a good idea, please submit a PR

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

6 participants