diff --git a/Project.toml b/Project.toml index ac237fab..5567b347 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "MeasureTheory" uuid = "eadaa1a4-d27c-401d-8699-e962e1bbc33b" authors = ["Chad Scherrer and contributors"] -version = "0.15.0" +version = "0.15.1" [deps] Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697" diff --git a/src/combinators/affine.jl b/src/combinators/affine.jl index d437658f..d598c800 100644 --- a/src/combinators/affine.jl +++ b/src/combinators/affine.jl @@ -228,8 +228,14 @@ end # # lmul!(d.ω, z) # # logdensity_def(d.parent, z) # # end - -@inline basemeasure(d::Affine{N,M,Tuple{Vararg{T,K}}}) where {K,N,M,T<:AbstractArray} = affine(getfield(d, :f), rootmeasure(d.parent)) + +@inline function basemeasure(d::Affine{N,M,Tuple{A}}) where {N,M,A<:AbstractArray} + weightedmeasure(-logjac(d), OrthoLebesgue(params(d))) +end + +@inline function basemeasure(d::Affine{N,M,Tuple{A1,A2}}) where {N,M,A1<:AbstractArray, A2<:AbstractArray} + weightedmeasure(-logjac(d), OrthoLebesgue(params(d))) +end @inline basemeasure(d::Affine) = affine(getfield(d, :f), basemeasure(d.parent)) @@ -238,11 +244,6 @@ end @inline basemeasure(d::Affine{N,L}) where {N,L<:Lebesgue} = weightedmeasure(-logjac(d), d.parent) @inline basemeasure(d::Affine{N,L}) where {N,L<:LebesgueMeasure} = weightedmeasure(-logjac(d), d.parent) - -@inline function basemeasure(d::Affine{N,P, Tuple{Vararg{T, K}}}) where {K,N,L<:Union{<:Lebesgue, <:LebesgueMeasure},P<:PowerMeasure{L}, T<:AbstractArray} - weightedmeasure(-logjac(d), OrthoLebesgue(params(d))) -end - logjac(d::Affine) = logjac(getfield(d, :f)) function Random.rand!( diff --git a/test/runtests.jl b/test/runtests.jl index 1f1b15f4..f88e0b54 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -351,6 +351,7 @@ end d = MvNormal(σ=σ) x = rand(d) @test logdensityof(d, x) ≈ logdensityof(Dists.MvNormal(Σ), x) + @test logdensityof(MvNormal(zeros(3), σ), x) ≈ logdensityof(d, x) end @testset "NegativeBinomial" begin