For most of the common types of groups, calling Random on the trivial group works fine. Not so for PcpGroups:
gap> Random(TrivialGroup(IsPcGroup));
<identity> of ...
gap> Random(TrivialGroup(IsPermGroup));
()
gap> Random(TrivialGroup(IsFpGroup));
<identity ...>
gap> Random(TrivialGroup(IsPcpGroup));
Error, cannot compute this
at /usr/lib/gap-4.11.1/pkg/polycyclic/gap/pcpgrp/general.gi:28 called from
MappedVector( g, pcp ) at /usr/lib/gap-4.11.1/pkg/polycyclic/gap/basic/pcpgrps.gi:111 called from
func( GlobalMersenneTwister, x ) at /usr/lib/gap-4.11.1/lib/random.gi:303 called from
<function "Random for a pcp group">( <arguments> )
The error happens because Random ends up calling MappedVector( [], Pcp [ ] with orders [ ] ), and MappedVector returns this error when the first argument has zero length. By contrast, the following does work, even though this is again the trivial group:
gap> H := AbelianPcpGroup( [ 1 ] );
Pcp-group with orders [ 1 ]
gap> Random( H );
id
Would adding the following code to Random in /basic/pcpgrps.gi (line 94) be an acceptable fix?
For most of the common types of groups, calling Random on the trivial group works fine. Not so for PcpGroups:
The error happens because
Random
ends up callingMappedVector( [], Pcp [ ] with orders [ ] )
, andMappedVector
returns this error when the first argument has zero length. By contrast, the following does work, even though this is again the trivial group:Would adding the following code to
Random
in /basic/pcpgrps.gi (line 94) be an acceptable fix?