Skip to content

Fix LKJ numerical stability with PDMats #395

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

Fix LKJ numerical stability with PDMats #395

wants to merge 4 commits into from

Conversation

penelopeysm
Copy link
Member

Closes #387. Turns out that a different matrix type that allows for numerically stable determinants already exists, and it's PDMats.PDMat. Credit to @mhauru for the suggestion.

Copy link
Contributor

Bijectors.jl documentation for PR #395 is available at:
https://TuringLang.github.io/Bijectors.jl/previews/PR395/

@penelopeysm penelopeysm marked this pull request as draft June 19, 2025 14:35
# # Because `ReverseDiff` does not play well with structural matrices.
lower_triangular(A::AbstractMatrix) = convert(typeof(A), LowerTriangular(A))
upper_triangular(A::AbstractMatrix) = convert(typeof(A), UpperTriangular(A))

# TODO: Replace remaining uses of `pd_from_{lower,upper}` with
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this a big task / will it be part of this PR?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think so. That's partly why I kept this PR marked as a draft and didn't request reviews. (The other reason is the failing tests)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LKJ bijector numerical stability issues / DomainError with -1.0
3 participants