Skip to content

Commit

Permalink
Merge branch 'master' into compathelper/new_version/2020-11-06-00-16-…
Browse files Browse the repository at this point in the history
…14-397-3849147150
  • Loading branch information
cscherrer authored Nov 22, 2020
2 parents 2114797 + 45646e1 commit c4f6a03
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ StatsFuns = "4c63d2b9-4356-54db-8cca-17b64c39e42c"

[compat]
Bijectors = "0.8"
MLStyle = "0.4"
julia = "1.3"

[extras]
Expand Down
5 changes: 5 additions & 0 deletions src/combinators/power.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,8 @@ function Base.rand(d::PowerMeasure)
end

basemeasure::PowerMeasure) = basemeasure.μ)^μ.size

function PowerMeasure::ScaledMeasure, n::NTuple{N,Int}) where {N}
k = prod(n) * μ.logscale
return ScaledMeasure(k, μ.base^n)
end
4 changes: 2 additions & 2 deletions src/combinators/scale.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ function logdensity(sm::ScaledMeasure{R,M}, x::X) where {X, R, M <: AbstractMeas
logdensity(sm.base, x) + sm.logscale
end

function Base.:*(k::Number, m::AbstractMeasure)
if iszero(k)
function Base.:*(k::T, m::AbstractMeasure) where {T <: Number}
if hasmethod(iszero, (T,)) && iszero(k)
return TrivialMeasure
else
return ScaledMeasure{typeof(k), typeof(m)}(log(k),m)
Expand Down

0 comments on commit c4f6a03

Please sign in to comment.