help-octave
[Top][All Lists]
Advanced

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

Re: sampling from two instances of a random number generator


From: Leo Razoumov
Subject: Re: sampling from two instances of a random number generator
Date: Tue, 27 May 2008 19:06:24 -0400

On 5/26/08, Søren Hauberg <address@hidden> wrote:
> søn, 25 05 2008 kl. 20:12 -0400, skrev Leo Razoumov:
>
> > Two basic problems with this approach:
>  > (1) Each time the whole RNG state is saved and copied. For Marsenne
>  > Twister RNG used in Octave it is 625B. This slows things down.
>
> The approach will be somewhat slower, but are you claiming that 625 B of
>  memory use is a problem in an Octave script?

I am claiming that each time you call myrand from your example 625B
are copied from "static_state" to the global state followed by another
625B copied from global state back to "static_state". All-in-all 1250B
of useless copying per each random number generated (assuming that I
draw one number at a time). This will slow things down for sure.

>  > (2) Still there is only one global RNG state. In  a multi-threaded
>  > environment it can cause serious problems if several threads are
>  > trying to update the same state. Requires explicit and careful
>  > synchronization, etc.
>
>
> How is that relevant? Octave doesn't support threads...
>

Octave interpreter does not. But Octave is also a library and can be
linked to applications that are multi-threaded.

--Leo--



reply via email to

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