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]

random variate from power exponential distribution: patch


Hi, 

I attach a patch against the current  CVS version of the power
exponential random variable  generator implementing the following
modifications:


- the rejection methods have been rewritten to improve speed. Here is a
comparison on my little Pentium IV (but see my previous postings for
details): seconds to generate 10^6 variates with the current (old) and
patched (new) gsl_ran_exppow function

#b     old (sec.) new (sec.)
0.500    0.620     0.690
0.999    2.120     2.190
1.000    0.280     0.280
1.001    1.770     1.220
1.500    2.260     1.260
1.999    2.240     1.360
2.000    0.510     0.510
2.001    4.510     1.290
2.500    4.500     1.370
3.000    4.110     1.240
4.000    4.150     1.420
6.000    4.010     1.390
10.000   4.180     1.350


- the function gsl_ran_exppow has been redefined as a wrapper around
  three functions

	gsl_ran_exppow_gs
	gsl_ran_exppow_ed
	gsl_ran_exppow_en

  which implement the transformation of gamma, rejection from a
  Laplace and rejection from a Gaussian method, respectively.

  These three functions are exported to users.

  I think the little overhead produced by a further function call
  (almost 10% in the worst cases) is affordable in exchange to the
  increased clarity of code. The idea is that speed concerned users
  shouldn't use the wrapper at all, but call the routines directly,
  choosing the "optimal" one for their particular system and need.

- the test has been modified to cover all the relevant parameter range
(i.e. the value of b of the last exppow test has been set to 2.7)

Best,
	Giulio.


-- 
Giulio Bottazzi                 PGP Key ID:BAB0A33F 

CAFiM  Center for the Analysis of Financial Markets
LEM          Laboratory of Economics and Management
Sant'Anna School for Advanced Studies, Pisa, Italy
Phone: (+39)-050-883365       Fax: (+39)-050-883344
email: bottazzi@sssup.it    www.sssup.it/~bottazzi/

Attachment: exppow_diff
Description: Binary data

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]