Skip to content

Deprecate variance APIs in favor of mir-stat - #496

Open
jmh530 wants to merge 1 commit into
libmir:masterfrom
jmh530:codex/deprecate-variance
Open

jmh530 wants to merge 1 commit into
libmir:masterfrom
jmh530:codex/deprecate-variance

Conversation

@jmh530

@jmh530 jmh530 commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Deprecate variance, standardDeviation, VarianceAccumulator, and VarianceAlgo in mir.math.stat, directing callers to the corresponding exports from mir.stat.descriptive.

This supersedes the approach proposed in #465 by directing statistical development to mir-stat while preserving the existing mir-algorithm implementations, signatures, accumulator state, and online defaults.

Migration and compatibility

All function overloads and accumulator specializations receive deprecation messages. Existing calls retain their behavior, but builds treating deprecations as errors (-de) will require migration.

The module documentation explains how to add mir-stat and update selective imports. It also identifies migration differences: mir-stat defaults to hybrid variance, rounding may differ, the enum types are distinct, and code using accumulator state or constructors needs separate review.

This change does not deprecate the rest of mir.math.stat or add a dependency on mir-stat.

Validation

  • Windows DMD 2.113 and LDC 1.43 each passed the 27-module mir_test harness.
  • A focused legacy-call probe ran successfully and verified deprecation messages for all eight function template entry points, four accumulator specializations, and the enum.
  • A migration example using the public mir.stat.descriptive import compiled with -de and ran against mir-stat master after Use mir-stat hybrid variance for Scott's histogram rule mir-stat#193.
  • Whitespace checks passed.

The full repository test suite was not run locally.

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

Deprecate variance, standardDeviation, VarianceAccumulator, and
VarianceAlgo, directing callers to mir.stat.descriptive. Cover all
function overloads and accumulator specializations while preserving
the legacy implementations and online defaults.

Document the mir-stat dependency and replacement import, its hybrid
default, and potential rounding differences. Explain that enum types
are distinct and code using accumulator state or constructors needs
separate migration review.

AI-Assisted-By: Codex (GPT-6 Astra Medium)
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