help-octave
[Top][All Lists]
Advanced

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

Re: betarnd function


From: David Bateman
Subject: Re: betarnd function
Date: Thu, 22 Feb 2007 16:46:24 +0100
User-agent: Thunderbird 1.5.0.7 (X11/20060921)

antonio palestrini wrote:
> Dear David,
> I usually use the "beta_rnd" function. Are "betarnd" and "beta_rnd"
> the same
> or there is any difference in efficiency, etc.?
>
> Thanks
> Antonio
betarnd is the matlab statistics toolbox compatible name. Octave had
beta_rnd before matlab had betarnd. beta_rnd is deprecated in favor of
betarnd. Note that I consider betarnd to be slow than it needs to be as
the randg function could be used to accelerate it. Consider

>> tic; b0 = betarnd(2,2,1,1e5); toc
Elapsed time is 10.041847 seconds.
>> tic; r1 = randg(2,1,1e5); b1 = r1 ./ (r1 + randg(2,1,1e5)); toc
Elapsed time is 0.073097 seconds.
>> hist(b0,[0.0125:0.025:0.9875]); hold on; hist(b1,[0.0125:0.025:0.9875])

As you see I can get about a factor of 140 speed up. I'll supply some
patches to make betarnd faster.

D.


-- 
David Bateman                                address@hidden
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob) 
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax) 

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary



reply via email to

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