This is the mail archive of the gsl-discuss@sources.redhat.com 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]

Re: [Fwd: Re: random variate from power exponential distribution:continue]


On Fri, 22 Oct 2004 16:04:39 +0100
Brian Gough <bjg@network-theory.co.uk> wrote:

> For GSL, the goal is to have simple generic algorithms that perform
> reasonably on any machines.  Optimising for one platform tends to make
> things worse on others, as they have different strengths and
> weaknesses.


Dear Brian,
the problem is exactly this. It seems that the actual code in
randist/exppow.c is already optimized. Optimized for an Intel processor.
Indeed, there are three different algorithms for the generation of power
exponential variates that are implemented inside GSL. The function
exported to external programs, gsl_ran_exppow, makes a choice among
these three algorithms based on the value of a parameter. The presence
of these if-else branches DOES NOT make the code simpler. And, it
turned out, it doesn't make it more "generic" too. The choice between
different algorithms leads to faster code on some platforms and to
slower code on others.

If I understood correctly the gsl philosophy, probably a better approach
would be to implement three distinct functions

gsl_ran_exppow_gs
gsl_ran_exppow_ed
gsl_ran_exppow_en

and let the user makes her choice (depending on her architecture). Of
course, one could leave a "would be generic" gsl_ran_exppow for backward
compatibility, adding the needed "caveat" in the manual.

If you think this approach is reasonable, I would be happy to try to
put together the necessary code and the necessary additions to the
manual.

Best,
	G.

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]