Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this? (check all applicable)
Related issues
Follow-up to #1026. The wider advanced-indexing work is tracked in #114.
Checklist
Please explain your changes below.
For
x = sparse.COO.from_numpy(np.array([[3, 4], [5, 6]]))andmask = np.eye(2, dtype=bool),x[mask]returns[[4, 6], [4, 6]]onmain. NumPy selects the diagonal and returns[3, 6].Before #1026, this unsupported multidimensional dense mask raised
IndexError. The new integer-array path can interpret the mask's two coordinate vectors as one integer index. This restores the error before the coordinates are passed to that path. For a multidimensional boolean selection,x[sparse.COO.from_numpy(mask)]already returns[3, 6]on both COO and GCXS.The four regression cases exercise NumPy masks and nested Python lists on both formats. The Numba backend suite passed on both revisions, with 7,598 passing tests on
mainand 7,602 on this branch. Ruff and its format check passed.OpenAI Codex assisted with implementation, testing and this description.