-
Notifications
You must be signed in to change notification settings - Fork 166
/
Copy pathmeataxe.gi
3650 lines (3282 loc) · 117 KB
/
meataxe.gi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#############################################################################
##
## This file is part of GAP, a system for computational discrete algebra.
## This file's authors include Derek Holt, Sarah Rees, Alexander Hulpke.
##
## Copyright of GAP belongs to its developers, whose names are too numerous
## to list here. Please refer to the COPYRIGHT file for details.
##
## SPDX-License-Identifier: GPL-2.0-or-later
##
## This file contains the 'Smash'-MeatAxe modified for GAP4 and using the
## standard MeatAxe interface. It defines the MeatAxe SMTX.
##
InstallGlobalFunction(GModuleByMats,function(arg)
local l,f,dim,m;
if Length(arg)<>2 and Length(arg)<>3 then
Error("Usage: GModuleByMats(<mats>,[<dim>,]<field>)");
fi;
l:=arg[1];
f:=arg[Length(arg)];
if Length(l)>0 and Characteristic(l[1])<>Characteristic(f) then
Error("matrices and field do not fit together");
fi;
l:=List(l,i->ImmutableMatrix(f,i));
if ForAny(l,i->NrRows(i)<>NrCols(i)) or
Length(Set(l,NrRows))>1 then
Error("<l> must be a list of square matrices of the same dimension");
fi;
m:=rec(field:=f,
isMTXModule:=true);
if Length(l)>0 then
dim:=NrRows(l[1]);
if Length(arg) = 3 then
if dim <> arg[2] then
Error("matrices and dim do not fit together");
fi;
fi;
elif Length(arg)=2 then
Error("if no generators are given the dimension must be given explicitly");
else
dim:=arg[2];
l:=[ ImmutableMatrix(f, IdentityMat(dim,f) ) ];
m.smashMeataxe:=rec(isZeroGens:=true);
fi;
m.dimension:=dim;
m.generators:=MakeImmutable(l);
m.IsOverFiniteField:= Size(f)<>infinity and IsFFECollCollColl(l);
return m;
end);
# variant of Value: if we evaluate the polynomial `f` at a matrix `x`, then it
# is usually beneficial to first factor `f` and evaluate at the factors
BindGlobal("SMTX_Value",function(f,x,one)
local fa;
fa:=Factors(f);
if Length(fa)>1 then
return Product(List(Collected(fa),y->Value(y[1],x,one)^y[2]),one);
else
return Value(f,x,one);
fi;
end);
#############################################################################
##
#F TrivialGModule( g, F ) . . . trivial G-module
##
## g is a finite group, F a field, trivial smash G-module computed.
InstallGlobalFunction(TrivialGModule,function(g, F)
local mats;
mats:=List(GeneratorsOfGroup(g),i->[[One(F)]]);
return GModuleByMats(mats,F);
end);
#############################################################################
##
#F InducedGModule( g, h, m ) . . . calculate an induced G-module
##
## h should be a subgroup of a finite group g, and m a smash
## GModule for h.
## The induced module for g is calculated.
InstallGlobalFunction(InducedGModule,function(g, h, m)
local gensh, mats, ghom, gdim, hdim, F, index, gen, genim,
gensim, r, i, j, k, l, elt, im;
if IsGroup(g) = false then
return Error("First argument is not a group.");
fi;
if SMTX.IsMTXModule(m) = false then
return Error("Second argument is not a meataxe module.");
fi;
gensh:=GeneratorsOfGroup(h);
mats:=SMTX.Generators(m);
if Length(gensh) <> Length(mats) then
Error("m does not have same number of generators as h = G1");
fi;
hdim:=SMTX.Dimension(m);
F:=SMTX.Field(m);
if Characteristic(F)=0 then
ghom:=GroupHomomorphismByImagesNC(h,Group(mats),gensh,mats);
else
ghom:=GroupHomomorphismByImages(h,GL(hdim,F),gensh,mats);
fi;
# set up transveral
r:=RightTransversal(g, h);
index:=Length(r);
gdim:=index*hdim;
# Now calculate images of generators.
gensim:=[];
for gen in GeneratorsOfGroup(g) do
genim:=NullMat(gdim, gdim, F);
for i in [1..index] do
j:=PositionCanonical(r, r[i]*gen);
elt:=r[i]*gen/r[j];
im:=Image(ghom, elt);
# Now insert hdim x hdim matrix im in the correct place in the genim.
for k in [1..hdim] do
for l in [1..hdim] do
genim[ (i-1)*hdim+k][ (j-1)*hdim+l]:=im[k][l];
od;
od;
od;
Add(gensim, genim);
od;
return GModuleByMats(gensim, F);
end);
#############################################################################
##
#F NaturalGModule ( g[, F] )
##
## g is a matrix group, F a field.
## The corresponding natural module is output.
InstallGlobalFunction(NaturalGModule,function(group, field...)
if not IsMatrixGroup(group) then
Error("<group> must be a matrix group");
fi;
if Length(field) = 0 then
field := DefaultFieldOfMatrixGroup(group);
elif Length(field) = 1 then
field := field[1];
else
Error("too many arguments");
fi;
return GModuleByMats(GeneratorsOfGroup(group), DimensionOfMatrixGroup(group), field);
end);
#############################################################################
##
#F PermutationGModule( g, F) . permutation module
##
## g is a permutation group, F a field.
## The corresponding permutation module is output.
InstallGlobalFunction(PermutationGModule,function(g, F)
local gens, deg;
gens:=GeneratorsOfGroup(g);
deg:=LargestMovedPoint(gens);
return GModuleByMats(List(gens,g->PermutationMat(g,deg,F)),F);
end);
###############################################################################
##
#F TensorProductGModule( m1, m2 ) . . tensor product of two G-modules
##
## TensorProductGModule calculates the tensor product of smash
## modules m1 and m2.
## They are assumed to be modules over the same algebra so, in particular,
## they should have the same number of generators.
##
InstallGlobalFunction(TensorProductGModule,function( m1, m2)
local mat1, mat2, F1, F2, gens, i, l;
mat1:=SMTX.Generators(m1); mat2:=SMTX.Generators(m2);
F1:=SMTX.Field(m1); F2:=SMTX.Field(m2);
if F1 <> F2 then
Error("GModules are defined over different fields.\n");
fi;
l:=Length(mat1);
if l <> Length(mat2) then
Error("GModules have different numbers of generators.");
fi;
gens:=[];
for i in [1..l] do
gens[i]:=KroneckerProduct(mat1[i], mat2[i]);
od;
return GModuleByMats(gens, F1);
end);
###############################################################################
##
#F WedgeGModule( module ) . . . . . wedge product of a G-module
##
## WedgeGModule calculates the wedge product of a G-module.
## That is the action on antisymmetrix tensors.
##
InstallGlobalFunction(WedgeGModule,function( module)
local mats, mat, newmat, row, F, gens, dim, nmats, i, j, k, m, n, x;
mats:=SMTX.Generators(module);
F:=SMTX.Field(module);
nmats:=Length(mats);
dim:=SMTX.Dimension(module);
gens:=[];
for i in [1..nmats] do
mat:=mats[i];
newmat:=[];
for j in [1..dim] do
for k in [1..j - 1] do
row:=[];
for m in [1..dim] do
for n in [1..m - 1] do
x:=mat[j,m] * mat[k,n] - mat[j,n] * mat[k,m];
Add(row, x);
od;
od;
Add(newmat, row);
od;
od;
Add(gens, newmat);
od;
return GModuleByMats(gens, F);
end);
SMTX.Setter:=function(string)
MakeImmutable(string);
return function(module,obj)
if not IsBound(module.smashMeataxe) then
module.smashMeataxe:=rec();
fi;
module.smashMeataxe.(string):=obj;
end;
end;
SMTX.IsMTXModule:=function(module)
return IsBound(module.isMTXModule) and
IsBound(module.field) and
IsBound(module.generators) and
IsBound(module.dimension);
end;
SMTX.IsZeroGens:=function(module)
return IsBound(module.smashMeataxe)
and IsBound(module.smashMeataxe.isZeroGens)
and module.smashMeataxe.isZeroGens=true;
end;
SMTX.Dimension:=function(module)
return module.dimension;
end;
SMTX.Field:=function(module)
return module.field;
end;
SMTX.Generators:=function(module)
if SMTX.IsZeroGens(module) then
return [];
else
return module.generators;
fi;
end;
SMTX.SetIsIrreducible:=function(module,b)
module.IsIrreducible:=b;
end;
SMTX.HasIsIrreducible:=function(module)
return IsBound(module.IsIrreducible);
end;
SMTX.IsAbsolutelyIrreducible:=function(module)
if not IsBound(module.IsAbsolutelyIrreducible) then
if not SMTX.IsIrreducible(module) then
return false;
fi;
module.IsAbsolutelyIrreducible:=SMTX.AbsoluteIrreducibilityTest(module);
fi;
return module.IsAbsolutelyIrreducible;
end;
SMTX.SetIsAbsolutelyIrreducible:=function(module,b)
module.IsAbsolutelyIrreducible:=b;
end;
SMTX.HasIsAbsolutelyIrreducible:=function(module)
return IsBound(module.IsAbsolutelyIrreducible);
end;
SMTX.SetSmashRecord:=SMTX.Setter("dummy");
SMTX.Subbasis:=SMTX.Getter("subbasis");
SMTX.SetSubbasis:=SMTX.Setter("subbasis");
SMTX.AlgEl:=SMTX.Getter("algebraElement");
SMTX.SetAlgEl:=SMTX.Setter("algebraElement");
SMTX.AlgElMat:=SMTX.Getter("algebraElementMatrix");
SMTX.SetAlgElMat:=SMTX.Setter("algebraElementMatrix");
SMTX.AlgElCharPol:=SMTX.Getter("characteristicPolynomial");
SMTX.SetAlgElCharPol:=SMTX.Setter("characteristicPolynomial");
SMTX.AlgElCharPolFac:=SMTX.Getter("charpolFactors");
SMTX.SetAlgElCharPolFac:=SMTX.Setter("charpolFactors");
SMTX.AlgElNullspaceVec:=SMTX.Getter("nullspaceVector");
SMTX.SetAlgElNullspaceVec:=SMTX.Setter("nullspaceVector");
SMTX.AlgElNullspaceDimension:=SMTX.Getter("ndimFlag");
SMTX.SetAlgElNullspaceDimension:=SMTX.Setter("ndimFlag");
SMTX.CentMat:=SMTX.Getter("centMat");
SMTX.SetCentMat:=SMTX.Setter("centMat");
SMTX.CentMatMinPoly:=SMTX.Getter("centMatMinPoly");
SMTX.SetCentMatMinPoly:=SMTX.Setter("centMatMinPoly");
SMTX.FGCentMat:=SMTX.Getter("fieldGenCentMat");
SMTX.SetFGCentMat:=SMTX.Setter("fieldGenCentMat");
SMTX.FGCentMatMinPoly:=SMTX.Getter("fieldGenCentMatMinPoly");
SMTX.SetFGCentMatMinPoly:=SMTX.Setter("fieldGenCentMatMinPoly");
SMTX.SetDegreeFieldExt:=SMTX.Setter("degreeFieldExt");
#############################################################################
##
#F SMTX.OrthogonalVector( subbasis ) single vector othogonal to a submodule,
## N.B. subbasis is assumed to consist of normed vectors,
## submodule is assumed proper.
##
SMTX.OrthogonalVector:=function( subbasis )
local zero, one, v, i, j, k, x, dim, len;
subbasis:=ShallowCopy(subbasis);
Sort(subbasis);
subbasis:=Reversed(subbasis);
# Now subbasis is in order so that the vector whose leading coefficient
# comes furthest to the left comes first.
len:=Length(subbasis);
dim:=Length(subbasis[1]);
i:= 1;
v:=[];
one:=One(subbasis[1][1]);
zero:=Zero(one);
for i in [1..dim] do
v[i]:=zero;
od;
i:=1;
while i <= len and subbasis[i][i] = one do
i:= i + 1;
od;
v[i]:=one;
for j in Reversed([1..i-1]) do
x:=zero;
for k in [j + 1..i] do
x:=x + v[k] * subbasis[j][k];
od;
v[j]:=-x;
od;
return v;
end;
BindGlobal( "SubGModLeadPos", function(sub,dim,subdim,zero)
local leadpos,i,j,k;
## As in SpinnedBasis, leadpos[i] gives the position of the first nonzero
## entry (which will always be 1) of sub[i].
leadpos:=[];
for i in [1..subdim] do
j:=1;
while j <= dim and sub[i][j]=zero do j:=j + 1; od;
leadpos[i]:=j;
for k in [1..i - 1] do
if leadpos[k] = j then
Error("Subbasis isn't normed.");
fi;
od;
od;
return leadpos;
end );
#############################################################################
##
#F SpinnedBasis( v, matrices, F, [ngens] ) . . . .
##
## The first argument v can either be a vector over the module on
## which matrices act or a subspace.
##
## SpinnedBasis computes a basis for the submodule defined by the action of the
## matrix group generated by the list matrices on v.
## F is the field over which we act.
## It is returned as a list of normed vectors.
## If the optional third argument is present, then only the first ngens
## matrices in the list are used.
SMTX.SpinnedBasis:=function( arg )
local v, matrices, ngens, zero,ldim,step,
ans, dim, subdim, leadpos, w, i, j, k, l, m,F;
if Length(arg) < 3 or Length(arg) > 4 then
Error("Usage: SpinnedBasis( v, matrices, F, [ngens] )");
fi;
v:=arg[1];
matrices:=arg[2];
F:=arg[3];
if Length(arg) = 4 then
ngens:=arg[4];
if ngens <= 0 or ngens > Length(matrices) then
ngens:=Length(matrices);
fi;
else
ngens:=Length(matrices);
fi;
ans:=[];
zero:=ZeroOfBaseDomain(matrices[1]);
if IsList(v) and Length(v)=0 then
return [];
elif IsMatrix(v) then
v:= TriangulizedMat(v);
ans:=Filtered(v,x->not IsZero(x));
elif IsList(v) and IsVectorObj(v[1]) then
v:=TriangulizedMat(Matrix(F,v));
ans:=Filtered(List(v),x->not IsZero(x));
else
# single vector (as vector or list)
ans:=[v];
fi;
#ans:=ShallowCopy(Basis(VectorSpace(F,v)));
ans:=Filtered(ans,x->not IsZero(x));
if Length(ans)=0 then return ans; fi;
ans:=List(ans, v -> ImmutableVector(F,v));
dim:=Length(ans[1]);
subdim:=Length(ans);
ldim:=subdim;
step:=10;
leadpos:=SubGModLeadPos(ans,dim,subdim,zero);
for i in [1..Length(ans)] do
w:=ans[i];
j:=w[PositionNonZero(w)];
if not IsOne(j) then
ans[i]:=j^-1*ans[i];
fi;
od;
i:=1;
while i <= subdim do
for l in [1..ngens] do
m:=matrices[l];
# apply generator m to submodule generator i
w:=ShallowCopy(ans[i] * m);
# try to express w in terms of existing submodule generators
j:=1;
for j in [1..subdim] do
k:=w[leadpos[j]];
if k <> zero then
#w:=w - k * ans[j];
AddRowVector(w,ans[j],-k);
fi;
od;
j:=1;
while j <= dim and w[j] = zero do j:=j + 1; od;
if j <= dim then
# we have found a new generator of the submodule
subdim:=subdim + 1;
leadpos[subdim]:=j;
#w:=(w[j]^-1) * w;
MultVector(w,w[j]^-1);
Add( ans, w );
if subdim = dim then
ans:=ImmutableMatrix(F,ans);
return ans;
fi;
if subdim-ldim>step then
Info(InfoMeatAxe,4,"subdimension ",subdim);
ldim:=subdim;
if ldim>10*step then step:=step*3;fi;
fi;
fi;
od;
i:=i + 1;
od;
Sort(ans);
ans:=Reversed(ans); # To bring it into semi-echelonised form.
ans:=ImmutableMatrix(F,ans);
return ans;
end;
SMTX.SubGModule:=function(module, subspace)
## The submodule of module generated by <subspace>.
return SMTX.SpinnedBasis(subspace, SMTX.Generators(module),
SMTX.Field(module));
end;
SMTX.SubmoduleGModule:=SMTX.SubGModule;
#############################################################################
##
#F SMTX.SubQuotActionsModule(matrices,sub,dim,subdim,field,typ) . . .
## generators of sub- and quotient-module and original module wrt new basis
##
## IT IS ASSUMED THAT THE GENERATORS OF SUB ARE NORMED.
##
## this function is used to compute all submodule/quotient stuff, as
## indicated by typ: 1=Sub, 2=Quotient, 4=Common
## The function returns a record with components 'smatrices', 'qmatrices',
## 'nmatrices' and 'nbasis' if applicable.
##
## See the description for 'SMTX.InducedAction' for
## description of the matrices
##
SMTX.SubQuotActions:=function(matrices,sub,dim,subdim,F,typ)
local s, c, q, leadpos, zero, zerov, smatrices, newg, im, newim, k, subi,
qmats, smats, nmats, sr, qr, g, h, erg, i, j;
s:=(typ mod 2)=1; # subspace indicator
typ:=QuoInt(typ,2);
q:=(typ mod 2)=1; # quotient indicator
c:=typ>1; # common indicator
zero:=Zero(F);
leadpos:=SubGModLeadPos(sub,dim,subdim,zero);
if subdim*2<dim and not (q or c) then
# the subspace dimension is small and we only want the subspace action:
# performing a base change is too expensive
zerov:=ListWithIdenticalEntries(subdim,zero);
ConvertToVectorRep(zerov,F);
smatrices:=[];
for g in matrices do
newg:=[];
for i in [1..subdim] do
im:=ShallowCopy(sub[i] * g);
newim:=ShallowCopy(zerov);
for j in [1..subdim] do
k:=im[leadpos[j]];
if k<> zero then
newim[j]:=k;
AddRowVector(im,sub[j],-k);
fi;
od;
# Check that the vector is now zero - if not, then sub was
# not the basis of a submodule
if im <> Zero(im) then return fail; fi;
Add(newg, newim);
od;
Add(smatrices,ImmutableMatrix(F,newg));
od;
return rec(smatrices:=smatrices);
else
# we want the quotient or all or the subspace dimension is big enough to
# merit a basechange
# first extend the basis
sub:=List(sub);
Append(sub,List(One(matrices[1])){Difference([1..dim],leadpos)});
sub:=ImmutableMatrix(F,sub);
subi:=sub^-1;
qmats:=[];
smats:=[];
nmats:=[];
sr:=[1..subdim];qr:=[subdim+1..dim];
for g in matrices do
g:=sub*g*subi;
if s then
h:=ExtractSubMatrix(g,sr,sr);
h:=ImmutableMatrix(F,h);
Add(smats,h);
fi;
if q then
h:=ExtractSubMatrix(g,qr,qr);
h:=ImmutableMatrix(F,h);
Add(qmats,h);
fi;
if c then Add(nmats,g);fi;
od;
erg:=rec();
if s then
erg.smatrices:=smats;
fi;
if q then
erg.qmatrices:=qmats;
fi;
if c then
erg.nmatrices:=nmats;
fi;
if q or c then
erg.nbasis:=sub;
fi;
return erg;
fi;
end;
#############################################################################
##
## SMTX.NormedBasisAndBaseChange(sub)
##
## returns a list [bas,change] where bas is a normed basis for <sub> and
## change is the base change from bas to sub (the basis vectors of bas
## expressed in coefficients for sub)
SMTX.NormedBasisAndBaseChange:=function(sub)
local l,m,d;
l:=Length(sub);
d:=Length(sub[1]);
m:= IdentityMat(d,One(sub[1][1]));
sub:=List([1..l],i->Concatenation(ShallowCopy(sub[i]),m[i]));
TriangulizeMat(sub);
m:=d+l;
return [sub{[1..l]}{[1..d]},sub{[1..l]}{[d+1..m]}];
end;
#############################################################################
##
#F SMTX.InducedActionSubmoduleNB( module, sub ) . . . . construct submodule
##
## module is a module record, and sub is a list of generators of a submodule.
## IT IS ASSUMED THAT THE GENERATORS OF SUB ARE NORMED.
## (i.e. each has leading coefficient 1 in a unique place).
## SMTX.InducedActionSubmoduleNB( module, sub ) computes the submodule of
## module for which sub is the basis.
## If sub does not generate a submodule then fail is returned.
SMTX.InducedActionSubmoduleNB:=function( module, sub )
local ans, dim, subdim, smodule,F;
subdim:=Length(sub);
if subdim = 0 then
return List(module.generators,i->[[]]);
fi;
dim:=SMTX.Dimension(module);
F:=SMTX.Field(module);
ans:=SMTX.SubQuotActions(module.generators,sub,dim,subdim,F,1);
if ans=fail then
return fail;
fi;
if SMTX.IsZeroGens(module) then
smodule:=GModuleByMats([],Length(ans.smatrices[1]),F);
else
smodule:=GModuleByMats(ans.smatrices,F);
fi;
return smodule;
end;
# Ditto, but allowing also unnormed modules
SMTX.InducedActionSubmodule:=function(module,sub)
local nb,ans,dim,subdim,smodule,F;
nb:=SMTX.NormedBasisAndBaseChange(sub);
sub:=nb[1];
nb:=nb[2];
subdim:=Length(sub);
if subdim = 0 then
return List(module.generators,i->[[]]);
fi;
dim:=SMTX.Dimension(module);
F:=SMTX.Field(module);
ans:=SMTX.SubQuotActions(module.generators,
sub,dim,subdim,F,1);
if ans=fail then
return fail;
fi;
# conjugate the matrices to correspond to given sub
if SMTX.IsZeroGens(module) then
smodule:=GModuleByMats([],Length(ans.smatrices[1]),F);
else
smodule:=GModuleByMats(List(ans.smatrices,i->i^nb),F);
fi;
return smodule;
end;
SMTX.ProperSubmoduleBasis:=function(module)
if SMTX.IsIrreducible(module) then
return fail;
fi;
return SMTX.Subbasis(module);
end;
#############################################################################
##
#F SMTX.InducedActionFactorModule( module, sub [,compl] )
##
## module is a module record, and sub is a list of generators of a submodule.
## (i.e. each has leading coefficient 1 in a unique place).
## Qmodule is returned, where qmodule
## is the quotient module.
##
SMTX.InducedActionFactorModule:=function(arg)
local module,sub, ans, dim, subdim, F,qmodule;
module:=arg[1];
sub:=arg[2];
sub:=TriangulizedMat(sub);
subdim:=Length(sub);
dim:=SMTX.Dimension(module);
if subdim = dim then
return List(module.generators,i->[[]]);
fi;
F:=SMTX.Field(module);
ans:=SMTX.SubQuotActions(module.generators,
sub,dim,subdim,F,2);
if ans=fail then
return fail;
fi;
if Length(arg)=3 then
# compute basechange
sub:=Concatenation(sub,arg[3]);
sub:=sub*Inverse(ans.nbasis);
ans.qmatrices:=List(ans.qmatrices,i->i^sub);
fi;
if SMTX.IsZeroGens(module) then
qmodule:=GModuleByMats([],Length(ans.qmatrices[1]),F);
else
qmodule:=GModuleByMats(ans.qmatrices, F);
fi;
return qmodule;
end;
#############################################################################
##
#F SMTX.InducedActionFactorModuleWithBasis( module, sub )
##
# FIXME: this function is never used and documented. Keep it or remove it?
SMTX.InducedActionFactorModuleWithBasis:=function(module,sub)
local ans, dim, subdim, F,qmodule;
sub:=TriangulizedMat(sub);
subdim:=Length(sub);
dim:=SMTX.Dimension(module);
if subdim = dim then
return List(module.generators,i->[[]]);
fi;
F:=SMTX.Field(module);
ans:=SMTX.SubQuotActions(module.generators,
sub,dim,subdim,F,2);
if ans=fail then
return fail;
fi;
# fetch new basis
sub:=ans.nbasis{[Length(sub)+1..module.dimension]};
if SMTX.IsZeroGens(module) then
qmodule:=GModuleByMats([],Length(ans.qmatrices[1]),F);
else
qmodule:=GModuleByMats(ans.qmatrices, F);
fi;
return [qmodule,sub];
end;
#############################################################################
##
#F SMTX.InducedAction( module, sub, typ )
## generators of sub- and quotient-module and original module wrt new basis
## and new basis
##
## module is a module record, and sub is a list of generators of a submodule.
## IT IS ASSUMED THAT THE GENERATORS OF SUB ARE NORMED.
## (i.e. each has leading coefficient 1 in a unique place).
## SMTX.InducedAction computes the submodule and quotient
## and the original module with its matrices written wrt to the basis used
## to compute smodule and qmodule.
## [smodule, qmodule, nmodule] is returned,
## where smodule is the submodule and qmodule the quotient module.
## The matrices of nmodule have the form A 0 where A and B are the
## C B
## corresponding matrices of smodule and qmodule resepctively.
## If sub is not the basis of a submodule then fail is returned.
SMTX.InducedAction:=function( arg )
local module,sub,typ,ans,dim,subdim,F,erg;
module:=arg[1];
sub:=arg[2];
if Length(arg)>2 then
typ:=arg[3];
else
typ:=7;
fi;
subdim:=Length(sub);
dim:=SMTX.Dimension(module);
F:=SMTX.Field(module);
erg:=SMTX.SubQuotActions(module.generators,
sub,dim,subdim,F,typ);
if erg=fail then
return fail;
fi;
ans:=[];
if IsBound(erg.smatrices) then
if SMTX.IsZeroGens(module) then
Add(ans,GModuleByMats([],Length(erg.smatrices[1]), F));
else
Add(ans,GModuleByMats(erg.smatrices, F));
fi;
fi;
if IsBound(erg.qmatrices) then
if SMTX.IsZeroGens(module) then
Add(ans,GModuleByMats([],Length(erg.qmatrices[1]), F));
else
Add(ans,GModuleByMats(erg.qmatrices, F));
fi;
fi;
if IsBound(erg.nmatrices) then
if SMTX.IsZeroGens(module) then
Add(ans,GModuleByMats([],Length(erg.nmatrices[1]), F));
else
Add(ans,GModuleByMats(erg.nmatrices, F));
fi;
fi;
if IsBound(erg.nbasis) then
Add(ans,erg.nbasis);
fi;
return ans;
end;
#############################################################################
##
#F SMTX.InducedActionSubMatrixNB( mat, sub ) . . . . construct submodule
##
## as InducedActionSubmoduleNB but for a matrix.
# FIXME: this function is never used and documented. Keep it or remove it?
SMTX.InducedActionSubMatrixNB:=function( mat, sub )
local subdim, dim, F, ans;
subdim:=Length(sub);
if subdim = 0 then
return [];
fi;
dim:=Length(mat);
F:=DefaultFieldOfMatrix(mat);
ans:=SMTX.SubQuotActions([mat],sub,dim,subdim,F,1);
if ans=fail then
return fail;
else
return ans.smatrices[1];
fi;
end;
# Ditto, but allowing also unnormed modules
# FIXME: this function is never used and documented. Keep it or remove it?
SMTX.InducedActionSubMatrix:=function(mat,sub)
local nb, subdim, dim, F, ans;
nb:=SMTX.NormedBasisAndBaseChange(sub);
sub:=nb[1];
nb:=nb[2];
subdim:=Length(sub);
if subdim = 0 then
return [];
fi;
dim:=Length(mat);
F:=DefaultFieldOfMatrix(mat);
ans:=SMTX.SubQuotActions([mat],sub,dim,subdim,F,1);
if ans=fail then
return fail;
else
# conjugate the matrices to correspond to given sub
return ans.smatrices[1]^nb;
fi;
end;
#############################################################################
##
#F SMTX.InducedActionFactorMatrix( mat, sub [,compl] )
##
## as InducedActionFactor, but for a matrix.
##
SMTX.InducedActionFactorMatrix:=function(arg)
local mat, sub, subdim, dim, F, ans;
mat:=arg[1];
sub:=arg[2];
sub:=TriangulizedMat(sub);
subdim:=Length(sub);
dim:=Length(mat);
if subdim = dim then
return [];
fi;
F:=DefaultFieldOfMatrix(mat);
ans:=SMTX.SubQuotActions([mat],sub,dim,subdim,F,2);
if ans=fail then
return fail;
fi;
if Length(arg)=3 then
# compute basechange
sub:=Concatenation(sub,arg[3]);
sub:=sub*Inverse(ans.nbasis);
ans.qmatrices:=List(ans.qmatrices,i->i^sub);
fi;
return ans.qmatrices[1];
end;
SMTX.SMCoRaEl:=function(matrices,ngens,newgenlist,dim,F)
local g1,g2,coefflist,M,pol;
g1:=Random(1, ngens);
g2:=g1;
while g2=g1 and ngens>1 do
g2:=Random(1, ngens);
od;
ngens:=ngens + 1;
matrices[ngens]:=matrices[g1] * matrices[g2];
Add(newgenlist, [g1, g2]);
# Take a random linear sum of the existing generators as new generator.
# Record the sum in coefflist
coefflist:=[Random(F)];
M:=coefflist[1]*matrices[1];
for g1 in [2..ngens] do
g2:=Random(F);
if IsOne(g2) then
M:=M + matrices[g1];
elif not IsZero(g2) then
M:=M + g2 * matrices[g1];
fi;
Add(coefflist, g2);
od;
Info(InfoMeatAxe,3,"Evaluated random element in algebra.");
pol:=CharacteristicPolynomialMatrixNC(F,M,1);
return [M,coefflist,pol];
end;
# how many random elements should we try before (temporarily ) giving up?
# This number is set relatively high to minimize the chance of an unlucky
# random run in functions such as composition series computation.
SMTX.RAND_ELM_LIMIT:=5000;
#############################################################################
##
#F SMTX.IrreduciblityTest( module ) try to reduce a module over a finite
## field
##
## 27/12/2000.
## New version incorporating Ivanyos/Lux method of handling one difficult case
## for proving reducibility.
## (See G.Ivanyos and K. Lux, `Treating the exceptional cases of the meataxe',
## Experimental Mathematics 9, 2000, 373-381.
##
## module is a module record
## IsIrreducible( ) attempts to decide whether module is irreducible.
## When it succeeds it returns true or false.
## We choose at random elements of the group algebra of the group.
## If el is such an element, we define M, p, fac, N, e and v as follows:-
## M is the matrix corresponding to el, p is its characteristic polynomial,
## fac an irreducible factor of p, N the nullspace of the matrix fac(M),
## ndim the dimension of N, and v a vector in N.
## If we can find the above such that ndim = deg(fac) then we can test
## conclusively for irreducibility. Then, in the case where irreducibility is
## proved, we store the information as fields for the module, since it may be
## useful later (e.g. to test for absolute irreducibility, equivalence with
## another module).