In GAP I would like to search the small groups library looking for groups with specific properties (I suppose this is the most common usage).
If I have a list of properties I want to test, what is the most efficient and elegant way to do this?
In some languages there is a 'Switch' statement, I couldn't find such a thing in GAP. Is there anything similar?
If I want to check several properties, is it better to iterate over a list checking all properties for each element in the list, or is it better to filter out of the list everything that doesn't have the first property, and then go back over the filtered list removing everything that doesn't have the second property, etc.
If I was iterating over the small groups by
for g in AllSmallGroups(n) do check some property check another property check some attributes od;
GAP would have to calculate some information about the group g, in the process perhaps learning some attributes about g.
For how long would GAP 'remember' these, and what is the best way to search keeping this in mind?
As long as
g
is the same group, GAP will (in the same session) remember all its properties (and use up memory for it). If you create the group anew (e.g. bySmallGroup(n,index)
, or by another call toAllSmallGroups
), all but the properties it is given from the start will be lost. So running group by group is the better way. However the way you use the loop you first create all groups and then remember them all with all their properties and attributes, which can be hard on the memory. Assuming you're looking for a few groups in a large set (or only want to store the identification numbers of the groups anyhow) running by index numbers will be much better:(There is no
switch
statement, but anelif
which will allow the same construct.)Added by AK: Also,
SmallGroupsInformation
is very useful: it may tell you how the groups of a given order are sorted, and which properties and attributes are precomputed for very fast use in selection functions likeAllSmallGroups
. For example:You can use this knowledge to speed up the search and narrow the search space.