Skip to content

Disallow Bool indices in structured matrix indexing #54475

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

Merged
merged 2 commits into from
May 16, 2024
Merged

Conversation

jishnub
Copy link
Member

@jishnub jishnub commented May 15, 2024

Currently,

julia> B = Bidiagonal(1:3, 1:2, :U)
3×3 Bidiagonal{Int64, UnitRange{Int64}}:
 1  1  
   2  2
     3

julia> B[3, true]
0

julia> Matrix(B)[3, true]
ERROR: ArgumentError: invalid index: true of type Bool

This PR changes the behavior to

julia> B[3, true]
ERROR: ArgumentError: invalid index: true of type Bool

@jishnub jishnub added linear algebra Linear algebra arrays [a, r, r, a, y, s] labels May 15, 2024
@jishnub jishnub force-pushed the jishnub/getindexint branch from 20d19a8 to 35a3812 Compare May 16, 2024 06:48
@jishnub jishnub merged commit 2877cbc into master May 16, 2024
7 checks passed
@jishnub jishnub deleted the jishnub/getindexint branch May 16, 2024 12:07
@martinholters
Copy link
Member

Any chance this has been used anywhere?

@jishnub
Copy link
Member Author

jishnub commented May 16, 2024

A PkgEval run might help us catch that, so let's see. I doubt it, though.

lazarusA pushed a commit to lazarusA/julia that referenced this pull request Jul 12, 2024
Currently,
```julia
julia> B = Bidiagonal(1:3, 1:2, :U)
3×3 Bidiagonal{Int64, UnitRange{Int64}}:
 1  1  ⋅
 ⋅  2  2
 ⋅  ⋅  3

julia> B[3, true]
0

julia> Matrix(B)[3, true]
ERROR: ArgumentError: invalid index: true of type Bool
```
This PR changes the behavior to
```julia
julia> B[3, true]
ERROR: ArgumentError: invalid index: true of type Bool
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrays [a, r, r, a, y, s] linear algebra Linear algebra
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants