From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18083 invoked by alias); 1 Dec 2006 04:11:43 -0000 Received: (qmail 18074 invoked by uid 22791); 1 Dec 2006 04:11:42 -0000 X-Spam-Check-By: sourceware.org Received: from enlil.physics.usyd.edu.au (HELO enlil.physics.usyd.edu.au) (129.78.129.112) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 01 Dec 2006 04:11:37 +0000 Received: from enlil.physics.usyd.edu.au (localhost.physics.usyd.edu.au [127.0.0.1]) by enlil.physics.usyd.edu.au (8.13.1/8.13.1) with ESMTP id kB14B5D5015054; Fri, 1 Dec 2006 15:11:05 +1100 Received: from localhost (localhost [[UNIX: localhost]]) by enlil.physics.usyd.edu.au (8.13.1/8.13.1/Submit) id kB14AWOI014974; Fri, 1 Dec 2006 15:10:32 +1100 From: "Paul C. Leopardi" Reply-To: paul.leopardi@usyd.edu.au To: m-mat@math.sci.hiroshima-u.ac.jp, jrfsousa@esoterica.pt, gsl-discuss@sourceware.org Subject: Re: "Mersenne Twister with improved initialization" (2002): another bug in mt19937ar.f90 Date: Fri, 01 Dec 2006 04:11:00 -0000 User-Agent: KMail/1.7.1 References: <200611291331.56193.leopardi@physics.usyd.edu.au> In-Reply-To: <200611291331.56193.leopardi@physics.usyd.edu.au> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200612011510.24390.leopardi@physics.usyd.edu.au> Mailing-List: contact gsl-discuss-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gsl-discuss-owner@sourceware.org X-SW-Source: 2006-q4/txt/msg00016.txt.bz2 To Makoto Matsumoto, Josi Rui Faustino de Sousa, gsl-discuss mailing list. Hi all, Further to my recent message, I have discovered another bug in mt19937ar.f90 (2002). In mt19937ar.f90 (2002), in subroutine init_genrand, the value of mti should be reinitialized to n + 1_wi, but this is not done. The fix is to add the line mti = n + 1_wi immdiately before end subroutine init_genrand. The other implementations, mt19937ar.c (2002), GSL 1.8 and mt95.f90 (2003) do not have the bug seen here in mt19937ar.f90 (2002). In mt19937ar.c (2002), in function init_genrand, mti is set to N when the for loop completes. In GSL 1.8, in function mt_set of in mt.c, the statement state->mti = i; correctly reinitializes state->mti. In mt95.f90 (2003), in subroutine init_by_scalar, the statement state%cnt = n + 1_wi correctly reinitializes state%cnt. Best, Paul On Wednesday 29 November 2006 13:31, Paul C. Leopardi wrote: > To Makoto Matsumoto, Josi Rui Faustino de Sousa, gsl-discuss mailing list. > > Hi all, > The purpose of this email message is to document the different default > seeds used by some of the different implementations of "Mersenne Twister > with improved initialization" (2002). > > In summary, the value used by the original authors is 5489UL. GSL 1.8 uses > the obsolete value 4357. Josi Rui Faustino de Sousa's mt19937ar.f90 uses > the incorrect value 21641. This is fixed in mt95.f90. See details below. > > Some suggestions for various authors: > 1. Document the reason for changing the default seed of mt19937ar.c from > 4357 to 5489UL. > 2. Update mt.c GSL to use the value 5489UL rather than 4357. > 3. Document the default seed bug in mt19937ar.f90 (2002). > 4. Update the web page "Mersenne Twister in FORTRAN" > http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/VERSIONS/FORTRAN/fortran.html > to note the bug in mt19937ar.f90 (2002) and to list mt95.f90 (2003). ...