Boost logo

Boost Users :

Subject: Re: [Boost-users] Random library, discrete distribution
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-08-17 16:25:05


AMDG

Kevin Martin wrote:
> On 16 Aug 2009, at 06:55, er wrote:
>> Hi, here's something related:
>> https://svn.boost.org/svn/boost/sandbox/statistics/random/boost/random/multinomial_distribution.hpp
>>
>
> I think this is definitely needed in boost::random, and it seems to do
> much more error checking and dealing with large weights than my
> version does, so I will definitely change to using it once it makes it
> into a normal library release (and I can persuade my HPC admin to
> upgrade the library)
>
> I think you should rename it categorical distribution though as it
> only samples a single trial from the distribution. I believe the
> multinomial distribution gives the probability of vectors arising when
> n trials are performed.

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.)

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