This is the mail archive of the gsl-discuss@sourceware.org mailing list for the GSL project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Ok, I did some quick tests, the times are for the creation of 1e5 xy pairs plus some constant cruft done in all runs -- runtime is always 3.4s (+-0.5) for all approaches.... (This is not a good benchmark(!), it's only meant to give me an idea of what is going on.) I tried: rejection, trigonomtric without sqrt, trigonomtrix + sqrt, gsl_ran_dir_2d + sqrt, gsl_ran_dir_2d_trig_method + sqrt. "Robert G. Brown" <rgb@phy.duke.edu> writes: >> | phi = gsl_ran_flat(rng, 0, 2.0*PI); >> | r = gsl_ran_flat(rng, 0, 1); >> | x = sqrt(r)*cos(phi); >> | y = sqrt(r)*sin(phi); > I'm probably late with this (sorry, busy weekend) but: Your > accept-reject method is almost certainly much faster than using > ANYTHING with transcendental calls in it. Well, I am told that some machines (i.e. PCs) have these functions in hardware. > In fact, your sqrt call is redundant Well, that's the deal: It isn't! Without the sqrt, the functions are peaked at the center. With the sqrt they are uniform. I guess I am going with the reject anyway... Thanks for everybodies suggestions and help. 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.)
Attachment:
pgp00000.pgp
Description: PGP signature
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |