[GAP Forum] Serialisation

Sandeep Murthy s.murthy at mykolab.com
Wed Feb 11 14:29:24 GMT 2015


Thanks for the information.

But it seems SCSCP.IO_PickleToString calls IO.IO_Pickle() according to this page

http://www.gap-system.org/Manuals/pkg/scscp/doc/chap9.html#X84F055ED860120D5

and the description of the string output is that it is in ""pickled" format as OpenMath strings”.

I don’t need OM output, it’s just important that it is a compact string output that
can be used to reconstruct the object if necessary.

This serial ID is part of a JSON record I am writing to a data file for a given group in the
small groups library.  Which method do I use to get the permutation group form of any
given group in this library?

Sandeep Murthy
s.murthy at mykolab.com

> On 11 Feb 2015, at 14:17, Christopher Jefferson <caj21 at st-andrews.ac.uk> wrote:
> 
> IO_PickleToString comes from the IO package, rather than the SCSCP package.
> 
> IO's Pickle provides a different set of methods to serialise GAP objects,
> which tend to be smaller and faster to parse/unparse than openmath, but as
> you saw do not implement all types.
> 
> If you want to use open math, then use the 'OM' methods:
> 
> gap> OMPrint(SymmetricGroup(3));
> <OMOBJ>
> 	<OMA>
> 		<OMS cd="permgp1" name="group"/>
> 		<OMS cd="permutation1" name="right_compose"/>
> 		<OMA>
> 			<OMS cd="permut1" name="permutation"/>
> 			<OMI>2</OMI>
> 			<OMI>3</OMI>
> 			<OMI>1</OMI>
> 		</OMA>
> 		<OMA>
> 			<OMS cd="permut1" name="permutation"/>
> 			<OMI>2</OMI>
> 			<OMI>1</OMI>
> 		</OMA>
> 	</OMA>
> </OMOBJ>
> gap> OMPrint(DihedralGroup(6));
> <OMOBJ>
> 	<OMA>
> 		<OMS cd="pcgroup1" name="pcgroup_by_pcgscode"/>
> 		<OMI>25</OMI>
> 		<OMI>6</OMI>
> 	</OMA>
> </OMOBJ>
> 
> 
> 
> 
> On 11/02/2015 14:05, "Sandeep Murthy" <s.murthy at mykolab.com> wrote:
> 
>> Hi
>> 
>> I am trying to use the IO_PickleToString() method from the SCSCP package
>> to test out how GAP serialises group objects.  This does not appear to be
>> working as expected on the isomorphic groups Sym(3) and D_6 (dihedral
>> group).
>> 
>> gap> IO_PickleToString( SymmetricGroup( 3 ) );
>> "PRMGILIS\>2PERM\>7(1,2,3)PERM\>5(1,2)INTG\>16FAIL²
>> 
>> This looks OK but for D_6 it fails:
>> 
>> gap> IO_PickleToString( DihedralGroup( 6 ) );
>> Error, no method found! For debugging hints type ?Recovery from
>> NoMethodFound
>> Error, no 1st choice method found for `IO_Pickle' on 2 arguments called
>> from
>> IO_Pickle( s, obj ); called from
>> <function "IO_PickleToString">( <arguments> )
>> called from read-eval loop at line 20 of *stdin*
>> you can 'quit;' to quit to outer loop, or
>> you can 'return;' to continue
>> brk>
>> 
>> Why is this?  Both should return OpenMath strings.
>> 
>> Sandeep
> 



More information about the Forum mailing list