[sage-devel] Re: Saving GAP objects across sessions
On Wednesday, February 8, 2012 12:18:17 AM UTC+8, javier wrote: > > Hi Dima, > > I didn't know about CodePcgs, thanks for bringing it up! > This workaround has the disadvantage that one must re-generate the > groups each time, which is an annoyance I can live with for now I > guess. > Is there any advantage in saving the CodePcgs rather than the Small > Group Library ID? In your example, why would one want to save the > tuple (5790338948, 24) rather than (24, 12)? > well, not every pc group lives in Small Group Library. :-) Surely, if all your groups are there, the ID will do... Dima -- 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
[sage-devel] Re: Saving GAP objects across sessions
Hi Dima, I didn't know about CodePcgs, thanks for bringing it up! This workaround has the disadvantage that one must re-generate the groups each time, which is an annoyance I can live with for now I guess. Is there any advantage in saving the CodePcgs rather than the Small Group Library ID? In your example, why would one want to save the tuple (5790338948, 24) rather than (24, 12)? Cheers, Javier On 7 feb, 01:53, Dima Pasechnik wrote: > A workaround is to use GAP facilities to encode a pc group using a pair of > integers. > Cutting from the GAP manual on CodePcgs > > gap> G := SmallGroup( 24, 12 );; > gap> p := Pcgs( G );; > gap> code := CodePcgs( p ); > 5790338948 > gap> H := PcGroupCode( code, 24 ); > > gap> map := GroupHomomorphismByImages( G, H, p, FamilyPcgs(H) ); > Pcgs([ f1, f2, f3, f4 ]) -> Pcgs([ f1, f2, f3, f4 ]) > gap> IsBijective(map); > true > > That is, in Sage you'd do > sage: G = gap.SmallGroup( 24, 12 ) > sage: code=gap.CodePcgs(gap.Pcgs( G )) > sage: code > 5790338948 > > (and you can easily store 24 and 5790338948), and then recover them: > sage: gap.PcGroupCode(code,24) > Group( [ f1, f2, f3, f4 ] ) > > HTH, > Dima -- 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
[sage-devel] Re: Saving GAP objects across sessions
A workaround is to use GAP facilities to encode a pc group using a pair of integers. Cutting from the GAP manual on CodePcgs gap> G := SmallGroup( 24, 12 );; gap> p := Pcgs( G );; gap> code := CodePcgs( p ); 5790338948 gap> H := PcGroupCode( code, 24 ); gap> map := GroupHomomorphismByImages( G, H, p, FamilyPcgs(H) ); Pcgs([ f1, f2, f3, f4 ]) -> Pcgs([ f1, f2, f3, f4 ]) gap> IsBijective(map); true That is, in Sage you'd do sage: G = gap.SmallGroup( 24, 12 ) sage: code=gap.CodePcgs(gap.Pcgs( G )) sage: code 5790338948 (and you can easily store 24 and 5790338948), and then recover them: sage: gap.PcGroupCode(code,24) Group( [ f1, f2, f3, f4 ] ) HTH, Dima -- 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
[sage-devel] Re: Saving GAP objects across sessions
Hi Javier, On 6 Feb., 14:34, David Joyner wrote: > There is a way to save the gap workspace. I think it is > explained in the gap interface module somewhere. > That might help. But, as much as I know, one can not save individual GAP objects. Note that in some cases (e.g., Permutation Groups) you can work around the problem by saving the string representation of the GAP object, and reconstruct the object from that string representation. That won't always work (and I think this is quite a weakness of GAP), but in your example it does work: sage: G = gap.SymmetricGroup(4) sage: G SymmetricGroup( [ 1 .. 4 ] ) sage: s = repr(G) sage: tmp = tmp_filename() sage: save(s,tmp) sage: gap(load(tmp)) SymmetricGroup( [ 1 .. 4 ] ) 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