octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Low hanging fruit - Accelerated random distribution functions


From: John W. Eaton
Subject: Low hanging fruit - Accelerated random distribution functions
Date: Thu, 22 Feb 2007 14:16:35 -0500

On 22-Feb-2007, David Bateman wrote:

| Dear All,
| 
| I took a look at the random distribution functions as they are quite
| slow with the thought of trying to use rande, randp and randg as much as
| possible to accelerate them. The attached patch is the result and
| converts the ones that Paul discussed in the randg function's help plus
| a couple of other simple one (exprnd, poissrnd).  In particular it
| converts betarnd, chi2rnd, exprnd, frnd, gamrnd, poissrnd and trnd.
| Furthermore the functions binornd,  cauchy_rnd, discrete_rnd,
| empirical_rnd, normrnd and unifrnd were already reasonably good
| implementations.  I haven't tried to convert the functions geornd,
| hygernd, laplace_rnd, logistic_rnd, lognrnd, pascal_rnd, stdnormal_rnd,
| wblrnd and wienrnd yet, so if someone has any suggests then please
| propose them.
| 
| This patch however raises a question in that it will alter the sequences
| of the converted functions. This was already effectively done at the
| time we introduced the Mersenne Twister and Ziggurat into octave and no
| one complained then. However I believe that before this patch is applied
| the fact that it will alter the sequences for a particular state or seed
| must be known.. Note that typical speed ups with this patch are a factor
| of 100...

How hard would it be to make rande, randg, and randp call rand or
randn as needed if we are using the old generator?  If it is easy,
and if that would solve the problem, then maybe we should do that to
preserve the way these functions worked in the past.  Otherwise, I
suspect most people would prefer a speedup of this magnitude.

jwe


reply via email to

[Prev in Thread] Current Thread [Next in Thread]