Repository navigation
Throw from any and all of a sparse array on a non-Boolean value, as dense does - #1056
Merged
Merged
Conversation
…as dense does Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ViralBShah
enabled auto-merge (squash)
October 13, 2026 03:14
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1056 +/- ##
==========================================
+ Coverage 94.75% 94.78% +0.02%
==========================================
Files 16 16
Lines 9885 9886 +1
==========================================
+ Hits 9367 9370 +3
+ Misses 518 516 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
anyandallof a sparse matrix or vector reduce the predicate's values with|and&and never check that they are Boolean, so a non-Boolean value is returned as the result where dense throws aTypeError. Next to amissingit is absorbed, and the result ismissing.Before
After
Base._anyandBase._allforSparseMatrixCSCOrColumnSubsetandSparseVectorOrViewpass the predicate straight to the|/&_mapreducekernels, which accept any value those operators do. They now pass_boolean ∘ f, where_booleanlets aBoolormissingthrough and asserts::Boolon anything else, the check the dense reductions make on each value. The composed predicate still specializes:any(iszero, A)andall(!iszero, A)at 10^6 stored entries take the same time and allocations as onmain. The reductions along a dimension (dims=1) are not touched here.Split from #1022.
This is a bug fix and could be backported, with the caveat that calls which returned a non-Boolean value now throw.
Written by Claude Code.
🤖 Generated with Claude Code