Distributions.jl
Distributions.jl copied to clipboard
Type of sample of `Exponential{T}` is not `T`
MWE:
θ = 1.0f0
d = Exponential(θ)
typeof(rand(Exponential(θ))) == typeof(θ)
returns false
Because Exponential sampling is also used when sampling Gamma
with shape 1, the problem also occurs there. For Gamma
this introduces a type instability, since the return type for sampling for a Gamma
depends on whether or not the alpha parameter is equal to 1.0
.