Skip to content

Commit

Permalink
update comments on large z bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
wzhorton committed May 10, 2023
1 parent de0320c commit 0b47c62
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/rand_pgdevroye.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,9 @@ function rand_Jstar(z::Real, rng::AbstractRNG)
else
# Draw inverseGaussian(1/z, 1) truncated below t
# WARNING: This implementation is unstable. For z ≈ 0, an infinite loop occurs
# due to the InverseGaussian parameter being infinite. For large z (>400 ish),
# the loop also never terminates, probably due to underflow in a_coefs().
# z + 0.0001 is a hack to address the case where z = 0. In the future,
# Algorithms 2 and 3 of Polson et al. 2013 should be implemented to fix this.
# due to the InverseGaussian parameter being infinite. z + 0.0001 is a hack to
# address the case where z = 0. In the future, Algorithms 2 and 3 of
# Polson et al. 2013 should be implemented to fix this.
X = rand(rng, truncated(InverseGaussian(inv(z+0.0001), 1.0); upper = t))
end
# Accumulate a(X) to S
Expand Down

2 comments on commit 0b47c62

@wzhorton
Copy link
Owner Author

Choose a reason for hiding this comment

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

@JuliaRegistrator register()

@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/83329

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 v1.0.4 -m "<description of version>" 0b47c6264c0ff40880f597d439f322b002e4bda2
git push origin v1.0.4

Please sign in to comment.