Installing a new function in GAP

154 Views Asked by At

I have written the following snippet of code to compute the subgroup permutability degree of a finite group $G$.

spd := function(G)
local allsubs, subreps, count, H, K, index;
subreps := Flat(List(ConjugacyClassesSubgroups(G),Representative)); 
allsubs := Flat(List(ConjugacyClassesSubgroups(G),Elements)); 
count:=0;
for H in subreps do
  index := Index(G,Normalizer(G,H));
  for K in allsubs do
    if ArePermutableSubgroups(H,K) then 
      count := count+index; 
    fi;
  od;
od;
return Float(count/(Size(allsubs)^2));
end;

I want to ask two things: first, whether this can be slightly improved to run faster, and second, how to install this as a function in GAP so that I don't have to define it every time I run the programme.

1

There are 1 best solutions below

3
On BEST ANSWER

The first comment by Alexander Konovalov already tells you how you could make the function available in every run automatically.

Unless all your groups are solvable (in which case PC groups would be the choice), and assuming they can be represented by permutations of plausible degree, permutation groups are as good as it gets.

As for further improvements, you could replace `allsubs' with representatives of the orbits of the normalizer of H. These are parameterized by double cosets. That is your code would have the structure:

cl:=ConjugacyClassesSubgroups(G);
for i in cl do
  H:=Representative(i);
  HN:=Normalizer(G,i); # or StabilizerOfExternalSet(i) should also work.
  for j in cl do
    Kr:=Representative(j);
    KN:=Normalizer(G,Kr);
    dc:=DoubleCosets(G,KN,HN);
    for d in dc do
      K:=Kr^Representative(d);

and then go on as you have. This will not imprve the complexity, but the number of permutability tests by a factor.