Skip to content

Commit

Permalink
Lower non-log threshold
Browse files Browse the repository at this point in the history
  • Loading branch information
quildtide committed Sep 4, 2024
1 parent f50e8c8 commit 0bd5b5c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/multivariate/dirichlet.jl
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ function _rand!(rng::AbstractRNG,
d::Union{Dirichlet,DirichletCanon},
x::AbstractVector{E}) where {E<:Real}

if any(a -> a > one(partype(d)), d.alpha)
if any(a -> a >= .5, d.alpha)
for (i, αi) in zip(eachindex(x), d.alpha)
@inbounds x[i] = rand(rng, Gamma(αi))
end
Expand Down Expand Up @@ -188,7 +188,7 @@ function _rand!(rng::AbstractRNG,
d::Dirichlet{T,<:FillArrays.AbstractFill{T}},
x::AbstractVector{E}) where {T<:Real, E<:Real}

if FillArrays.getindex_value(d.alpha) > one(T)
if FillArrays.getindex_value(d.alpha) >= 0.5
rand!(rng, Gamma(FillArrays.getindex_value(d.alpha)), x)
return lmul!(inv(sum(x)), x)
else
Expand Down

0 comments on commit 0bd5b5c

Please sign in to comment.