Skip to content

Commit

Permalink
Update the definition of logpdf_optimized for Gaussians
Browse files Browse the repository at this point in the history
  • Loading branch information
bvdmitri committed Nov 2, 2023
1 parent de097b4 commit d7af2d9
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/distributions/normal_family/normal_family.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Check warning on line 465 in src/distributions/normal_family/normal_family.jl

View check run for this annotation

Codecov / codecov/patch

src/distributions/normal_family/normal_family.jl#L464-L465

Added lines #L464 - L465 were not covered by tests

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
Expand Down

0 comments on commit d7af2d9

Please sign in to comment.