Skip to content

Commit ab96459

Browse files
authored
fix MvNormal bug (#189)
* fix MvNormal bug * bump version
1 parent 7cda008 commit ab96459

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "MeasureTheory"
22
uuid = "eadaa1a4-d27c-401d-8699-e962e1bbc33b"
33
authors = ["Chad Scherrer <[email protected]> and contributors"]
4-
version = "0.15.0"
4+
version = "0.15.1"
55

66
[deps]
77
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"

src/combinators/affine.jl

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,14 @@ end
228228
# # lmul!(d.ω, z)
229229
# # logdensity_def(d.parent, z)
230230
# # end
231-
232-
@inline basemeasure(d::Affine{N,M,Tuple{Vararg{T,K}}}) where {K,N,M,T<:AbstractArray} = affine(getfield(d, :f), rootmeasure(d.parent))
231+
232+
@inline function basemeasure(d::Affine{N,M,Tuple{A}}) where {N,M,A<:AbstractArray}
233+
weightedmeasure(-logjac(d), OrthoLebesgue(params(d)))
234+
end
235+
236+
@inline function basemeasure(d::Affine{N,M,Tuple{A1,A2}}) where {N,M,A1<:AbstractArray, A2<:AbstractArray}
237+
weightedmeasure(-logjac(d), OrthoLebesgue(params(d)))
238+
end
233239

234240
@inline basemeasure(d::Affine) = affine(getfield(d, :f), basemeasure(d.parent))
235241

@@ -238,11 +244,6 @@ end
238244
@inline basemeasure(d::Affine{N,L}) where {N,L<:Lebesgue} = weightedmeasure(-logjac(d), d.parent)
239245
@inline basemeasure(d::Affine{N,L}) where {N,L<:LebesgueMeasure} = weightedmeasure(-logjac(d), d.parent)
240246

241-
242-
@inline function basemeasure(d::Affine{N,P, Tuple{Vararg{T, K}}}) where {K,N,L<:Union{<:Lebesgue, <:LebesgueMeasure},P<:PowerMeasure{L}, T<:AbstractArray}
243-
weightedmeasure(-logjac(d), OrthoLebesgue(params(d)))
244-
end
245-
246247
logjac(d::Affine) = logjac(getfield(d, :f))
247248

248249
function Random.rand!(

test/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ end
351351
d = MvNormal=σ)
352352
x = rand(d)
353353
@test logdensityof(d, x) logdensityof(Dists.MvNormal(Σ), x)
354+
@test logdensityof(MvNormal(zeros(3), σ), x) logdensityof(d, x)
354355
end
355356

356357
@testset "NegativeBinomial" begin

0 commit comments

Comments
 (0)