octave-maintainers
[Top][All Lists]
Advanced

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

Re: generators and endian [from thread on address@hidden


From: Paul Kienzle
Subject: Re: generators and endian [from thread on address@hidden
Date: Fri, 23 Mar 2007 09:11:01 -0400


On Mar 23, 2007, at 5:21 AM, David Bateman wrote:

John W. Eaton wrote:
On 22-Mar-2007, Paul Kienzle wrote:
| How much effort is it worth to guarantee that randn and other
| derived generators produce the same sequence?  The vagaries
| of the optimizer may mean that guard bits allow one threshold
| test to pass on some versions of the compiler but not in others.
| Should we force numbers to memory to clear the guard?

I don't know.  I was assuming it would be a simple change.  If not,
then I don't think it is very important for the old generators.

I'm not sure this is an issue as we only work on 32 bit integers in the
base generator on which all the others are based, and then only with
shift/add operators. The other generators are then just mapping (in one
manner or another) from these integers to floats. So I'm not sure
vagaries of the guard bit come into play, at least not with the new
generators.

I agree that generating uniforms from the mt code stably across
platforms is not an issue.  It is the other sequences I'm concerned
about.

For example, constructing the randn ziggurat involves
calculations such as exp(-.5*sqrt(-2*log(A/B+f[i+1])^2).  How sure
are you that this number is going to be computed identically
across platforms?  I know that I had to loosen a number of
tolerances on test cases for various codes for them to pass
on PPC OS X, so I would be surprised if these results were any
more consistent.  Even if you do stablize the ziggurat, the tail
test still involves -2*log(Ua) <= C^2*log(Ub)^2, and if this
test passes on one architecture but fails on another, the remaining
sequence will be completely different.

The only way I can think of to guarantee an approximately
repeatable sequence for a derived generator is to call pdf_inv
for your particular probability density function.  The numbers
won't be identical, but they should be within epsilon across
platforms.  I'm not sure this matters though --- even if you
had an identical sequence the simulation would still produce
different results on different platforms due to differences
in how the floating point is handled.

I guess that leaves us with the occasionally failing statistical
tests that started this whole thread :-(

        - Paul



reply via email to

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