You can specify permutation actions by a function in GAP. Since multiplication of matrices with permutations is not defined, it will have to implement the appropriate permutations of rows or columns.
The action then is obtained by either ActionHomomorphism (the homomorphism) or Action (the permutation group image).
The domain can be specified as GAP object, or as list of elements; having nice properties (being sorted, allowing an Enumerator, ...) can substantially improve performance.
Thus for example the first action could be obtained as:
n:=3;
q:=4;
Omg:=GL(n,q); #Omega is reserved word
Sym:=SymmetricGroup(n);
myact1:=function(a,g)
local m;
m:=List(a,x->Permuted(x,g));
m:=Permuted(m,g^-1);
m:=ImmutableMatrix(DefaultFieldOfMatrix(a),m); # for efficiency make compact
return m;
end;
perm:=Action(G,Omg,myact1);
For the second action the extra work is in determining the two parts of a direct product element, which can be done by projections.
G:=DirectProduct(Sym,Sym);
p1:=Projection(G,1); # decompose an element in its parts
p2:=Projection(G,2);
myact2:=function(a,pair)
local m,g;
g:=Image(p1,pair);
m:=List(a,x->Permuted(x,g));
m:=Permuted(m,Image(p2,pair)^-1);
m:=ImmutableMatrix(DefaultFieldOfMatrix(a),m); # for efficiency compact
return m;
end;
perm:=Action(G,Omg,myact2);
In the third case one needs to construct the set of all 0/1 matrices first:
rows:=Tuples([0,1],n);
zerooone:=Tuples(rows,n);;
The direct product of symmetric groups is easiest obtained as set stabilizer:
k:=1;
stb:=Stabilizer(Sym,[1..k],OnSets);
G:=DirectProduct(stb,stb);
p1:=Projection(G,1);
p2:=Projection(G,2);
Then the same action function myact2 can be used.