Open
Description
Sometimes it is more efficient to generate a sample with rand(d, 1000)
than [rand(d) for _ in 1:1000]
,
if an overhead is significant. That is the case for fft_convolve
in NumericalDistributions.jl.
A solution would be to propagate rand(eng, d, n::Int)
signature to wrapped distributions in Distributions.jl
.
It concerns wrappers,
MixtureModel
,Truncated
Here is my example for testing in mmikhasenko/NumericalDistributions.jl#10
using NumericalDistributions
dt = let
d1 = truncated(Normal(0, 0.02), -1.0, 1.0)
d2 = truncated(Normal(2, 0.02), 1.0, 4.0)
d = fft_convolve(d1, d2)
truncated(d, -1, 3)
end
@time rand(dt.untruncated, 1000) # ms
@time rand(dt, 1000) # 5s
Metadata
Metadata
Assignees
Labels
No labels