Distributions.jl icon indicating copy to clipboard operation
Distributions.jl copied to clipboard

Type of sample of `Exponential{T}` is not `T`

Open wouterwln opened this issue 5 months ago • 11 comments

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.

wouterwln avatar Sep 17 '24 13:09 wouterwln