Issue 06 — InverseWishart default-space log-partition uses mvtrigamma instead of logmvgamma
Component: src/distributions/wishart_inverse.jl:323-327
Severity: MEDIUM (silent wrong value; mean-space only)
Type: Correctness
Summary
The DefaultParametersSpace (mean parameter space) log-partition of
InverseWishartFast is wrong:
getlogpartition(::DefaultParametersSpace, ::Type{InverseWishartFast}) = (θ) -> begin
(ν, S) = unpack_parameters(InverseWishartFast, θ)
p = first(size(S))
return (ν / 2) * (p * log(2.0) - logdet(S)) + mvtrigamma(p, ν / 2) # ← mvtrigamma!
end
mvtrigamma is the sum of trigammas — the correct object here is the log of the
multivariate gamma function, logmvgamma(p, ν/2). The Wishart sibling
(src/distributions/wishart.jl:297) uses logmvgamma correctly for the analogous
term. This looks like a copy-paste of the Fisher [1,1] entry (which legitimately
uses mvtrigamma).
Evidence / repro (Julia 1.12.6)
ν = 6.0; S = [3.0 0.5; 0.5 2.0]; p = 2
A_default = getlogpartition(DefaultParametersSpace(), InverseWishartFast)(θ) # -0.2034
A_natural = getlogpartition(NaturalParametersSpace(), InverseWishartFast)(η) # 0.4615
# hand value with logmvgamma: (ν/2)(p·ln2 − logdet S) + logmvgamma(p,ν/2) = 0.4615
The two parameter spaces return different values for the same log-partition; the
natural space and hand-derived values agree at 0.4615.
Impact
The mean-space log-partition of InverseWishartFast (used in ReactiveMP
NodeFunctionRule-type expectations and sqrt/mean-space computations) silently
returns a wrong value. Mathematically the two parametrizations must give the same
partition.
Proposed fix
return (ν / 2) * (p * log(2.0) - logdet(S)) + logmvgamma(p, ν / 2)
Issue 06 —
InverseWishartdefault-space log-partition usesmvtrigammainstead oflogmvgammaComponent:
src/distributions/wishart_inverse.jl:323-327Severity: MEDIUM (silent wrong value; mean-space only)
Type: Correctness
Summary
The
DefaultParametersSpace(mean parameter space) log-partition ofInverseWishartFastis wrong:mvtrigammais the sum of trigammas — the correct object here is the log of themultivariate gamma function,
logmvgamma(p, ν/2). The Wishart sibling(
src/distributions/wishart.jl:297) useslogmvgammacorrectly for the analogousterm. This looks like a copy-paste of the Fisher
[1,1]entry (which legitimatelyuses
mvtrigamma).Evidence / repro (Julia 1.12.6)
The two parameter spaces return different values for the same log-partition; the
natural space and hand-derived values agree at
0.4615.Impact
The mean-space log-partition of
InverseWishartFast(used inReactiveMPNodeFunctionRule-type expectations andsqrt/mean-space computations) silentlyreturns a wrong value. Mathematically the two parametrizations must give the same
partition.
Proposed fix