Repository navigation
Fold init into mapreduce with | or & along the rows - #1069
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1069 +/- ##
==========================================
+ Coverage 94.75% 94.78% +0.02%
==========================================
Files 16 16
Lines 9885 9880 -5
==========================================
- Hits 9367 9365 -2
+ Misses 518 515 -3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ViralBShah
commented
Oct 13, 2026
ViralBShah
left a comment
Member
Author
There was a problem hiding this comment.
Reviewed by Codex at 23e1ae6.
No actionable findings. The initial-value short circuit and the negated-predicate path handle | and & consistently, including columns with implicit zeros and fully stored columns.
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.
mapreduce(pred, |, A; dims=1, init)andmapreduce(pred, &, A; dims=1, init)on a sparse matrix ignoreinit: the result is the reduction of each column alone, where dense folds it into the initial value.Before
After
The short-circuiting
_mapreducerows!kernel for|and&assigned each column's reduction toR[1, ii], which on entry holds the initial value. It now reads that value first, skips a column the initial value already decides, and stores the column's reduction otherwise. The&method reuses the|kernel with the negated predicate as before, but passes anegate::Boolflag in place of thepostfunction, so that the kernel can also interpret the initial value.mapreduce(>(2.0), |, A; dims=1)on a 10^4 × 10^3 matrix with 10^6 stored entries, none of which satisfies the predicate, takes 273 μs and 1280 bytes before and 274 μs and 1280 bytes after.Split from #1022.
This is a wrong result on released versions too (Julia 1.13 gives the same output), so it is a backport candidate.
Written by Claude Code.
🤖 Generated with Claude Code