circular random number distribution
Jochen Küpper
jochen@fhi-berlin.mpg.de
Tue Aug 9 13:00:00 GMT 2005
Heiko Bauke <Heiko.Bauke@Physik.Uni-Magdeburg.DE> writes:
> | do {
> | x = gsl_ran_flat(rng, -1, 1);
> | y = gsl_ran_flat(rng, -1, 1);
> | } while(sqrt(x*x + y*y) > 1.);
Oops, of course! (Stupid me.)
Ok, I wrote a "real" benchmark, see attached code, generating 1e8
random pairs in a 1/1-circle using gsl_rng_taus and the different
methods discussed (see attached code for details).
Intel(R) Xeon(TM) CPU 2.80GHz machine with gcc-3.3.3:
,----
| reject: 15.59 s
| polar: 27.25 s
| dir_2d: 24.38 s
| trig2d: 27.68 s
`----
AMD Opteron(tm) Processor 850 2.4GHz with gcc-3.3.3:
,----
| reject: 4.48 s
| polar: 16.25 s
| dir_2d: 8.29 s
| trig2d: 16.87 s
`----
Greetings,
Jochen
--
Einigkeit und Recht und Freiheit http://www.Jochen-Kuepper.de
Liberté, Égalité, Fraternité GnuPG key: CC1B0B4D
(Part 3 you find in my messages before fall 2003.)
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: timing.cpp
URL: <http://sourceware.org/pipermail/gsl-discuss/attachments/20050809/2829ce7c/attachment.ksh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gsl-discuss/attachments/20050809/2829ce7c/attachment.sig>
More information about the Gsl-discuss
mailing list