Skip to content

Use values-first ordering across weighted statistical APIs - #183

Merged
jmh530 merged 1 commit into
libmir:masterfrom
jmh530:codex/weighted-quantile-values-first
Oct 19, 2026
Merged

jmh530 merged 1 commit into
libmir:masterfrom
jmh530:codex/weighted-quantile-values-first

Conversation

@jmh530

@jmh530 jmh530 commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Weighted quantiles and histogram APIs previously placed weights before observations, unlike weighted means and sums. This change establishes consistent ordering: observation inputs first, weights next, and axis or probability configuration afterward. Custom-allocation factories retain the allocator as their first argument.

The convention applies to weighted quantiles, histogram and relative-frequency construction, percentograms, quantile axes, and incremental updates. Multidimensional calls place all coordinates before weights:

  • weightedQuantile(values, weights, probabilities)
  • weightedHistogram(x, y, weights, xAxis, yAxis)
  • h.putWeighted(x, y, weight)
  • h.putWeightedSample(sample, x, y, weight)
  • weightedHistogram!Cell(samples, x, y, weights, xAxis, yAxis)

Internal callers, shared test adapters, examples, and documentation are updated together. Statistical algorithms, weight semantics, and storage ownership remain unchanged.

Compatibility

This intentionally breaks existing weight-first calls. Callers must reorder arguments even when matching argument types still allow the old calls to compile. Regression coverage uses asymmetric, same-typed observations and weights to distinguish the two orderings.

Validation

  • Full DMD unit suite with project and histogram tests: 67 modules passed.
  • Full LDC suite with DIP1000 and lifetime checks: 69 modules passed.
  • DMD documentation check passed.
  • Linux HTML documentation build produced 81 pages; checked quantile/entropy links and legacy univariate anchors.
  • Final branch whitespace check passed.

The final review correction changed only an example comment; executable code was unchanged after these tests.

AI-Assisted-By: Codex (GPT-6 Astra Medium)

Align weighted quantiles and histogram APIs with weighted means
and sums: observation inputs precede weights, followed by axis
or probability configuration. Custom-allocation factories retain
the allocator as their first argument.

Apply the convention to weighted histogram and relative-frequency
construction, percentograms, quantile axes, and incremental updates.
Multidimensional calls place every coordinate before the weight;
weighted sample updates take sample, coordinates, then weight.
Preserve reference forwarding and existing storage ownership.

Update internal callers, shared test adapters, examples, and
documentation together. Cover same-typed asymmetric quantile inputs
that distinguish observations from weights, and retain the expected
results throughout the migrated histogram tests.

This intentionally breaks existing weight-first calls. Callers must
reorder arguments even when their types still permit compilation.
Statistical algorithms and weight semantics remain unchanged.

AI-Assisted-By: Codex (GPT-6 Astra Medium)
@codecov

codecov Bot commented Oct 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@jmh530
jmh530 merged commit edd5a0a into libmir:master Oct 19, 2026
26 checks passed
@jmh530
jmh530 deleted the codex/weighted-quantile-values-first branch October 19, 2026 01:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant