|
|
|
|
|

|
|
|
|
HEALPix v1.20: Bug Correction in randgauss_boxmuller
|
|
|
randgauss_boxmuller is a normal deviate random number generator used
in particular in create_alm to generate the gaussian distributed
a_lm coefficients necessary to simulate a CMB map (see synfast
facility). It belongs to the ran_tools module and its source code
is in src/f90/mod/ran_tools_dist.f90. Like for most random numbers
generators, a new number sequence is started when a negative argument, or seed,
is provided to the routine.
A bug has been discovered to occur under the following circumstances:
-
if the random numbers sequence generated by
randgauss_boxmuller
is initialized more than once during the same code execution (Note that this
does NOT happen in the codes included in the official HEALPix release),
-
and if the previous random sequence had an odd number of elements,
then the first number output by the routine after re-initialization
does not belong to the new sequence, but rather belongs to the previous one.
This should not lead to any problem, except if the same random sequence
(i.e., with the same starting seed) is generated twice within the same code,
and randgauss_boxmuller has been called an odd number of times
between the two initializations. Then the second sequence would have its elements'
rank offset by one compared to the first one (i.e., the number that came first
in the first sequence, will come second in the second sequence, ...)
To correct for this bug, replace line 17 of src/f90/mod/ran_tools_dist.f90,
which currently reads:
if (empty) then
with
if (empty .or. iseed < 0) then
We also enclose a version of
ran_tools_dist.f90
that corrects
for this bug. Substitute this file to src/f90/mod/ran_tools_dist.f90
(Problem reported by Hans Kristian Eriksen)
|
|
|
|
|
|