/*K:=CyclotomicField(4); GL3K:=GeneralLinearGroup(3,K); A:=elt; B:=elt; G:=sub; S:=PolynomialRing(K,3); DecomposeGAction(G,S,2);*/ dot := function(M,N) n:=#M; ans:=0; for i:=1 to n do ans:=ans+M[i]*N[i]; end for; return ans; end function; tolist:=function(Y,degZ) L:=[]; for i:=1 to degZ do L:=Append(L,Y[i]); end for; return L; end function; myrecord :=function(j,Z,Bd,RF,mult) Y:=Basis(Z); degZ:=Degree(Z); n:=#Y; elts:=[]; for i:=1 to n do elts:=Append(elts,dot(tolist(Y[i],degZ),Bd)); end for; return rec< RF | CharacterRow:=j,Dimension:=Dimension(Z), Multiplicity:=mult, Elements:=elts>; end function; /*ActionGenerators(M) : ModGrp -> [ AlgMatElt ] Return the matrices giving the action on the module M as a sequence. These are the images of the generators of the group in the corresponding representation. Question: if I compute Classes(G) and Classes(Gd) and CharacterTable(G) and CharacterTable(G2) will I get the same thing? */ DecomposeGAction:=function(G,S,d) Gmod,gmap,Bd:=GModule(G,S,d); n:=Dimension(Gmod); chi:=Character(Gmod); K:=CoefficientRing(S); GLnK:=GeneralLinearGroup(n,K); Gd:=sub; F:=hom Gd | ActionGenerators(Gmod)>; T:=CharacterTable(G); L:=Decomposition(T,chi); f:=Inverse(NumberingMap(G)); N:=Order(G); RF := recformat< CharacterRow, Dimension, Multiplicity, Elements >; p:=#L; ans:=[]; for j:=1 to p do if L[j] ne 0 then M:=ZeroMatrix(K,n,n); for i:=1 to N do M:=M + ComplexConjugate(T[j](f(i)))*Matrix(F(f(i))); end for; ans:=Append(ans,myrecord(j,Image(M),Bd,RF,Dimension(Image(M))/T[j][1])); end if; end for; return ans; end function;