Repository navigation
Conversation
this ended up being a bigger refactor than I expected, but I think this should be more generically correct
quinnj
left a comment
There was a problem hiding this comment.
The full suite passes on Julia 1.6.7 and 1.12.6, and the original Cartesian-block bug is fixed. Independent base/head probes found two regressions in existing indexing behavior, detailed inline. Current main preserves all 22 checks for those behaviors; this head has three shape failures on both versions and four additional Boolean-prefix errors on 1.6.7. Please preserve index ownership and the full indexing context before merging. The current patch-coverage check also fails.
AI disclosure: This work was prepared with assistance from OpenAI Codex.
| new_indices = to_indices(A, inds, (I[1].skip, tail(I)...)) | ||
| # Now the hard part is connecting the picks (from inds) and skips (from new_indices) | ||
| # The easy one to get is the number of dimensions (axes) that the inverted index spans: | ||
| n_picks = index_ndims(A, I[1].skip) |
There was a problem hiding this comment.
[P2] Keep the full indexing context for older Boolean masks
index_ndims(A, I[1].skip) always calls the one-index specialization, including when Not has a following index. On Julia 1.6.7, A = reshape(collect(1:24), 4, 3, 2); mask = falses(4, 3); mask[2:3, 1:2] .= true; A[Not(mask), 1] works on main and should equal A[:, :, 1][.!mask], but this head throws BoundsError. Both BitMatrix and Matrix{Bool}, including views, regress because picks spans one axis while the converted logical index spans two. Apply the legacy one-index adjustment only when the original I actually has one index; otherwise retain the mask dimension count.
AI disclosure: This work was prepared with assistance from OpenAI Codex.
| # This is a little tricky; we need to keep pulling inds out as long as they're 0-ndim | ||
| i1 = inds[1] | ||
| dims1 = index_ndims(A, i1) | ||
| return dims1 == () ? (i1, spanned_indices(A, tail(inds), ())...) : () |
There was a problem hiding this comment.
[P2] Preserve zero-dimensional indices after the inverted index
After all axes belonging to Not are consumed, this branch also consumes zero-dimensional Cartesian indices from tail(I). Those indices can add output dimensions. For A = reshape(collect(1:12), 4, 3), main returns a 3-by-1 matrix from A[Not(1), [CartesianIndex()], 1], matching A[2:4, [CartesianIndex()], 1]; this head returns a vector instead. Reproduced on Julia 1.6.7 and 1.12.6 with scalar, range, and vector skips. Distinguish the converted entries belonging to the skipped index from entries belonging to following indices rather than collecting every subsequent zero-axis entry into skips.
AI disclosure: This work was prepared with assistance from OpenAI Codex.
this ended up being a bigger refactor than I expected, but I think this should be more generically correct
Fixes #46