[MATRIX-SIG] Re: [PYTHONMAC-SIG] MacPython v1.5b3 / NumPy bugs?

Konrad Hinsen hinsen@ibs.ibs.fr
Wed, 7 Jan 1998 18:36:29 +0100


> Yes, I noticed that. All the other fixes I tried (clamping the x value to 31 
> bits, or by trickery converting the longint to the 32bit signed representation 
> that corresponds to the unsigned value) have resulted in strange crashes 
> inside ranlib.set_seeds(). It turns out that the library that underlies the 
> ranlib module handles errors by calling printf() and then exit(); not very 
> nice on the Mac because you never get to see the output:-(

Not nice on Unix either, although you usually do see the error... Here's
an example:

ranlib.set_seeds(0, -2)
 a, m, s out of order in mltmod - ABORT! a =   2082007225 s =            0 m =   2147483563
 mltmod requires: 0 < a < m; 0 < s < m

But other than by using negative seeds I can't get such an error.

> Apparently the numbers you give to ranlib.set_seeds() have to satisfy certain 
> criteria, what are these criteria, matrix-folks? If I know these I can come up 
> with two randomish numbers that match them for the mac...

Almost anything works for me as long as the seeds are positive.
The Python wrapper just passes two long arguments to the
function setall, defined in NumPyLib/com.c:

void setall(long iseed1,long iseed2)
/*
**********************************************************************
     void setall(long iseed1,long iseed2)
               SET ALL random number generators
     Sets the initial seed of generator 1 to ISEED1 and ISEED2. The
     initial seeds of the other generators are set accordingly, and
     all generators states are set to these seeds.
     This is a transcription from Pascal to Fortran of routine
     Set_Initial_Seed from the paper
     L'Ecuyer, P. and Cote, S. "Implementing a Random Number Package
     with Splitting Facilities." ACM Transactions on Mathematical
     Software, 17:98-111 (1991)
                              Arguments
     iseed1 -> First of two integer seeds
     iseed2 -> Second of two integer seeds
**********************************************************************
*/
...


But just an idea: are you sure the f2c generated code works on the
Mac at all? It makes assumptions about the relative sizes of
various data types, which might not be true on the Mac. In that
case you might be overwriting essential data in common blocks.
-- 
-------------------------------------------------------------------------------
Konrad Hinsen                          | E-Mail: hinsen@ibs.ibs.fr
Laboratoire de Dynamique Moleculaire   | Tel.: +33-4.76.88.99.28
Institut de Biologie Structurale       | Fax:  +33-4.76.88.54.94
41, av. des Martyrs                    | Deutsch/Esperanto/English/
38027 Grenoble Cedex 1, France         | Nederlands/Francais
-------------------------------------------------------------------------------

_______________
PYTHONMAC-SIG  - SIG on Python for the Apple Macintosh

send messages to: pythonmac-sig@python.org
administrivia to: pythonmac-sig-request@python.org
_______________