Skip to content

Commit 6824229

Browse files
committed
Fix logpdf(::NamedDist) method ambiguity
1 parent 70af908 commit 6824229

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/distribution_wrappers.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ Base.length(dist::NamedDist) = Base.length(dist.dist)
1717
Base.size(dist::NamedDist) = Base.size(dist.dist)
1818

1919
Distributions.logpdf(dist::NamedDist, x::Real) = Distributions.logpdf(dist.dist, x)
20+
function Distributions.logpdf(dist::NamedDist, x::AbstractArray{<:Real,0})
21+
# extract the singleton value from 0-dimensional array
22+
return Distributions.logpdf(dist.dist, first(x))
23+
end
2024
function Distributions.logpdf(dist::NamedDist, x::AbstractArray{<:Real})
2125
return Distributions.logpdf(dist.dist, x)
2226
end

0 commit comments

Comments
 (0)