ReactiveBayes / ExponentialFamily.jl

ExponentialFamily.jl is a Julia package that extends the functionality of Distributions.jl by providing a collection of exponential family distributions and customized implementations.
https://reactivebayes.github.io/ExponentialFamily.jl/
MIT License
12 stars 2 forks source link

prod between Wishart and WishartFast is not defined #192

Open bvdmitri opened 5 months ago

bvdmitri commented 5 months ago

Apparently we did not define an analytical product between Wishart and WishartFast. WishartFast is just slightly more optimized version of Wishart , which we use for messages. I propose for such a prod we simply convert Wishart to WishartFast and just call the product between two WishartFast objects.

BayesBase.default_prod_rule(::Type{<:Wishart}, ::Type{<:WishartFast}) = PreserveTypeProd(Distribution)

function BayesBase.prod(::PreserveTypeProd{Distribution}, left::Wishart, right::WishartFast)
    return prod(PreserveTypeProd(Distribution), convert(WishartFast, left), right)
end

We can put a new product right after this one. And the convert methods are already implemented here, so no extra work required for them.

@Nimrais can you add those and also implement similar for InverseWishartFast?

bvdmitri commented 4 months ago

also the conversion does not work, e.g. convert(ExponentialFamilyDistribution, Wishart(2.0, Matrix(30.0I(2))))