This is now trac ticket 9867.
Please review!

On Sep 7, 8:56 pm, Dima Pasechnik <[email protected]> wrote:
> I've 
> madehttp://boxen.math.washington.edu/home/dima/packages/gap-4.4.12.p5.spkg
> with the proper patches, bells, etc., and
> will make a ticket to update the things shortly.
>
> On Sep 7, 8:14 pm, Dima Pasechnik <[email protected]> wrote:
>
>
>
> > Hi Simon, hi all,
>
> > I've made a small patch to GAP that fixes the problem.
> > (inspired by the corresponding Sage Python code :))
> > With this patch I get on Sparc:
>
> > sage: gap_console()
> > GAP4, Version: 4.4.12 of 17-Dec-2008, sparc-sun-solaris2.10-gcc
> > gap> Reset(GlobalMersenneTwister);; List([1..10],i->Random(1,100000));
> > [ 85758, 234, 18408, 12676, 2507, 38166, 24692, 15013, 4755, 94043 ]
>
> > All it does it changes (on bigendian machines)
> > the byte order in the appropriate integers:
> > The following is the diff for GAPROOT/src/integer.c
> > (the context diff is attached)
> > gap4r4/src$ diff integer.c.old integer.c
> > 3120c3120
> > <   UInt4 *mt, *init_key, key_length, i, j, k, N=624;
> > --->   UInt4 *mt, *init_key, key_length, i, j, k, N=624, temp;
> > 3140a3141,3146
> > > #ifdef WORDS_BIGENDIAN   /* to make the behaviour uniform across 
> > > platforms */
> > >        temp = ((init_key[j] & 0xFF) << 24) | ((init_key[j] & 0xFF00) << 8)
> > >                 | ((init_key[j] >> 8) & 0xFF00) | ((init_key[j] >> 24) & 
> > > 0xFF);
> > > #else
> > >        temp = init_key[j];
> > > #endif
>
> > 3142c3148
> > <          + init_key[j] + j;
> > ---
>
> > >          + temp + j;
>
> > It would be nice to put this in the upcoming GAP release...
>
> > ====== the following is Sage-specific: ===
> > I have put the updated Sage package file gap-4.4.12.p4.spkg
> > (I didn't change the number nor commited changes yet) 
> > here:http://boxen.math.washington.edu/home/dima/packages/gap-4.4.12.p4.spkg
> > (so you can try and see if this works for you)
>
> > To update sage with it correctly,
> > one should also remove the analogous fix in
> > SAGEROOT/devel/sage/sage/misc/randstate.pyx
> > (lines 687-703, starting from "if sys.byteorder == 'big':"
> > in set_seed_gap)
>
> > If you like, we can quickly make another update of gap spkg with this
> > fix (in sync with the fix for randstate.pyx)
>
> > ====================
>
> > Best,
> > Dima
>
> > On Sep 7, 4:58 pm, Simon King <[email protected]> wrote:
>
> > > Hi Mike!
>
> > > On 7 Sep., 10:42, Simon King <[email protected]> wrote:
>
> > > > ...
> > > > That's VERY cool!
>
> > > ... modulo one critical comment: In principal (although it should
> > > rarely occur in "real life") one can have several instances of an
> > > interface. So, I think that current_randstate().set_seed_gap() should
> > > accept an optional argument (namely an instance of GAP), and only if
> > > it is not provided then the default sage.interfaces.gap should be
> > > chosen.
>
> > > Do people feel I should modify it accordingly?
>
> > > Cheers,
> > > Simon

-- 
To post to this group, send an email to [email protected]
To unsubscribe from this group, send an email to 
[email protected]
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to