Repository navigation
Order NaN, missing, and -0.0 like Base in ChainedVector findmin and extrema - #134
Open
quinnj-bot[bot] wants to merge 2 commits into
Open
quinnj-bot[bot] wants to merge 2 commits into
quinnj-bot[bot] wants to merge 2 commits into
Conversation
Fails on main; passes with the next commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…xtrema findmin compared chunk values with isless, so NaN and missing never won, and extrema combined chunks with < and >, which skips NaN, throws on missing, and drops the sign of -0.0. Use Base's findmax/findmin on each chunk and then on the chunk winners, and combine extrema with minimum and maximum. findmax(f, A) needs Julia 1.7, so raise the floor to 1.10, which General's AutoMerge already requires. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Why
A
ChainedVectorshould give the same answers as the same data in aVector.findmin,argmin, andextremadid not when the data hasNaN,missing, or-0.0. Base treatsNaNandmissingas the minimum forfindminand propagates them throughextrema. TheChainedVectormethods compared values withislessand<instead, so they skippedNaN, threw onmissing, and lost the sign of-0.0:What changed
findmaxandfindmincall Base'sfindmax/findminon each chunk, then on the chunk winners, so Base decides every comparison, including ties.extremacombines the chunk results with Base'sminimumandmaximum.findmax(f, A)andfindmin(f, A), which do the per-chunk work, need Julia 1.7.Scope
NaN,missing, or-0.0give the same results as before.resize!,append!, andprepend!are a separate fix.Blast radius
Callers that hit
NaN,missing, or-0.0now get Base's answer. The next release must be a minor version (1.5.0), because General's AutoMerge allows narrowing thejuliacompat range only in a non-patch release. Users on Julia 1.3 to 1.9 stay on SentinelArrays 1.4.x.Verification
mainand passes on this branch (Julia 1.12.6).Vectorat every split point of six inputs with ties, severalNaNs,missing, and both zero signs.ChainedVector,SentinelVector, andMissingVector, compared withVector) reports this mismatch onmainand not with the fixes applied.Float64values in 8 chunks, Julia 1.12.6, Chairmarks minimum of 2 interleaved runs per side on a loaded shared machine):findmax63 → 12.5 ms andfindmin63 → 13 ms, because Base'sfindmaxon each chunk is faster than the old loop.findminonIntdata 5.4 → 5.6 ms.extremastays at 43 ms.🤖 Generated with Claude Code