Skip to content

Commit

Permalink
Merge branch 'master' into torfjelde-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
torfjelde committed Apr 19, 2024
2 parents d46e1c0 + e522155 commit 2b2731c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/bijectors/simplex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ function logabsdetjac(b::SimplexBijector, x::AbstractVector{T}) where {T}

return -lp
end

# Needed to avoid falling back to `with_logabsdet_jacobian` for matrix inputs.
function logabsdetjac(b::SimplexBijector, x::AbstractMatrix{<:Real})
return sum(Base.Fix1(logabsdetjac, b), eachcol(x))
end

function simplex_logabsdetjac_gradient(x::AbstractVector)
T = eltype(x)
ϵ = _eps(T)
Expand Down
1 change: 1 addition & 0 deletions test/interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ end
filldist(Exponential(), 2),
filldist(Exponential(), 2, 3),
filldist(filldist(Exponential(), 2), 3),
filldist(Dirichlet(ones(2)), 3),
]
x = rand(dist)
b = bijector(dist)
Expand Down

0 comments on commit 2b2731c

Please sign in to comment.