EllipsisNotation.jl
EllipsisNotation.jl copied to clipboard
"end" indexing not working properly
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.
Thanks the best thing to do would be to try and fix this. @mbauman might have ideas?
This is effectively the same as https://github.com/JuliaLang/julia/issues/35681 and won't be fixable until that one is.
Can we add a note of this in the Readme? Like a warning admonition.
Yeah, it's worth mentioning.
https://github.com/ChrisRackauckas/EllipsisNotation.jl/pull/44
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
Sounds like a good idea, please submit a PR