help-octave
[Top][All Lists]
Advanced

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

Re: poisson_rnd() excruciatingly slow


From: Henry F. Mollet
Subject: Re: poisson_rnd() excruciatingly slow
Date: Thu, 07 Oct 2004 10:45:39 -0700
User-agent: Microsoft-Entourage/10.1.1.2418

octave:1> tic; rand(400); toc
ans = 0.29082
octave:2> tic; randp(5,400); toc
error: `randp' undefined near line 2 column 6  %randp() not installed
octave:2> tic; randn(400); toc
ans = 0.29920
GNU Octave, version 2.1.46 (powerpc-apple-darwin6.6).
So randn() is considerably faster on my slow 400 MHz Power PC G3
Henry




on 10/6/04 8:53 PM, Paul Kienzle at address@hidden wrote:

> I've posted randp() to octave-forge/FIXES.   The code for
> the 5 (?!) generators  is in randpoisson.c.  There are
> different generators for large (>10) and small lambda (<10),
> and for repeated and varying lambda.  Some algorithms have
> considerable initialization overhead when changing
> lambda.   Also, for huge lambda (>1e8) a normal approximation
> is used.
> 
> Be careful to test that the generated numbers look
> reasonable for all these cases before putting your
> trust in this code.  Test showing that the resulting
> numbers are indeed Poisson would be appreciated.
> 
> Here are some times:
> 
> uniform generator
> octave> tic; rand(400); toc
> ans = 0.042940
> 
> repeated lambda, small and large
> octave> tic; randp(5,400); toc
> ans = 0.055537
> octave> tic; randp(155,400); toc
> ans = 0.11648
> 
> varying lambda, small and large
> octave> tic; randp(5*ones(400),400); toc
> ans = 0.20203
> octave> tic; randp(155*ones(400),400); toc
> ans = 0.58247
> 
> I've just noticed that randn is very slow on OS X:
> 
> octave> tic; randn(400); toc
> ans = 12.868
> 
> Some concerned mac users may want to pursue this.
> It should be just a little slower than rand(), not 300x
> slower.
> 
> - Paul
> 
> 
> On Oct 6, 2004, at 8:24 PM, address@hidden wrote:
> 
>> Is there a reason why poisson_rnd() is so *glacially slow* for high
>> values
>> of lambda? On a 2.0 GHz Athlon system, I measured poisson_rnd(200000)
>> to
>> take approximately 18 seconds, making this function next to useless for
>> practical use. Compare that to the 0.16 seconds for
>> binomial_rnd(400000,
>> 0.5) which effectively computes the same thing, which I still consider
>> to
>> be a sizable amount, by the way.
>> 
>> If my questions have already been answered on various lists, then I
>> apologize for asking them, but as the search-function of said lists
>> seems
>> to be down, I cannot check myself.
>> 
>> 
>> Kind regards,
>> Maarten
>> 
>> 
>> 
>> -------------------------------------------------------------
>> Octave is freely available under the terms of the GNU GPL.
>> 
>> Octave's home on the web:  http://www.octave.org
>> How to fund new projects:  http://www.octave.org/funding.html
>> Subscription information:  http://www.octave.org/archive.html
>> -------------------------------------------------------------
>> 
> 
> 
> 
> -------------------------------------------------------------
> Octave is freely available under the terms of the GNU GPL.
> 
> Octave's home on the web:  http://www.octave.org
> How to fund new projects:  http://www.octave.org/funding.html
> Subscription information:  http://www.octave.org/archive.html
> -------------------------------------------------------------
> 



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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