I've made
http://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 <dimp...@gmail.com> 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 <simon.k...@nuigalway.ie> wrote:
>
>
>
> > Hi Mike!
>
> > On 7 Sep., 10:42, Simon King <simon.k...@nuigalway.ie> 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 sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to