[Numpy-discussion] Quick Question about Optimization

Charles R Harris charlesr.harris@gmail....
Mon May 19 19:30:15 CDT 2008


On Mon, May 19, 2008 at 5:52 PM, Robert Kern <robert.kern@gmail.com> wrote:

> On Mon, May 19, 2008 at 6:39 PM, Charles R Harris
> <charlesr.harris@gmail.com> wrote:
> >
> > On Mon, May 19, 2008 at 4:36 PM, Robert Kern <robert.kern@gmail.com>
> wrote:
> >>
> >> On Mon, May 19, 2008 at 5:27 PM, Charles R Harris
> >> <charlesr.harris@gmail.com> wrote:
> >> > The latest versions of Matlab use the ziggurat method to generate
> random
> >> > normals and it is faster than the method used in numpy. I have
> ziggurat
> >> > code
> >> > at hand, but IIRC, Robert doesn't trust the method ;)
> >>
> >> Well, I outlined the tests that would satisfy me, but I don't think
> >> you ever responded.
> >>
> >>
> http://projects.scipy.org/pipermail/scipy-dev/2005-December/004405.html
> >>  which references
> >>
> http://projects.scipy.org/pipermail/scipy-dev/2005-December/004400.html
> >
> > It's been tested in the literature.
>
> And it happened to fail such tests. Hence the Doornik paper which
> improves Marsaglia's method to pass the appropriate tests.


Exactly. Doornik was more careful about using independent samples and also
used a better random number generator (MWC8222), not exactly rocket
science.  Believe it or not, I had read Doornik's paper before I did my
implementation. I also used a better ziggurat, IMHO, than Marsaglia and
Doornik.

MWC8222 is also about twice as fast on AMD hardware as the Mersenne Twister,
but does require more careful initialization. On Pentium V they are about
they are about the same. I haven't benchmarked either on Core2.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080519/05228d46/attachment.html 


More information about the Numpy-discussion mailing list