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

1.11 release notes don't mention new multidimensional logical indexing feature #55923

Open
rversteegen opened this issue Sep 29, 2024 · 0 comments
Labels
domain:arrays [a, r, r, a, y, s] domain:docs This change adds or pertains to documentation

Comments

@rversteegen
Copy link

I've been reading the 1.11.0-rc3 manual although I still have 1.10 installed, and came across one example which doesn't work in 1.10. So I looked in the 1.11.0-rc3 Release Notes but there's nothing. I suggest adding it but I'm not sure exactly the extent of what's new.

The example from the Logical indexing section which doesn't work in 1.10:

julia> x = reshape(1:12, 2, 3, 2)
2×3×2 reshape(::UnitRange{Int64}, 2, 3, 2) with eltype Int64:
[:, :, 1] =
 1  3  5
 2  4  6

[:, :, 2] =
 7   9  11
 8  10  12

julia> x[:, [true false; false true; true false]]
2×3 Matrix{Int64}:
 1  5   9
 2  6  10

in v1.10 gives:

julia> x[:, [true false; false true; true false]]
ERROR: BoundsError: attempt to access 2×3×2 reshape(::UnitRange{Int64}, 2, 3, 2) with eltype Int64 at index [1:2, 3×2 Matrix{Bool}]

The corresponding example in the 1.10 manual is:

julia> x[[false, true, true, false], :]
2×4 Matrix{Int64}:
 2  6  10  14
 3  7  11  15

Also, this is very difficult to read example which I spent a long time trying to understand, it would be far easier if it were x[[true false false; true true false], :] instead (AFAIU) so the dimensions don't permute.

@nsajko nsajko added domain:docs This change adds or pertains to documentation domain:arrays [a, r, r, a, y, s] labels Sep 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:arrays [a, r, r, a, y, s] domain:docs This change adds or pertains to documentation
Projects
None yet
Development

No branches or pull requests

2 participants