More flexible and less brittle MvNormal and MvNormalCanon type aliases#2073
Merged
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
andreasnoack
approved these changes
Jun 26, 2026
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.
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).