|
Boost Users : |
Subject: Re: [Boost-users] Random library, discrete distribution
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-08-17 22:52:40
AMDG
er wrote:
>> It's called discrete_distribution in the new standard.
>> Also, the alias algorithm is more efficient. See attached.
>> (Note that I haven't tried to make this implementation
>> numerically bulletproof.)
>>
>
> discrete does not sort the weights, so this step has to be carried out
> beforehand to get a comparable basis. I've added a small test file to
> compare categorical and discrete, where discrete is 10x faster than
> categorical at initialization and is equally fast at sampling.
Your test isn't quite right. You're comparing the
speed of categorical to itself for sampling.
In Christ,
Steven Watanabe
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net