Unexpected behavior of `truncated` for zero variance distributions at the lower bound
HakanBrian opened this issue · comments
When truncating a Normal
distribution with zero variance and mean equal to the lower bound of the truncated
, evaluating rand
will result in infinite compilation time. An equivalent operation with the upper bound of the truncated
will return the value for the upper bound as expected.
Example:
using Distributions
rand(truncated(Normal(1, 0), 0, 1)) # Expected output: 1
rand(truncated(Normal(0, 0), 0, 1)) # Expected output: 0
# Note that when the expected output is 0 we get infinite compilation time.
Yes, you are right. #1721 will resolve this issue.