[sage-devel] Re: How to deal with GAP's machine dependent random generator?

2010-09-11 Thread Dima Pasechnik
On Sep 11, 2:36 pm, Mike Hansen wrote: > On Fri, Sep 10, 2010 at 10:17 PM, Dima Pasechnik wrote: > > Does current_randstate().set_seed_gap() actually sets GAP's random > > seed, so that > > subsequent GAP commands make use of the correctly set seed? > > Yep. I see. Well, I am told that my GAP

Re: [sage-devel] Re: How to deal with GAP's machine dependent random generator?

2010-09-10 Thread Mike Hansen
On Fri, Sep 10, 2010 at 10:17 PM, Dima Pasechnik wrote: > Does current_randstate().set_seed_gap() actually sets GAP's random > seed, so that > subsequent GAP commands make use of the correctly set seed? Yep. --Mike -- To post to this group, send an email to sage-devel@googlegroups.com To unsub

[sage-devel] Re: How to deal with GAP's machine dependent random generator?

2010-09-10 Thread Dima Pasechnik
Hi Simon, On Sep 9, 10:23 pm, Simon King wrote: > Hi Dima! > > On Sep 9, 2:44 pm, Dima Pasechnik wrote: > > >... > > Nobody seems to be willing to review the ticket, however, as if the > > problem got resolved in a way that escapes me. > > The problem for my package did indeed resolve, due to >

[sage-devel] Re: How to deal with GAP's machine dependent random generator?

2010-09-09 Thread Simon King
Hi Dima! On Sep 9, 2:44 pm, Dima Pasechnik wrote: >... > Nobody seems to be willing to review the ticket, however, as if the > problem got resolved in a way that escapes me. The problem for my package did indeed resolve, due to current_randstate().set_seed_gap(). But of course it should better b

[sage-devel] Re: How to deal with GAP's machine dependent random generator?

2010-09-09 Thread Dima Pasechnik
On Sep 9, 3:12 am, Peter Jeremy wrote: > On 2010-Sep-06 21:29:35 +0100, "Dr. David Kirkby" > wrote: > > >I would be very weary of any random number generator that claims to be a good > >source of random numbers if the output differs by platform or compilation > >mode. > > It depends what you

Re: [sage-devel] Re: How to deal with GAP's machine dependent random generator?

2010-09-08 Thread Peter Jeremy
On 2010-Sep-06 21:29:35 +0100, "Dr. David Kirkby" wrote: >I would be very weary of any random number generator that claims to be a good >source of random numbers if the output differs by platform or compilation >mode. It depends what you mean by "differs". For "real" random numbers, you can

[sage-devel] Re: How to deal with GAP's machine dependent random generator?

2010-09-07 Thread Dima Pasechnik
This is now trac ticket 9867. Please review! On Sep 7, 8:56 pm, Dima Pasechnik 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 Pas

[sage-devel] Re: How to deal with GAP's machine dependent random generator?

2010-09-07 Thread Dima Pasechnik
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 wrote: > Hi Simon, hi all, > > I've made a small patch to GAP that fixes the problem. > (in

[sage-devel] Re: How to deal with GAP's machine dependent random generator?

2010-09-07 Thread Dima Pasechnik
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->Rand

[sage-devel] Re: How to deal with GAP's machine dependent random generator?

2010-09-07 Thread Simon King
Hi Mike! On 7 Sep., 10:42, Simon King 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 argu

[sage-devel] Re: How to deal with GAP's machine dependent random generator?

2010-09-07 Thread Simon King
Hi Mike! On 7 Sep., 01:05, Mike Hansen wrote: > On Mon, Sep 6, 2010 at 3:56 PM, Simon King wrote: > > So indeed, it is not "Solaris vs. non-Solaris" but "little vs. big > > endian", as the GAP people suspected. > > This is what I said in my first response and can be taken care of with > current_

Re: [sage-devel] Re: How to deal with GAP's machine dependent random generator?

2010-09-06 Thread Mike Hansen
On Mon, Sep 6, 2010 at 9:31 PM, Dima Pasechnik wrote: > I wonder how does GAP pick up the seed? (Don't even know where to look > in the code...) It is in sage/misc/randstate.pyx. > On the other hand, how would one call > current_randstate().set_seed_gap()  from GAP? You can't call it from GAP,

[sage-devel] Re: How to deal with GAP's machine dependent random generator?

2010-09-06 Thread Dima Pasechnik
Indeed, this works on PPC, too: sage: set_random_seed(100) sage: current_randstate().set_seed_gap() sage: gap.eval('List([1..10],i->Random(1,10));') '[ 80761, 80557, 8462, 25730, 32000, 92371, 85402, 52347, 17181, 2889 ]' sage: gap_console() GAP4, Version: 4.4.12 of 17-Dec-2008, powerpc-apple-

Re: [sage-devel] Re: How to deal with GAP's machine dependent random generator?

2010-09-06 Thread Mike Hansen
On Mon, Sep 6, 2010 at 3:56 PM, Simon King wrote: > So indeed, it is not "Solaris vs. non-Solaris" but "little vs. big > endian", as the GAP people suspected. This is what I said in my first response and can be taken care of with current_randstate().set_seed_gap(). Core2: sage: set_random_seed(

[sage-devel] Re: How to deal with GAP's machine dependent random generator?

2010-09-06 Thread Simon King
Hi Dave! On 6 Sep., 23:53, "Dr. David Kirkby" wrote: > ... > >      Reset(GlobalMersenneTwister);; List([1..10],i->Random(1,10)); > > This is on a Sun Ultra 27 running OpenSolaris, with a Xeon box. > >... > gap> Reset(GlobalMersenneTwister);; List([1..10],i->Random(1,10)); > [ 85758, 234,

Re: [sage-devel] Re: How to deal with GAP's machine dependent random generator?

2010-09-06 Thread Dr. David Kirkby
On 09/ 6/10 10:42 PM, Simon King wrote: Hi Dave! On 6 Sep., 22:29, "Dr. David Kirkby" wrote: Is the endianness really different on sage.math and t2.math? Yes. x86 are little endian. SPARC is big endian. Cool! Now I am really proud that my code mostly works on t2. I can try the code if yo

[sage-devel] Re: How to deal with GAP's machine dependent random generator?

2010-09-06 Thread Simon King
Hi Dave! On 6 Sep., 22:29, "Dr. David Kirkby" wrote: > > Is the endianness really different on sage.math and t2.math? > > Yes. x86 are little endian. SPARC is big endian. Cool! Now I am really proud that my code mostly works on t2. > I can try the code if you want on my OpenSolaris system. That

Re: [sage-devel] Re: How to deal with GAP's machine dependent random generator?

2010-09-06 Thread Dr. David Kirkby
On 09/ 6/10 09:17 PM, Simon King wrote: Hi Dima! On 6 Sep., 19:47, Dima Pasechnik wrote: On the GAP support list we reached the conclusion that it is due to endianness. Is the endianness really different on sage.math and t2.math? Yes. x86 are little endian. SPARC is big endian. I can try

[sage-devel] Re: How to deal with GAP's machine dependent random generator?

2010-09-06 Thread Simon King
Hi Dima! On 6 Sep., 19:47, Dima Pasechnik wrote: > On the GAP support list we reached the conclusion that it is due to > endianness. Is the endianness really different on sage.math and t2.math? This is actually a little ironic: At Sage Days XX in San Diego, a couple of years ago, both Martin Al

[sage-devel] Re: How to deal with GAP's machine dependent random generator?

2010-09-06 Thread Simon King
Hi Nils! On 6 Sep., 19:44, Nils Bruin wrote: > If your tests depend on the choice of random numbers in a non- > deterministic algorithm, they are going to be very fragile. Sure. But the funtionality "determine a Sylow subgroup", "find an isomorphism between two finite groups" etc. is essential t

[sage-devel] Re: How to deal with GAP's machine dependent random generator?

2010-09-06 Thread Dima Pasechnik
On the GAP support list we reached the conclusion that it is due to endianness. (I can reproduce this behaviour on a MacOSX PPC machine) It can also be noted that apparently GAP uses an old Mersenne Twister code, whereas it is known to be buggy in exactly this way (endianness!), and fixes exist...

[sage-devel] Re: How to deal with GAP's machine dependent random generator?

2010-09-06 Thread Nils Bruin
On Sep 6, 4:55 am, Simon King wrote: > It seems that due to this problem, my package may compute a different > (though isomorphic) ring presentation for a cohomology ring on > different machines. > > But in some tests, I create elements with certain properties, and for > that purpose I need a comp

[sage-devel] Re: How to deal with GAP's machine dependent random generator?

2010-09-06 Thread Simon King
Hi! On Sep 6, 12:55 pm, Simon King wrote: > ... > What do you think is the best way to cope with that problem? Is there > a painless way to duplicate some doctests and tell the test script > that one version is for Solaris and the other is for everything else? I just wonder if spkg-install could

[sage-devel] Re: How to deal with GAP's machine dependent random generator?

2010-09-06 Thread Simon King
PS: On Sep 6, 1:21 pm, Simon King wrote: > > ... > > Do you need to use Random numbers? Can't you just pick a set of integers - > > either those from t2, sage.math, or the lottery numbers, and use them > > instead? > > I don't need these specific numbers. The example was just a concise > way to

[sage-devel] Re: How to deal with GAP's machine dependent random generator?

2010-09-06 Thread Simon King
Hi Dave, On Sep 6, 1:02 pm, "Dr. David Kirkby" wrote: > ... > Do you need to use Random numbers? Can't you just pick a set of integers - > either those from t2, sage.math, or the lottery numbers, and use them instead? I don't need these specific numbers. The example was just a concise way to sho