Repository navigation
Remove the row cutoff for single weighted inverse-CDF requests - #299
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Use partition selection for eligible interior probabilities on small unordered inputs. Share a compile-time predicate for inverseCDF and averagedInverseCDF across validation, selection, and table support. Replace the cutoff tests with a three-row case that exercises both algorithms at an exact weight boundary. Document the same example in the quantile selection design notes. AI-Assisted-By: Codex (GPT-6 Astra Medium)
jmh530
force-pushed
the
codex/small-weighted-inverse-cdf
branch
from
November 18, 2026 01:02
04aef68 to
0c0317e
Compare
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.
#297 uses partition selection for a single
inverseCDForaveragedInverseCDFrequest starting at 16 positive-weight rows. This PR removes that cutoff. In two Ubuntu LDC 1.36 benchmark runs, selection reduced median end-to-end RC call time at every size from 3 through 15 unordered rows for both algorithms. At three rows, scalar calls took about 30% less time and one-element batches took about 24% less time.The change applies to interior probabilities with integer relative weights. Ordered inputs still take their existing path, and selection retains its exact-sum check, signed-zero handling, and partition work limit. A private compile-time predicate identifies the two inverse-CDF algorithms across validation, selection, sorted preparation, and table support.
The regression test and design notes use the same three-row example. With values
[30, 10, 20]and weights[1, 1, 2], the value10holds exactly 25% of the total weight. Atp = 0.25,inverseCDFreturns10, whileaveragedInverseCDFaverages10and20to return15.Validation
Windows DMD 2.113 with DIP1000 passed all 42 modules in the focused unit-test run. Optimized Ubuntu LDC 1.36 with DIP1000 passed 440 comparisons against #297, including signed zeros, oversized weights, floating-point weights, zero-weight rows, and integer observations above
2^53.Merge order
This PR adds one commit on top of #297. Merge #297 first, then rebase this branch onto
master. The follow-up can be reviewed independently in commit 04aef68.AI-Assisted-By: Codex (GPT-6 Astra Medium)