From d7af2d9deac8f9872f58288246bea5a42b6df4cd Mon Sep 17 00:00:00 2001 From: Bagaev Dmitry Date: Thu, 2 Nov 2023 12:44:45 +0100 Subject: [PATCH] Update the definition of logpdf_optimized for Gaussians --- src/distributions/normal_family/normal_family.jl | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/distributions/normal_family/normal_family.jl b/src/distributions/normal_family/normal_family.jl index 79a23054..b45f1f89 100644 --- a/src/distributions/normal_family/normal_family.jl +++ b/src/distributions/normal_family/normal_family.jl @@ -461,20 +461,12 @@ function BayesBase.compute_logscale( return -(v_logdet + n * log2π) / 2 - dot3arg(m, v_inv, m) / 2 end -BayesBase.logpdf_optimized(dist::UnivariateNormalDistributionsFamily) = convert(Normal, dist) -BayesBase.logpdf_optimized(dist::MultivariateNormalDistributionsFamily) = convert(MvNormal, dist) +BayesBase.logpdf_optimized(dist::UnivariateNormalDistributionsFamily) = convert(NormalMeanPrecision, dist) +BayesBase.logpdf_optimized(dist::MultivariateNormalDistributionsFamily) = convert(MvNormalMeanPrecision, dist) BayesBase.sampling_optimized(dist::UnivariateNormalDistributionsFamily) = convert(Normal, dist) BayesBase.sampling_optimized(dist::MultivariateNormalDistributionsFamily) = convert(MvNormal, dist) -function BayesBase.logpdf_sampling_optimized( - dist::Union{UnivariateNormalDistributionsFamily, MultivariateNormalDistributionsFamily} -) - # For Gaussian both sample and logpdf are the same in terms of optimality - optimal = logpdf_optimized(dist) - return (optimal, optimal) -end - # Sample related ## Univariate case