Skip to content

More flexible and less brittle MvNormal and MvNormalCanon type aliases#2073

Merged
devmotion merged 3 commits into
masterfrom
dmw/aliases
Jun 26, 2026
Merged

More flexible and less brittle MvNormal and MvNormalCanon type aliases#2073
devmotion merged 3 commits into
masterfrom
dmw/aliases

Conversation

@devmotion

Copy link
Copy Markdown
Member

I always thought it's a bit weird that we mention these type aliases so prominently, even though they're only used for printing and dispatching in fit_mle.

Moreover, 1) they don't cover many multivariate normal distributions with dense/diagonal/identity covariance matrix and 2) they are a bit brittle as they rely on the exact type parameter structure in PDMats and FillArrays (which one could argue are not part of the public API).

devmotion and others added 2 commits June 26, 2026 14:26
The aliases (IsoNormal, DiagNormal, ...) are now abstract parametric
UnionAlls rather than concrete types, which broke two pieces of test
code that relied on their concreteness:

- test/mixture.jl: `IsoNormal[...]` built an abstract-eltype vector,
  making the MixtureModel component type abstract and the mean/pdf/
  logpdf `@inferred` checks fail. Let Julia infer the concrete eltype
  and relax the type assertion to `<:IsoNormal`.

- MvLogitNormal had no `distrname` method and fell back to the generic
  `string(typeof(d))`, which now renders the inner alias verbosely via
  Julia's type printer. Add `distrname(::MvLogitNormal)` delegating to
  `distrname(d.normal)`, matching how MvNormal already prints.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.74%. Comparing base (6b5aa0d) to head (e920483).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2073   +/-   ##
=======================================
  Coverage   86.74%   86.74%           
=======================================
  Files         149      149           
  Lines        8882     8883    +1     
=======================================
+ Hits         7705     7706    +1     
  Misses       1177     1177           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@devmotion devmotion merged commit 87b0f88 into master Jun 26, 2026
14 checks passed
@devmotion devmotion deleted the dmw/aliases branch June 26, 2026 19:24
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.

2 participants