Let us say I have two matrix groups G and H and dimensions of the matrices in those groups are $3\times3$. When I use the function DirectProduct(G,H), it creates a matrix group in which the dimensions of the matrices are $6\times6$. Basically, it calculates the direct sum of two matrices. However, what I want is the basic form of a direct product which is elements of type (g,h).
I tried the following code:
gap> gl_V2 := GL(3,5);
GL(3,5)
gap> gl_V3 := GL(3,5);
GL(3,5)
gap> Size(gl_V2);
1488000
gap> Size(gl_V3);
1488000
gap> last*last2;
2214144000000
gap> mydirectproduct:=function(G,H)
> local i,j,result;
> result:=[];
> for i in G do
> for j in H do
> Add(result, [i,j]);
> od;
> od;
> return result;
> end;
which took forever to compute of course (actually I am not sure if it computed or not). Is there a way to do this efficiently? Thanks in advance.
DirectProductby design (as all other group products) chooses a representation in which calculations are efficient and only as a fall-back defaults to a formal pair representation. One can useEmbeddingandProjectionto (de)compose elements. One could useApplicableMethodto get the fallback method for testing purposes, but I would not recommend doing so (and thus will not explain further how this could be done).If -- say for an orbit algorithm -- you really need elements as pairs (to avoid a cost from
Projection), I would simply construct generators of the direct product asTuple([a,b])and form the group generated by them (without making a formal direct product object). Clearly you do not need to form all pairs, but it is sufficient to take pairs $(e,1)$ and $(1,f)$ with $e$ running through the generators of the first group and $f$ ditto for the second group.