[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-gsl] Wrong orthogonalization in gsl_rng_gfsr4
From: |
Andreas Schneider |
Subject: |
[Bug-gsl] Wrong orthogonalization in gsl_rng_gfsr4 |
Date: |
Sun, 25 Apr 2004 16:50:47 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en; Stable) Gecko/20020827 Beonex/0.9-pre-1 |
From rng/gfsr4.c:
--8<----
/* Perform the "orthogonalization" of the matrix */
/* Based on the orthogonalization used in r250, as suggested initially
* by Kirkpatrick and Stoll, and pointed out to me by Brian Gough
*/
for (i=0; i<32; ++i) {
int k=7+i*3;
state->ra[k] &= mask; /* Turn off bits left of the diagonal */
state->ra[k] |= msb; /* Turn on the diagonal bit */
mask >>= 1;
msb >>= 1;
}
state->nd = i;
---->8--
As pointed out in rng/r250.c, k should be 7*i+3, not 7+i*3.
Additionally, the initialization of the array index with 32 might be unintended.
Andreas Schneider
- [Bug-gsl] Wrong orthogonalization in gsl_rng_gfsr4,
Andreas Schneider <=