[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-gsl] Speed of Ziggurat Compared With Box Muller on Visual Studio 2
From: |
Simon Manning |
Subject: |
[Help-gsl] Speed of Ziggurat Compared With Box Muller on Visual Studio 2005 |
Date: |
Wed, 5 Dec 2007 18:10:04 +0000 |
I need to generate random numbers drawn from a standard Gaussian
distribution. From a search on the internet the ziggurat method appears to
be the method of choice, so I thought that I would try the GSL version. I
have run some simple timing tests comparing gsl_ran_ugaussian and
gsl_ran_gaussian_ziggurat. Calling these functions from C++ compiled with MS
Visual Studio 2005 I get, for example:
Timings for 100000000 draws.
Time for GSL Box-Muller with MT: 13.329 [gsl_ran_ugaussian with
gsl_rng_mt19937]
Time for GSL ziggurat with minstd: 7.562 [gsl_ran_gaussian_ziggurat with
gsl_rng_minstd]
Time for GSL ziggurat with MT: 7.625 [gsl_ran_gaussian_ziggurat with
gsl_rng_mt19937]
In each case I am simply timing the for loop
for (i = 0; i < numDraws; ++i) {
double x = gsl_ran_gaussian_ziggurat(r, 1.0);
}
and the same for gsl_ran_ugaussian.
Ziggurat is approximately twice as fast as Box-Muller, but according to
http://seehuhn.de/pages/ziggurat it should be almost 4 times as fast.
Therefore, my question is this: is there a problem with my build, or how I
am using GSL, or is the GSL ziggurat really only twice as fast as the
Box-Muller?
Thanks,
Simon Manning.
- [Help-gsl] Speed of Ziggurat Compared With Box Muller on Visual Studio 2005,
Simon Manning <=