-
Notifications
You must be signed in to change notification settings - Fork 0
/
ParAxlAlg_reduce.m
executable file
·1205 lines (982 loc) · 45.7 KB
/
ParAxlAlg_reduce.m
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
/*
Axial algebra enumerator
These are functions to reduce the algebra
*/
/*
This function implements an automatic version of the algorithm:
1) ExpandSpace
2) i) ExpandOdd
ii) ExpandEven
Check to see if Dim(V) = Dim(W) and if not goto (1) and repeat.
There is a dimension limit where if W exceeds this then it won't be expanded further the procedure exits
*/
intrinsic AxialReduce(A::ParAxlAlg: dimension_limit := 150, backtrack := false, stabiliser_action := false, reduction_limit:= func<A | Maximum(Floor(Dimension(A)/4), 50)>) -> ParAxlAlg, BoolElt
{
Performs ExpandEven and ExpandSpace repeatedly until either we have completed, or the dimension limit has been reached.
}
if Dimension(A) eq 0 then
return A;
end if;
while Dimension(A) ne Dimension(A`V) and Dimension(A) le dimension_limit do
// First we expand
AA, phi := ExpandSpace(A: implement:= false, stabiliser_action := stabiliser_action);
// If we are backtracking and there is some intersection then form a new A and continue
if backtrack and Dimension(sub<AA`W | AA`rels> meet AA`V) ne 0 then
vprint ParAxlAlg, 4: "Backtracking...";
U := sub<AA`W | AA`rels>;
pullback := Matrix([ (AA`V).i@@phi : i in [1..Dimension(AA`V)]]);
Coeffs := [ Coordinates(AA`V, v) : v in Basis(U meet AA`V)];
Upullback := sub<A`W | FastMatrix(Coeffs, pullback)>;
Upullback := SaturateSubspace(A, Upullback);
A := ReduceSaturated(A, Upullback);
continue;
end if;
// We have no more intersection found
if Dimension(AA) ne 0 then
AA, psi := ImplementRelations(AA);
phi := phi*psi;
end if;
if Dimension(AA) eq 0 then
A := AA;
break;
end if;
// Now we reduce the even part
AA := ExpandEven(AA: reduction_limit:=reduction_limit(AA), backtrack := backtrack);
// If we are backtracking and there is some intersection then form a new A and continue
if backtrack and Dimension(sub<AA`W|AA`rels> meet AA`V) ne 0 then
vprint ParAxlAlg, 4: "Backtracking...";
U := sub<AA`W | AA`rels>;
pullback := Matrix([ (AA`V).i@@phi : i in [1..Dimension(AA`V)]]);
Coeffs := [ Coordinates(AA`V, v) : v in Basis(U meet AA`V)];
Upullback := sub<A`W | FastMatrix(Coeffs, pullback)>;
Upullback := SaturateSubspace(A, Upullback);
A := ReduceSaturated(A, Upullback);
continue;
end if;
// There is nothing to backtrack to
if Dimension(AA) ne 0 and #AA`rels ne 0 then
A := ImplementRelations(AA);
else
A := AA;
end if;
end while;
if Dimension(A) eq Dimension(A`V) then
vprint ParAxlAlg, 1: "Reduction complete!";
return A, true;
else
vprintf ParAxlAlg, 1: "Reduction failed. Dimension of A is %o, dimension of V is %o.\n", Dimension(A), Dimension(A`V);
return A, false;
end if;
end intrinsic;
/*
We provide a function to do all shapes for a given group
*/
intrinsic ShapeReduce(G::Grp: saves:=true, starting_position := 1, fusion_table := MonsterFusionTable(), field := Rationals(), subgroups := "maximal", partial := false, shape_stabiliser := true, dimension_limit := 150, backtrack := false, stabiliser_action := false, reduction_limit:= func<A | Maximum(Floor(Dimension(A)/4), 50)>) -> SeqEnum
{
Given a group G, find all the shapes, build the partial algebras and reduce.
}
shapes := Shapes(G);
require starting_position le #shapes: "Starting position is greater than the number of shapes.";
vprintf ParAxlAlg, 1: "Found %o shapes for the group.\n", #shapes;
output := [];
for i in [starting_position..#shapes] do
vprintf ParAxlAlg, 1: "Beginning shape %o of %o.\n", i, #shapes;
vprintf ParAxlAlg, 1: "Partial algebra has %o axes of shape %o.\n", #shapes[i,1], shapes[i,3];
A := PartialAxialAlgebra(shapes[i]: fusion_table:=fusion_table, field:=field, subgroups:=subgroups, partial:=partial, shape_stabiliser:=shape_stabiliser);
t := Cputime();
A := AxialReduce(A: dimension_limit:=dimension_limit, backtrack:=backtrack, stabiliser_action:=stabiliser_action, reduction_limit:=reduction_limit);
Append(~output, A);
vprintf ParAxlAlg, 4: "\nTime taken for complete reduction %o.\n\n", Cputime(t);
if saves then
SavePartialAxialAlgebra(A);
end if;
end for;
return output;
end intrinsic;
//
// =============== REDUCING AN ALGEBRA ===================
//
/*
U is a subspace which we want to mod out by. Therefore we may also mod out by v*u for any u in U and v in V. We grow the subspace U by doing this.
*/
intrinsic SaturateSubspace(A::ParAxlAlg, U::ModTupRng: starting := sub<A`W|>) -> ModTupRng
{
Add products of U \cap V with V to U until it saturates, also using the action of G. Has an optional argument of a starting subspace which we assume to be saturated.
}
t := Cputime();
// The expensive part is doing coercion from a G-submod to Wmod in order to coerce into W
// We minimise the amount of coercion by working in the G-submods as much as possible and only coercing all the vectors in U - U\cap V at the very end.
W := A`W;
require U subset W: "The given U is not a subspace of W.";
Wmod := A`Wmod;
V := A`V;
Vmod := sub<Wmod | [ v : v in Basis(V)]>;
Umod := sub<Wmod| Basis(U)>;
Dmod_old := sub<Wmod| Basis(starting meet V)>;
Dmod_new := Umod meet Vmod;
if Dimension(Umod) eq Dimension(U) then
// U was already given as a G_Invariant space.
bas := Basis(U);
Uorig := Umod;
end if;
while Dimension(Dmod_new) gt Dimension(Dmod_old) do
vprintf ParAxlAlg, 1: "Saturate subspace: Dimension intersection with V is %o\n", Dimension(Dmod_new);
tt := Cputime();
// We only do products of V with the new vectors found in D
bas_new := ExtendBasis(Dmod_old, Dmod_new)[Dimension(Dmod_old)+1..Dimension(Dmod_new)];
bas_new := [ W | W!Vector(Wmod!u) : u in bas_new];
S := IndexedSet(&cat BulkMultiply(A, bas_new, Basis(V)));
ttt := Cputime();
Q, phi := quo<Wmod | Umod>;
phimat := Matrix(phi);
SQ := FastMatrix(S, phimat);
UU := sub<Q | SQ>;
Umod := UU@@phi;
vprintf ParAxlAlg, 4: " Time taken for new quotient method %o\n", Cputime(ttt);
Dmod_old := Dmod_new;
Dmod_new := Umod meet Vmod;
vprintf ParAxlAlg, 4: " Time taken %o\n", Cputime(tt);
end while;
// Check whether we started with a saturated U and hence can coerce back quicker.
if assigned Uorig then
extras := ExtendBasis(Uorig, Umod)[Dimension(Uorig)+1..Dimension(Umod)];
extras := [ W | Wmod!u : u in extras];
U := sub<W | bas cat extras>;
vprintf ParAxlAlg, 4: "Time taken for saturate subspace %o\n", Cputime(t);
return U;
end if;
U := sub<W | [W | W!(Wmod!u) : u in Basis(Umod)]>;
vprintf ParAxlAlg, 4: "Time taken for saturate subspace %o\n", Cputime(t);
return U;
end intrinsic;
intrinsic ReduceSaturated(A::ParAxlAlg, U::ModTupFld) -> ParAxlAlg, Map
{
Construct the algebra G-module W/U for a saturated U.
}
t := Cputime();
W := A`W;
Wmod := A`Wmod;
V := A`V;
Anew := New(ParAxlAlg);
Anew`GSet := A`GSet;
Anew`tau := A`tau;
Anew`shape := A`shape;
Anew`number_of_axes := A`number_of_axes;
Anew`fusion_table := A`fusion_table;
Anew`group := A`group;
Anew`Miyamoto_group := A`Miyamoto_group;
if Dimension(U) eq Dimension(A) then
Wnew, psi := quo<W | W>;
Anew`W := Wnew;
Anew`Wmod := quo<Wmod | Wmod >;
Anew`V := V @ psi;
Anew`GSet_to_axes := map<Anew`GSet -> Wnew | [<i, Wnew!0> : i in Anew`GSet]>;
vprintf ParAxlAlg, 4: "Time taken for ReduceSaturated %o\n", Cputime(t);
return Anew, psi;
end if;
// We must check whether the we are quotienting out anything in the subalgebras
// If so, then we form the subalgebra quotients, pull back any relations and add them to U
if assigned A`subalgs then
tt := Cputime();
// We create new algebras and maps as we might have to change the algebras to quotients.
newalgs := A`subalgs`algs;
newmaps := A`subalgs`maps;
subalgs_intersections := { i : i in [1..#newmaps] | not (A`subalgs`subsps[i] meet U) subset Kernel(newmaps[i,1])};
extras := sub<W|>;
while subalgs_intersections ne {} do
for i in subalgs_intersections do
subsp := A`subalgs`subsps[i];
map, homg, pos := Explode(newmaps[i]);
alg := newalgs[pos];
U_alg := (U meet subsp)@map;
U_alg := SaturateSubspace(alg, U_alg);
vprint ParAxlAlg, 3: "Reducing the subalgebra.";
alg_new, quo_alg := ReduceSaturated(alg, U_alg);
if Dimension(alg_new) eq 0 then
// We have killed the entire subalgebra and hence modded out A by some axes.
Wnew, psi := quo<W | W>;
Anew`W := Wnew;
Anew`Wmod := quo<Wmod | Wmod >;
Anew`V := V @ psi;
Anew`GSet_to_axes := map<Anew`GSet -> Wnew | [<i, Wnew!0> : i in Anew`GSet]>;
vprintf ParAxlAlg, 4: "Time taken for ReduceSaturated %o\n", Cputime(t);
return Anew, psi;
else
// There is a non-trivial quotient of the subalgebra
// First check to see if the old alg is not used in another map
if #[ t[3] : t in newmaps | t[3] eq pos] eq 1 then
if alg_new notin newalgs then
newalgs := newalgs[1..pos-1] join {@ alg_new @} join newalgs[pos+1..#newalgs];
// all the numberings for pos are fine
else
newalgs := newalgs[1..pos-1] join newalgs[pos+1..#newalgs];
// need to update all the other numberings for pos
for j in { j : j in [1..#newmaps] | newmaps[j,3] gt pos} do
newmaps[j,3] -:= 1;
end for;
pos := Position(newalgs, alg_new);
end if;
else
// The old alg is still used
Include(~newalgs, alg_new);
pos := Position(newalgs, alg_new);
end if;
newmaps[i] := < map*quo_alg, homg, pos>;
// We pull back any new relations from the subalgebra
extras +:= Kernel(quo_alg) @@ map;
end if;
end for;
if Dimension(extras) gt 0 then
U := SaturateSubspace(A, U+extras: starting := U);
end if;
subalgs_intersections := { i : i in [1..#newmaps] | not (A`subalgs`subsps[i] meet U) subset Kernel(newmaps[i,1])};
end while;
vprintf ParAxlAlg, 4: "Time taken for collecting info from subalgebras %o\n", Cputime(tt);
end if;
// We have grown U as much as possible, so now we form the quotient
tt := Cputime();
Anew`Wmod, psi_mod := quo<Wmod | [Wmod | Wmod! u : u in Basis(U)] >;
Wnew := VectorSpace(Anew`Wmod);
psi_mat := Matrix(psi_mod);
psi := hom< W -> Wnew | psi_mat >;
Anew`W := Wnew;
Anew`V := V @ psi;
if Dimension(Wnew) eq 0 then
Anew`GSet_to_axes := map<Anew`GSet -> Wnew | i :-> Wnew!0>;
Anew`rels := {@ W | @};
vprintf ParAxlAlg, 4: "Time taken for ReduceSaturated %o\n", Cputime(t);
return Anew, psi;
end if;
images := FastMatrix(Image(A`GSet_to_axes), psi_mat);
Anew`GSet_to_axes := map<Anew`GSet -> Wnew | [ <i, images[i]> : i in Anew`GSet]>;
vprintf ParAxlAlg, 4: "Time taken to build modules and vector spaces %o.\n", Cputime(tt);
vprintf ParAxlAlg, 4: "Module dimension is %o.\n", Dimension(Anew`W);
tt := Cputime();
UpdateAxes(A, ~Anew, psi: matrix := psi_mat);
vprintf ParAxlAlg, 4: "Time taken to update axes %o\n", Cputime(tt);
tt := Cputime();
if assigned newalgs then
UpdateSubalgebras(A, ~Anew, psi: algs := newalgs, maps:=newmaps);
else
UpdateSubalgebras(A, ~Anew, psi);
end if;
vprintf ParAxlAlg, 4: "Time taken to update subalgebras %o\n", Cputime(tt);
// We calculate the restriction of psi to V so we ensure that the preimage of Vnew lies in V
tt := Cputime();
psi_rest := hom<V->Wnew | [ v@psi : v in Basis(V)]>;
vprint ParAxlAlg, 2: " Calculating the new multiplication table.";
V_new_pullback := [ W | u@@ psi_rest : u in Basis(Anew`V) ];
decompV := [Coordinates(V, v) : v in V_new_pullback];
prods := FastMatrix(BulkMultiply(A, decompV), psi_mat);
Anew`mult := [ [ Wnew | ] : i in [1..Dimension(Anew`V)]];
for i in [1..Dimension(Anew`V)], j in [1..i] do
Anew`mult[i,j] := prods[i*(i-1) div 2 +j];
Anew`mult[j,i] := Anew`mult[i,j];
end for;
vprintf ParAxlAlg, 4: " Time taken %o\n", Cputime(tt);
vprint ParAxlAlg, 2: " Mapping the remaining relations into the new W.";
tt := Cputime();
Anew`rels := {@ v : v in FastMatrix(A`rels, psi_mat) | v ne Wnew!0 @};
vprintf ParAxlAlg, 4: " Time taken %o\n", Cputime(tt);
vprintf ParAxlAlg, 4: "Time taken for ReduceSaturated %o\n", Cputime(t);
return Anew, psi;
end intrinsic;
/*
We use the following to impose the relations on the algebra that we have built up to reduce it.
*/
intrinsic ImplementRelations(A::ParAxlAlg: max_number:=#A`rels) -> ParAxlAlg, Map
{
Implement the relations we have built up.
}
t:=Cputime();
Anew := A;
phi := hom<A`W -> A`W | Morphism(A`W, A`W)>;
while assigned Anew`rels and #Anew`rels ne 0 do
vprintf ParAxlAlg, 1: "Dim(A) is %o, Dim(V) is %o, number of relations is %o.\n", Dimension(Anew), Dimension(Anew`V), #Anew`rels;
U := SaturateSubspace(Anew, sub<Anew`W| Anew`rels[1..Minimum(max_number, #Anew`rels)]>);
Anew, phi_new := ReduceSaturated(Anew, U);
phi := phi*phi_new;
end while;
vprintf ParAxlAlg, 1: "Dim(A) is %o, Dim(V) is %o.\n", Dimension(Anew), Dimension(Anew`V);
vprintf ParAxlAlg, 4: "Time taken for ImplementRelations %o\n", Cputime(t);
return Anew, phi;
end intrinsic;
//
// ================ EXPANDING AN ALGEBRA ====================
//
/*
Implements an inner product for G-modules.
*/
intrinsic GetInnerProduct(W:ModGrp) -> AlgMatElt
{
Finds an inner product which is compatible with the G-module structure.
}
G := Group(W);
phi := GModuleAction(W);
return &+[ Matrix(g*Transpose(g)) where g := h@phi : h in G];
end intrinsic;
/*
Finds complements in G-modules.
*/
intrinsic Complement(W::ModGrp, U::ModGrp: ip:=GetInnerProduct(W)) -> ModGrp
{
Finds the complement of U inside W. Takes an optional argument of a Matrix which is the Gram matrix of an inner product. This defaults to calculating a G-invariant inner product using GetInnerProduct(W).
}
require U subset W: "U is not a submodule of W";
U_bas := [(W!v) : v in Basis(U)];
if #U_bas eq 0 then
return W;
else
return sub<W | [W!v : v in Basis(NullSpace(Transpose(Matrix(U_bas)*ip)))]>;
end if;
end intrinsic;
/*
Decomposes with respect to an inner product correctly! magma only does the standard inner product...
*/
intrinsic DecomposeVectorWithInnerProduct(U::., v::.: ip := GetInnerProduct(Parent(v)), Minv := (Matrix(Basis(U))*ip*Transpose(Matrix(Basis(U))))^-1) -> ., .
{
Return the unique u in U and w in the complement of U such that v = u + w. Defaults to calculating a G-invariant inner product using GetInnerProduct(W).
}
require Type(U) in {ModTupFld, ModGrp}: "The space given is not a module or a vector space.";
W := Parent(v);
require U subset W: "U is not a submodule of W";
if Dimension(U) eq 0 then
return W!0, v;
end if;
U_bas := [(W!u) : u in Basis(U)];
vU := v*ip*Transpose(Matrix(U_bas))*Minv*Matrix(U_bas);
return vU, v-vU;
end intrinsic;
intrinsic DecomposeVectorsWithInnerProduct(U::., L::.: ip := GetInnerProduct(Parent(L[1]))) -> SeqEnum
{
For a SetIndx L of vectors v, return a set of tuples <vU, vC> where v = vU + vC is the decomposition into V = U + U^\perp, with respect to an arbitrary inner product.
}
require Type(L) in {SeqEnum, SetIndx, List}: "The collection given is not ordered.";
require Type(U) in {ModTupFld, ModGrp}: "The space given is not a module or a vector space.";
W := Universe(L);
require U subset W: "U is not a submodule of W";
if Dimension(U) eq 0 then
return [ < W!0, v> : v in L];
end if;
U_bas := [(W!v) : v in Basis(U)];
M := ip*Transpose(Matrix(U_bas))*(Matrix(U_bas)*ip*Transpose(Matrix(U_bas)))^-1*Matrix(U_bas);
prods := FastMatrix([ l : l in L], M);
return [ <prods[i], L[i]-prods[i]> : i in [1..#L]];
end intrinsic;
intrinsic InduceGAction(G::GrpPerm, H::GrpPerm, actionhom::Map, L::.) -> SeqEnum
{
Let L be the basis of a subspace which is H-invariant. Return the G-invariant subspace spanned by L, where the action is given by actionhom.
}
t := Cputime();
require Type(L) in {SeqEnum, SetIndx}: "The collections of elements must be a set or sequence.";
if #L eq 0 then
return L;
end if;
// We use matrices as they are faster
if Type(L) eq SeqEnum then
matrices := [Matrix(L)];
else
matrices := [Matrix(Setseq(L))];
end if;
for h in Transversal(G, H) diff {@ Id(G)@} do
Append(~matrices, matrices[1]*(h@actionhom));
end for;
if Type(L) eq SeqEnum then
vprintf ParAxlAlg, 4: "Induced G-action in time %o\n", Cputime(t);
return [Rows(M) : M in matrices];
else
vprintf ParAxlAlg, 4: "Induced G-action in time %o\n", Cputime(t);
return {@ IndexedSet(Rows(M)) : M in matrices @};
end if;
end intrinsic;
/*
We wish to expand the space W
We write W = V + C where C is complement. We then expand to W_new which is:
S^2(C) + VxC + W
We do the new module in this order this tends to make W be preserved in the quotient when magma quotients out by relations w = x, where x is not in W.
*/
ijpos := function(i,j,n)
if i le j then
return &+[ n+1 -k : k in [0..i-1]] -n +j-i;
else
return &+[ n+1 -k : k in [0..j-1]] -n +i-j;
end if;
end function;
intrinsic ExpandSpace(A::ParAxlAlg: implement := true, stabiliser_action := false) -> ParAxlAlg, Map
{
Let A = V \oplus C. This function expands A to S^2(C) \oplus (V \otimes C) \oplus A, with the new V being the old A. We then factor out by the known multiplications in old V and return the new partial axial algebra.
}
t := Cputime();
require Dimension(A`W) ne Dimension(A`V): "You have already found the multiplication table to build a full algebra - no need to expand!";
vprintf ParAxlAlg, 1: "Expanding algebra from %o dimensions.\n", Dimension(A);
tt := Cputime();
G := Group(A);
W := A`W;
Wmod := A`Wmod;
ip := GetInnerProduct(Wmod);
V := A`V;
// We build the modules and maps
Vmod := sub<Wmod | [Wmod | v : v in Basis(V)]>;
Cmod := Complement(Wmod, Vmod: ip:=ip);
VCmod := TensorProduct(Vmod, Cmod);
C2mod := SymmetricSquare(Cmod);
Wmodnew, injs := DirectSum([C2mod, VCmod, Wmod]);
// We build the corresponding vector spaces and maps
Wnew := RSpace(BaseRing(A), Dimension(Wmodnew));
C := RSpaceWithBasis([ W | Wmod!(Cmod.i) : i in [1..Dimension(Cmod)]]);
WtoWnew_mat := MapToMatrix(injs[3]);
WtoWnew := hom< W -> Wnew | WtoWnew_mat >;
Anew := New(ParAxlAlg);
Anew`GSet := A`GSet;
Anew`tau := A`tau;
Anew`shape := A`shape;
images := FastMatrix(Image(A`GSet_to_axes), WtoWnew_mat);
Anew`GSet_to_axes := map<Anew`GSet -> Wnew | [ <i, images[i]> : i in Anew`GSet]>;
Anew`number_of_axes := A`number_of_axes;
Anew`fusion_table := A`fusion_table;
Anew`rels := {@ Wnew | @};
Anew`group := A`group;
Anew`Miyamoto_group := A`Miyamoto_group;
Anew`Wmod := Wmodnew;
Anew`W := Wnew;
Anew`V := W@WtoWnew;
vprintf ParAxlAlg, 2: "Expanded to %o dimensions.\n", Dimension(Anew`W);
vprintf ParAxlAlg, 4: "Time taken to build modules and vector spaces %o.\n", Cputime(tt);
vprint ParAxlAlg, 2: " Building the multiplication.";
tt := Cputime();
// We precompute the decompositions
decomp := DecomposeVectorsWithInnerProduct(V, Basis(W): ip:=ip);
// We transform them into vectors in their natural spaces
decompV := [ Coordinates(V,t[1]) : t in decomp ];
decompC := [ Coordinates(C,t[2]) : t in decomp ];
dimV := Dimension(V);
dimC := Dimension(C);
// precompute all the products we require
prodsV := FastMatrix(BulkMultiply(A, decompV), WtoWnew_mat);
if dimV eq 0 or dimC eq 0 then
prodsVC := [ Wnew!0 : i in [1..(#decomp*(#decomp+1) div 2)]];
else
VC := RSpace(BaseRing(A), Dimension(VCmod));
VCmult := [ [VC.(dimC*(i-1)+j) : j in [1..dimC]]: i in [1..dimV]];
VCtoWnew_mat := MapToMatrix(injs[2]);
newVCmult := BulkMultiply(VCmult, decompV, decompC);
prodsVC := FastMatrix([ newVCmult[i,j] + newVCmult[j,i] : j in [1..i], i in [1..#decomp]], VCtoWnew_mat);
end if;
C2mult := [ [Wnew.ijpos(i,j,dimC) : j in [1..dimC]]: i in [1..dimC]];
prodsC2 := BulkMultiply(C2mult, decompC, decompC);
/*
// This is a little faster on 2nd expansion for PSL(2,11).
// Check speeds after fixing BulkMupltiply to do symmetric stuff.
C2 := RSpace(BaseRing(A), Dimension(C2mod));
C2mult2 := [ [C2.ijpos(i,j,dimC) : j in [1..dimC]]: i in [1..dimC]];
prodsC22 := BulkMultiply(C2mult2, decompC, decompC);
C2toWnew_mat := MapToMatrix(injs[1]);
prodsC22 := FastMatrix( Flat(prodsC22), C2toWnew_mat);
*/
Anew`mult := [[Wnew | ] : i in [1..Dimension(W)]];
for i in [1..Dimension(W)] do
for j in [1..i] do
Anew`mult[i][j] := prodsV[i*(i-1) div 2 +j] + prodsVC[i*(i-1) div 2+j] + prodsC2[i,j];
if j ne i then
Anew`mult[j][i] := Anew`mult[i][j];
end if;
end for;
end for;
vprintf ParAxlAlg, 4: " Time taken to build the multiplication table %o.\n", Cputime(tt);
// We now build the axes
vprint ParAxlAlg, 2: " Updating the axes.";
tt := Cputime();
UpdateAxes(A, ~Anew, WtoWnew: matrix:=WtoWnew_mat);
vprintf ParAxlAlg, 4: " Time taken for updating the axes %o.\n", Cputime(tt);
vprint ParAxlAlg, 2: " Updating the odd and even parts.";
tt := Cputime();
// We now build the odd and even parts and do w*h-w
max_size := Max([#S : S in Keys(A`axes[1]`even)]);
assert exists(evens){S : S in Keys(A`axes[1]`even) | #S eq max_size};
max_size := Max([#S : S in Keys(A`axes[1]`odd)]);
assert exists(odds){S : S in Keys(A`axes[1]`odd) | #S eq max_size};
for i in [1..#A`axes] do
// For each axes, the new even part comes from the old even x even plus the old odd x odd.
// Similarly for the new odd part
// To speed up the calculation we will try to calculate a set of vectors which span and are as linearly independent as possible before building a subspace from them.
// For the even case, we also want to remember which pairs we took to speed up the w*h-w trick
// Decompose even subspace E into V meet E, C meet E and the rest N
Ve := Basis(V meet A`axes[i]`even[evens]);
Ce := Basis(C meet A`axes[i]`even[evens]);
if Dimension(A`axes[i]`even[evens]) ne #Ve+#Ce then
Ne := ExtendBasis(Ve cat Ce, A`axes[i]`even[evens])[#Ve+#Ce+1..Dimension(A`axes[i]`even[evens])];
else
Ne := [];
end if;
// Decompose the odd similarly
Vo := Basis(V meet A`axes[i]`odd[odds]);
Co := Basis(C meet A`axes[i]`odd[odds]);
if Dimension(A`axes[i]`odd[odds]) ne #Vo+#Co then
No := ExtendBasis(Vo cat Co, A`axes[i]`odd[odds])[#Vo+#Co+1..Dimension(A`axes[i]`odd[odds])];
else
No := [];
end if;
bas := Ve cat Ne cat Ce cat Vo cat No cat Co;
nVe := 1;
nNe := #Ve+nVe;
nCe := #Ne+nNe;
nVo := #Ce+nCe;
nNo := #Vo+nVo;
nCo := #No+nNo;
// Find multiplication wrt the basis bas
basmult := BulkMultiply(Anew`mult, bas, bas);
// The even space is spanned by
// W_e@WtoWnew_mat + (VeCe + NeCe) + (VoCo + NoCo) + NeNe + NoNo + CeCe + CoCo
// Of these, the ones which must be linearly independent are anything without N
// W_e@WtoWnew_mat + VeCe + VoCo + CeCe + CoCo
even_pairs := [ <j,k> : k in [nCe..nVo-1], j in [nVe..nNe-1]]
cat [ <j,k> : k in [nCo..#bas], j in [nVo..nNo-1]]
cat [ <j,k> : k in [nCe..j], j in [nCe..nVo-1]]
cat [ <j,k> : k in [nCo..j], j in [nCo..#bas]];
even := FastMatrix(Basis(A`axes[i]`even[evens]), WtoWnew_mat)
cat [ basmult[t[1], t[2]] : t in even_pairs];
assert2 IsIndependent(even);
// These could have linear depedences with the above
// NeCe + NoCo + NeNe + NoNo
even_poss_pairs := [ <j,k> : k in [nCe..nVo-1], j in [nNe..nCe-1]]
cat [ <j,k> : k in [nCo..#bas], j in [nNo..nCo-1]]
cat [ <j,k> : k in [nNe..j], j in [nNe..nCe-1]]
cat [ <j,k> : k in [nNo..j], j in [nNo..nCo-1]];
even_poss := [ basmult[t[1], t[2]] : t in even_poss_pairs];
for j in [1..#even_poss_pairs] do
if IsIndependent(even cat [even_poss[j]]) then
Append(~even, even_poss[j]);
Append(~even_pairs, even_poss_pairs[j]);
end if;
end for;
Anew`axes[i]`even[evens] := sub<Wnew | even>;
// For odd, we do not need to keep track of the pairs which give the basis vectors, so we just build all in the same way as above
// W_o@WtoWnew_mat + (VeCo + NeCo) + (VoCe + NoCe) + (NeNo + NeCo + CeCo)
odd := FastMatrix(Basis(A`axes[i]`odd[odds]), WtoWnew_mat)
cat &cat[ basmult[i][nCo..#bas] : i in [nVe..nCe-1]]
cat &cat[ basmult[i][nCe..nVo-1] : i in [nVo..nCo-1]]
cat &cat[ basmult[i][nNe..nVo-1] : i in [nNo..#bas]];
Anew`axes[i]`odd[odds] := sub<Wnew | odd>;
if stabiliser_action then
vprint ParAxlAlg, 2: " Doing the w*h-w trick.";
// We do the w*h-w trick
H := A`axes[i]`stab;
Aactionhom := GModuleAction(A`Wmod);
// precompute the images of all the basis vectors in the basis of bas
Mbas := Matrix(bas);
Minv := Mbas^-1;
images := [ Mbas*h@Aactionhom*Minv : h in H | h ne H!1];
// All the vectors from W_even have already had the w*h-w trick imposed, so don't need to do these. We only need to do those given by even_pairs.
// If w^h = w^g for some h and g, we only need to take one. Also, since multipication is commutative, we may take any order on the pair which give w.
function CommonRows(t)
return Setseq({Sort([L[t[1]], L[t[2]]]) : L in images });
end function;
// We build all pairs and sort them so that they are in blocks with common 1st vector.
image_pairs := [ CommonRows(t) : t in even_pairs ];
lens := [#S : S in image_pairs];
image_pairs := &cat image_pairs;
Sort(~image_pairs, func<x,y| x[1] eq y[1] select 0 else x[1] lt y[1] select 1 else -1>, ~perm);
// We maintain the order on the w's
ws := &cat [ [ basmult[t[1],t[2]] where t := even_pairs[k] : j in [1..lens[k]]] : k in [1..#even_pairs]];
ws := [ws[i^perm] : i in [1..#ws]];
vprintf ParAxlAlg, 4: " There are %o pairs to process.\n", #ws;
if #ws lt 10000 then
// We just do the easy thing
whs := [ &+[ L[1,j]*L[2,k]*basmult[j, k] : j in Support(L[1]), k in Support(L[2]) ] : L in image_pairs];
else
// We take blocks of all the same first vector and use matrix multiplication
// This is slower for small numbers but quicker for more.
// Slower for 8000 pairs (S_6 dim 151), but quicker for 47000 pairs (S_6 dim 9797)
whs := [];
start := 1;
time while exists(last){j-1 : j in [start..#image_pairs] | image_pairs[start,1] ne image_pairs[j,1]} do
whs cat:= Flat(BulkMultiply(basmult, [image_pairs[start,1]],
[image_pairs[j,2] : j in [start..last]]));
start := last + 1;
end while;
whs cat:= Flat(BulkMultiply(basmult, [image_pairs[start,1]],
[image_pairs[j,2] : j in [start..#image_pairs]]));
end if;
Anew`axes[i]`even[evens diff {1}] +:= sub<Wnew | [ whs[j]-ws[j] : j in [1..#ws]]>;
end if;
end for;
vprintf ParAxlAlg, 4: " Time taken for the odd and even parts %o.\n", Cputime(tt);
// We update the subalgs
vprint ParAxlAlg, 2: " Updating the subalgebras.";
tt := Cputime();
subalgs := New(SubAlg);
subalgs`subsps := [* *];
subalgs`maps := [* *];
subalgs`algs := A`subalgs`algs;
for i in [1..#A`subalgs`subsps] do
subsp := A`subalgs`subsps[i];
map, homg, pos := Explode(A`subalgs`maps[i]);
alg := A`subalgs`algs[pos];
subspV := subsp meet V;
bas := ExtendBasis(subspV, subsp);
basV := bas[1..Dimension(subspV)];
basC := bas[Dimension(subspV)+1..Dimension(subsp)];
// We also calculate their images in Wnew
basnew := FastMatrix(bas, WtoWnew_mat);
basnewV := basnew[1..Dimension(subspV)];
basnewC := basnew[Dimension(subspV)+1..Dimension(subsp)];
vprint ParAxlAlg, 4: " Calculating products";
prodsVC := BulkMultiply(Anew, basnewV, basnewC);
prodsC2 := BulkMultiply(Anew, basnewC);
vprint ParAxlAlg, 4: " Updating subspaces and maps";
newsubsp := subsp@WtoWnew + sub< Wnew | &cat prodsVC cat prodsC2>;
newmap := hom<newsubsp -> alg`W | [<basnew[i], bas[i]@map> : i in [1..#bas]]
cat [ <prodsVC[k,l], (alg!basV[k]@map * alg!basC[l]@map)`elt>
: k in [1..#basV], l in [1..#basC]]
cat [ <prodsC2[l*(l-1) div 2 + k], (alg!basC[k]@map * alg!basC[l]@map)`elt>
: k in [1..l], l in [1..#basC]]>;
Append(~subalgs`subsps, newsubsp);
Append(~subalgs`maps, <newmap, homg, pos>);
end for;
Anew`subalgs := subalgs;
PullbackEigenvaluesAndRelations(A, ~Anew);
vprintf ParAxlAlg, 4: " Time taken for updating the subalgebras %o\n", Cputime(tt);
// We also collect some relations coming from the eigenvectors
vprint ParAxlAlg, 2: " Collecting any new eigenvalue relations.";
tt := Cputime();
Anew := ImposeEigenvalues(Anew: implement := false);
vprintf ParAxlAlg, 4: "Time taken %o.\n", Cputime(tt);
if implement then
vprintf ParAxlAlg, 4: "Total time taken for ExpandSpace (before ImplementRelations) %o\n", Cputime(t);
Anew, psi := ImplementRelations(Anew);
vprintf ParAxlAlg, 4: "Total time taken for ExpandSpace (including ImplementRelations) %o\n", Cputime(t);
return Anew, WtoWnew*psi;
else
vprintf ParAxlAlg, 4: "Total time taken for ExpandSpace %o\n", Cputime(t);
return Anew, WtoWnew;
end if;
end intrinsic;
//
// ============== FIND EIGENVALUES AND RELATIONS ==================
//
/*
This is an internal function to impose the eigenvalue condition.
NB add Timesable
*/
intrinsic ImposeEigenvalues(A::ParAxlAlg: implement:=true) -> ParAxlAlg
{
This imposes the relation u*a - lambda u, for all u in U, where U is the eigenspace associated to lambda and a is an axis.
}
W := A`W;
V := A`V;
Ggr, gr := Grading(A`fusion_table);
require Order(Ggr) in {1,2}: "The fusion table is not Z_2-graded.";
evens := {@ lambda : lambda in A`fusion_table`eigenvalues | lambda@gr eq Ggr!1 @};
odds := {@ lambda : lambda in A`fusion_table`eigenvalues | lambda@gr eq Ggr.1 @};
lambdas := evens join odds;
newrels := {@ W| @};
for i in [1..#A`axes] do
// It is cheaper to do all multiplications in one go and then sort out afterwards
eigsps := [ Basis(A`axes[i]`even[{@lambda@}] meet V) : lambda in evens]
cat [ Basis(A`axes[i]`odd[{@lambda@}] meet V) : lambda in odds];
dims := [#sp : sp in eigsps];
eigsps := &cat eigsps;
mults := BulkMultiply(A, [A`axes[i]`id`elt], eigsps)[1];
newrels join:= {@ W | w : s in [(&+dims[1..j-1]+1)..&+dims[1..j]], j in [1..#lambdas] |
not IsZero(w) where w := mults[s] - lambdas[j]*eigsps[s] @};
end for;
rels_sub := sub<A`W | A`rels>;
newrels_sub := sub<A`W | newrels>;
int := newrels_sub meet rels_sub;
bas := ExtendBasis(int, newrels_sub);
U := GInvariantSubspace(A`Wmod, A`W, bas[Dimension(int)+1..#bas]);
A`rels join:= {@ W| w : w in Basis(U)@};
if implement then
return ImplementRelations(A);
else
return A;
end if;
end intrinsic;
/*
intrinsic ImposeEigenvalue(A::ParAxlAlg, i::RngIntElt, lambda::.: implement:=true) -> ParAxlAlg
{
Let id be the ith idempotent in W and lambda an eigenvalue. This imposes the relation u*e - lambda u, for all u in U, where U is the eigenspace associated to lambda.
}
W := A`W;
V := A`V;
id := A`axes[i]`id;
if {@ lambda @} in Keys(A`axes[i]`odd) then
U := A`axes[i]`odd[{@ lambda @}];
elif {@ lambda @} in Keys(A`axes[i]`even) then
U := A`axes[i]`even[{@ lambda @}];
else
error "The given eigenvalue is not valid.";
end if;
newrels := {@ W| w : u in Basis(V meet U) | w ne W!0 where w := (id*A!u)`elt - lambda*u @};
rels_sub := sub<A`W | A`rels>;
newrels_sub := sub<A`W | newrels>;
int := newrels_sub meet rels_sub;
bas := ExtendBasis(int, newrels_sub);
U := GInvariantSubspace(A`Wmod, A`W, bas[Dimension(int)+1..#bas]);
A`rels join:= {@ W| w : w in Basis(U)@};
if implement then
return ImplementRelations(A);
else
return A;
end if;
end intrinsic;
*/
/*
This just finds the odd and even parts acording to the grading.
*/
intrinsic ForceGrading(A::ParAxlAlg) -> ParAxlAlg
{
Let inv be a Miyamoto involution corresponding to an idempotent e. The action of inv on W has two eigenspaces, positive and negative, which gives the grading of the action of the idempotent e. For each idempotent e, we find the grading and store these.
}
actionhom := GModuleAction(A`Wmod);
for i in [1..#A`axes] do
inv := A`axes[i]`inv;
inv_mat := inv @ actionhom;
A`axes[i]`odd[&join Keys(A`axes[i]`odd)] := Eigenspace(inv_mat, -1);
A`axes[i]`even[&join Keys(A`axes[i]`even)] := Eigenspace(inv_mat, 1);
end for;
return A;
end intrinsic;
/*
We expand the even part.
*/
// ======================================
//
// We list some internal functions which we will use to reduce the even part
//
// ======================================
intrinsic MultiplyDown(A::ParAxlAlg, keys::SeqEnum, i::RngIntElt: previous := AssociativeArray([* <k,-1> : k in keys*])) -> ParAxlAlg
{
Let A_S denote the sum of eigenspaces. For lambda in S the elements id*u - lambda*u are all in A_\{S - lambda\}, where id is the idempotent.
Option argument of previous which is an Assoc of dimensions of the eigenspaces. We only perform the operation on a eigenspace when it has a different dimension to the one listed in previous.
}
t := Cputime();
orig := CheckEigenspaceDimensions(A: empty := true);
vprint ParAxlAlg, 2: " Multiplying down using eigenvalues.";
V := A`V;
id := Coordinates(V, A`axes[i]`id`elt);
id_mat := &+[ Matrix( [id[i]*A`mult[j,i] : j in [1..Dimension(V)]]) : i in [1..Dimension(V)] | id[i] ne 0];
for k in Reverse(keys) do
// check whether this is different from previous and if not, then skip
if Dimension(A`axes[i]`even[k]) eq previous[k] then
continue k;
end if;
U := A`axes[i]`even[k] meet A`V;
basU := Basis(U);
for lambda in k do
prods := FastMatrix([ Coordinates(V,u) : u in basU], id_mat);
A`axes[i]`even[k diff {@ lambda @}] +:=
sub<A`W | {@ w : j in [1..Dimension(U)] | w ne A`W!0
where w := prods[j] - lambda*basU[j] @}>;
end for;
end for;
vprintf ParAxlAlg, 4: " Time taken %o\n", Cputime(t);
vprintf ParAxlAlg, 3: "Dimension of subspaces before and after are \n %o\n and %o. \n", orig[i], CheckEigenspaceDimensions(A: empty := true)[i];
return A;
end intrinsic;
intrinsic SumUpwards(A::ParAxlAlg, keys::SeqEnum, i::RngIntElt: previous := AssociativeArray([* <k,-1> : k in keys*])) -> ParAxlAlg
{
For the ith axis we do the following on the even subspaces
A_\{S+T\} += A_\{S+T\} + A_S + A_T
Option argument of previous which is an Assoc of dimensions of the eigenspaces. We only perform the operation on a eigenspace when it has a different dimension to the one listed in previous.
}
tt := Cputime();
orig := CheckEigenspaceDimensions(A: empty := true);
// build a sequence of keys by key length
len := Max([#k : k in keys]);
keylen := [[ k : k in keys | #k eq j] : j in [0..len]];
vprint ParAxlAlg, 2: " Summing upwards.";
for j in [2..#keylen] do
for key in keylen[j] do
subsps := [ A`axes[i]`even[k] : k in keylen[j-1] | k subset key
and Dimension(A`axes[i]`even[k]) ne previous[k] ];
if #subsps ne 0 then
A`axes[i]`even[key] +:= &+ subsps;
end if;
end for;
end for;
vprintf ParAxlAlg, 4: " Time taken %o\n", Cputime(tt);
vprintf ParAxlAlg, 3: "Dimension of subspaces before and after are \n %o\n and %o. \n", orig[i], CheckEigenspaceDimensions(A: empty := true)[i];
return A;
end intrinsic;
intrinsic IntersectionDown(A::ParAxlAlg, keys::SeqEnum, i::RngIntElt: previous := AssociativeArray([* <k,-1> : k in keys*])) -> ParAxlAlg
{
For the ith axis we take intersections on the even subspaces:
A_\{S \cap T\} += A_S \cap A_T
Option argument of previous which is an Assoc of dimensions of the eigenspaces. We only perform the operation on a eigenspace when it has a different dimension to the one listed in previous.
}
tt := Cputime();
orig := CheckEigenspaceDimensions(A: empty := true);
// build a sequence of keys by key length without the largest one
len := Max([#k : k in keys]);
keylen := [[ k : k in keys | #k eq j] : j in [0..len-1]];
vprint ParAxlAlg, 2: " Intersecting downwards.";
for j in Reverse([1..#keylen-1]) do
for key in keylen[j] do
// take those intersections of subspaces which have changed dimension since previous
ints := { {@k,l@} : k,l in &cat keylen[j+1..#keylen] | k meet l eq key
and (Dimension(A`axes[i]`even[k]) ne previous[k]