Skip to content

Commit

Permalink
Bugfix for SimplexBijector on Matrix (#302)
Browse files Browse the repository at this point in the history
* fix for `SimplexBijector` with matrix inputs

* added tests for filldist with `Dirichlet`

* bump patch version
  • Loading branch information
torfjelde authored Apr 15, 2024
1 parent 2402be2 commit e522155
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "Bijectors"
uuid = "76274a88-744f-5084-9051-94815aaf08c4"
version = "0.13.8"
version = "0.13.9"

[deps]
ArgCheck = "dce04be8-c92d-5529-be00-80e4d2c0e197"
Expand Down
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

2 comments on commit e522155

@torfjelde
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/104934

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.13.9 -m "<description of version>" e522155c06565673d8b95c330f2a99db13a6d3b1
git push origin v0.13.9

Please sign in to comment.