Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pickle FpGroups #87

Open
kiryph opened this issue Sep 17, 2020 · 1 comment
Open

Pickle FpGroups #87

kiryph opened this issue Sep 17, 2020 · 1 comment

Comments

@kiryph
Copy link

kiryph commented Sep 17, 2020

I miss the possibility to store a larger list of FpGroups to a file.
As far as I know, only permutation and matrix groups are implemented:

io/gap/pickle.gi

Lines 1155 to 1209 in a911c88

InstallMethod( IO_Pickle, "for a permutation group",
[ IsFile, IsPermGroup ],
function( f, g )
if IO_Write(f,"PRMG") = fail then return IO_Error; fi;
if IO_Pickle(f,GeneratorsOfGroup(g)) = IO_Error then return IO_Error; fi;
if HasSize(g) then
if IO_Pickle(f,Size(g)) = IO_Error then return IO_Error; fi;
else
if IO_Pickle(f,fail) = IO_Error then return IO_Error; fi;
fi;
if HasStabChainImmutable(g) then
if IO_Pickle(f,BaseStabChain(StabChainImmutable(g))) = IO_Error then
return IO_Error;
fi;
elif HasStabChainMutable(g) then
if IO_Pickle(f,BaseStabChain(StabChainMutable(g))) = IO_Error then
return IO_Error;
fi;
else
if IO_Pickle(f,fail) = IO_Error then return IO_Error; fi;
fi;
return IO_OK;
end );
IO_Unpicklers.PRMG :=
function(f)
local base,g,gens,size;
gens := IO_Unpickle(f); if gens = IO_Error then return IO_Error; fi;
g := GroupWithGenerators(gens);
size := IO_Unpickle(f); if size = IO_Error then return IO_Error; fi;
if size <> fail then SetSize(g,size); fi;
base := IO_Unpickle(f); if base = IO_Error then return IO_Error; fi;
if base <> fail then
StabChain(g,rec(knownBase := base));
fi;
return g;
end;
InstallMethod( IO_Pickle, "for a matrix group",
[ IsFile, IsMatrixGroup ],
function( f, g )
return IO_GenericObjectPickler(f,"MATG",[GeneratorsOfGroup(g)],g,
[Name,Size,DimensionOfMatrixGroup,FieldOfMatrixGroup],[],[]);
end );
IO_Unpicklers.MATG :=
function(f)
local g,gens;
gens := IO_Unpickle(f); if gens = IO_Error then return IO_Error; fi;
g := GroupWithGenerators(gens);
return
IO_GenericObjectUnpickler(f,g,
[Name,Size,DimensionOfMatrixGroup,FieldOfMatrixGroup],[]);
return g;
end;

For example:

gap> L24fp;
[ Group([ g1, g2, g3, g4 ]), Group([ g1, g2, g3, g5*g4^-1 ]), Group([ g1, g2, g3, g4^-2 ]), Group([ g1, g2, g3, g4^3 ]), Group([ g1, g2, g3, g4^-1*g5^2*g4^-1 ]), 
  Group([ g1, g2, g3, g4^-4 ]), Group([ g1, g2, g4 ]), Group([ g1, g2, g4^-2, g5*g4^-1 ]), Group([ g1, g2, g5*g4^-1, g3*g5*g4^-1*g3^-1 ]), 
  Group([ g1, g2, g5*g4^-1, g3*g4^-2*g3^-1 ]), Group([ g1, g2, g5*g4^-1, g3*g4^2*g5^-1*g3^-1 ]), Group([ g1, g2, g5*g4^-1, g3*g4^3*g3^-1 ]), 
  Group([ g1, g2, g5*g4^-1, g3*g4^-2*g5*g4^-1*g3^-1 ]), Group([ g1, g2, g5*g4^-1, g3*g4^-4*g3^-1 ]), Group([ g1, g2, g5*g4, g4^3 ]), Group([ g1, g2, g5*g4, g4^-4 ]), 
  Group([ g1, g2, g5*g4, g4^5 ]), Group([ g1, g2, g5*g4, g4^-6 ]), Group([ g1, g2, g5*g4, g4^7 ]), Group([ g1, g2, g5*g4, g4^-8 ]), Group([ g1, g2, g4^-2 ]), 
  Group([ g1, g2, g3*g4^-2*g3^-1, g4^-4 ]), Group([ g1, g2, g4^-2*g5^-1*g4^-1 ]), Group([ g1, g2, g3*g4^-2*g3^-1, g4^-2*g5*g4^-1 ]), Group([ g1, g3, g4 ]), 
  Group([ g1, g3, g5*g4^-1 ]), Group([ g1, g3, g4^-2 ]), Group([ g1, g3, g4^-1*g5^2*g4^-1 ]), Group([ g1, g3, g4^3 ]), Group([ g1, g4 ]), 
  Group([ g1, g4*g2^-1, g4^-1*g2^-1 ]), Group([ g1, g4*g2^-1, g3*g4^-2*g3^-1 ]), Group([ g1, g4*g2^-1, g3*g4^3*g3^-1 ]), Group([ g1, g4*g2^-1, g3*g4^-4*g3^-1 ]), 
  Group([ g1, g4^-2, g5*g4^-1 ]), Group([ g1, g5*g4^-1, g3*g5*g4^-1*g3^-1 ]), Group([ g1, g5*g4^-1, g3*g4^-2*g3^-1 ]), Group([ g1, g5*g4, g2*g4^2 ]), 
  Group([ g1, g4^-2, g5^-2, g2*g4*g5^-1 ]), Group([ g1, g2*g4*g5^-1, g3*g4^-2*g3^-1 ]), Group([ g1, g5*g4, g4^3 ]), Group([ g1, g5*g4, g4^3*g2^-1 ]), 
  Group([ g1, g5*g4, g4^-4 ]), Group([ g1, g5*g4, g2*g4^4 ]), Group([ g1, g2*g4*g5, g2*g4^-2 ]), Group([ g1, g2*g4*g5, g2*g4^-1*g5^-1, g4^-4 ]), 
  Group([ g1, g2*g4*g5, g2*g4^-1*g5^-1, g4^-2*g5*g4^-1 ]), Group([ g1, g2*g4^2, g2*g4^-2 ]), Group([ g1, g4^-2 ]), Group([ g2, g3, g4 ]), Group([ g2, g3, g5*g4^-1 ]), 
  Group([ g2, g3, g4^-2 ]), Group([ g2, g3, g4^2*g5^-1 ]), Group([ g2, g3, g4^3 ]), Group([ g2, g3, g4^-1*g5^2*g4^-1 ]), Group([ g2, g4, g5 ]), 
  Group([ g2, g4, g5^-2, g1*g3^-1*g5^-1 ]), Group([ g2, g4, g5^-2 ]), Group([ g2, g4, g5^3 ]), Group([ g2, g4, g1*g3^-1*g5^3 ]), Group([ g2, g4, g5^-4 ]), 
  Group([ g2, g5*g4^-1, g1*g4^2 ]), Group([ g2, g5*g4^-1, g3*g5*g4^-1*g3^-1 ]), Group([ g2, g5*g4^-1, g4*g3^-1*g4^-1*g3, g4^3*g1^-1 ]), 
  Group([ g2, g5*g4^-1, g3*g4^-2*g3^-1 ]), Group([ g2, g5*g4^-1, g1*g3*g4^2*g3^-1 ]), Group([ g2, g5^-2, g1*g3*g5^-1, g4^-4 ]), Group([ g2, g4^-2, g5^-2 ]), 
  Group([ g2, g4^-2, g3*g4^2*g1^-1 ]), Group([ g2*g1^-1, g3, g4 ]), Group([ g2*g1^-1, g3, g5*g4^-1 ]), Group([ g2*g1^-1, g3, g4^-2 ]), 
  Group([ g2*g1^-1, g3, g4^-1*g5^2*g4^-1 ]), Group([ g2*g1^-1, g3, g4^3 ]), Group([ g2*g1^-1, g4 ]), Group([ g2*g1^-1, g4*g1^-1, g4^-1*g1^-1 ]), 
  Group([ g2*g1^-1, g4*g1^-1, g4^-3*g1^-1 ]), Group([ g2*g1^-1, g4*g1^-1, g4^-5*g1^-1 ]), Group([ g2*g1^-1, g4*g1^-1, g4^-7*g1^-1 ]), 
  Group([ g2*g1^-1, g4*g3^-1, g4^-1*g3 ]), Group([ g2*g1^-1, g4^-1*g3, g3*g5^2 ]), Group([ g2*g1^-1, g4^-1*g3, g4^2*g5^-1*g3^-1 ]), Group([ g2*g1^-1, g4^-2, g5*g4^-1 ]), 
  Group([ g2*g1^-1, g5*g4^-1, g3*g5*g4^-1*g3^-1 ]), Group([ g2*g1^-1, g5*g4^-1, g4*g3^-1*g4^-1*g3, g4^3*g1^-1 ]), Group([ g2*g1^-1, g5*g4^-1, g3*g4^-2*g3^-1 ]), 
  Group([ g2*g1^-1, g5*g4, g4^3 ]), Group([ g2*g1^-1, g5*g4, g4^-4 ]), Group([ g2*g1^-1, g1*g4*g5, g4^-4 ]), Group([ g2*g1^-1, g4^-2 ]), Group([ g3, g4 ]), 
  Group([ g3, g5*g4^-1 ]), Group([ g3, g4^-2 ]), Group([ g4, g5 ]), Group([ g4, g5*g2^-1, g5^-1*g2^-1 ]), Group([ g4, g5*g2^-1, g1*g3^-1*g5 ]), 
  Group([ g4, g5*g2^-1, g5^-3*g2^-1 ]), Group([ g4, g5*g2^-1, g1*g3^-1*g5^3 ]), Group([ g4, g5^-2, g1*g3^-1*g5^-1 ]), Group([ g4, g1*g3^-1*g5^-1, g5^-4 ]), 
  Group([ g4, g5^-2, g2*g3*g4^-1*g1^-1 ]), Group([ g4, g5^-2 ]), Group([ g4, g5^-4, g1*g2*g3^-1*g5^-2 ]), Group([ g4*g2^-1, g5*g2^-1, g1*g2*g4 ]), 
  Group([ g4*g2^-1, g5*g2^-1, g3*g4^-2*g3^-1 ]), Group([ g4*g2^-1, g5*g2^-1, g1*g2*g4^3 ]), Group([ g4*g2^-1, g4^-1*g2^-1, g5^-2 ]), 
  Group([ g4*g2^-1, g4^-1*g2^-1, g3*g4^2*g1^-1 ]), Group([ g4*g3^-1, g4^-1*g3, g5*g3^-1 ]), Group([ g5*g4^-1, g1*g2*g4^-1, g3*g4^-2*g3^-1 ]), 
  Group([ g5*g4^-1, g1*g4^2 ]) ]

Documentation on Extending the pickling framework can be found here:
https://gap-packages.github.io/io/doc/chap5_mj.html#X7B1C9A9C7D3C0312

@fingolfin
Copy link
Member

Sure, something like this would be nice, also for pc groups. If anybody is interested in working on this, patches are welcome.

Note that pickling fp groups is a bit tricky, as each fp group has its own family, and one has to be very careful to handle this correctly when e.g. also pickling list of elements of fp groups.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants