File: recordPartII.gi

package info (click to toggle)
gap-hap 1.73%2Bds-1
  • links: PTS
  • area: main
  • in suites: forky
  • size: 58,508 kB
  • sloc: xml: 16,467; sh: 197; javascript: 155; makefile: 121; ansic: 47; perl: 24
file content (214 lines) | stat: -rw-r--r-- 4,577 bytes parent folder | download | duplicates (3)
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
#C 2008 Graham Ellis

#####################################################################
#####################################################################
InstallGlobalFunction(ModPCohomologyRing_part_2,
function(A)
local

	PowGens,
	NiceBas,
	B,dim,one,zero,degree,bas,nicbas,SCT,gens,gens1,gens2,i,j,Compose;

######################################
PowGens:=function(A,gens,n)
local tmpbas,V,dim,dim2,powgens,lastgens,lastgens1,x,y,z;

if n=1 then return List(gens,x->[x,[x]]);fi;

dim:=0;
lastgens:=PowGens(A,gens,n-1);

if Length(lastgens)=Dimension(A) then
return lastgens; fi;

powgens:=[];
V:=SubspaceNC(A,List(powgens,x->x[1]));
lastgens1:=SSortedList(List(lastgens,x->x[1]));

for x in gens do
for y in lastgens do
z:=x*y[1]; 
if not (IsZero(z) or z in lastgens) then

  if not z in V then
  Add(powgens,[z,Concatenation([x],y[2])]); 
  tmpbas:=List(powgens,w->w[1]);
  V:=SubspaceNC(A,tmpbas);
  V!.Basis:=BasisNC(V,tmpbas);
  if not Length(Basis(V))>dim then return powgens;else dim:=Dimension(V);fi;
  fi;

fi;
od;od;

return powgens;
end;
######################################


#######################################################
NiceBas:=function(A)
local n,basA,basAcoeffs,nicbas,nicbas1Mat,nicbas1, gens,Coeff;;

n:=20;
nicbas:=[];
gens:=ModPRingGenerators(A);

while Length(nicbas)<Dimension(A) do
n:=n+1;
nicbas:=PowGens(A,gens,n);
od;

nicbas1:=BasisNC(A,List(nicbas,x->x[1]));
basA:=Basis(A);
nicbas1Mat:=MutableCopyMat(List(nicbas1,v->Coefficients(basA,v)));
basAcoeffs:=MutableCopyMat(List(basA,x->Coefficients(basA,x)));
#Coeff:=List(basA,v->Coefficients(nicbas1,v));
Coeff:=SolutionsMatDestructive(nicbas1Mat,basAcoeffs);
Apply(Coeff,v->List(v,x->IntFFE(x)));

Apply(nicbas,x->x[2]);
Apply(nicbas,x->List(x,i->Position(Basis(A),i)));

return [Coeff,nicbas];
end;
########################################################

dim:=Dimension(A);
zero:=Zero(A);
#one:=One(A);
bas:=Basis(A);
SetOne(A,bas[1]);  #I think this is OK
nicbas:=NiceBas(A);
#SCT:=StructuralCopy(StructureConstantsTable(bas));
SCT:=EmptySCTable(dim,Zero(LeftActingDomain(A)));
#gens:=ModPRingGenerators(A);
#gens1:=Filtered(gens,a->A!.degree(a)<2);
#gens1:=List(gens1,a->Position(bas,a));
#gens2:=Filtered(gens,a->A!.degree(a)>1);
#gens2:=List(gens2,a->Position(bas,a));
degree:=A!.degree;

if "gensSupport" in NamesOfComponents(A) then
##########################################
Compose:=function(i,j)
local a,b,c,d,x,y,z,coeff,sc,ans;;
a:=[];

for x in [1..dim] do
if not IsZero(nicbas[1][i][x]) then 
for y in [1..nicbas[1][i][x]] do
Add(a,nicbas[2][x]);
od;
fi;
od;

b:=[];
for x in [1..dim] do
if not IsZero(nicbas[1][j][x]) then
for y in [1..nicbas[1][j][x]] do
Add(b,nicbas[2][x]);
od;
fi;
od;

ans:=zero;
for x in a do
for y in b do
c:=Concatenation(
Filtered(x,t->t in A!.gensSupport),
Filtered(y,t->t in A!.gensSupport),
Filtered(x,t->not t in A!.gensSupport),
Filtered(y,t->not t in A!.gensSupport)
);
d:=one;
for z in c do
d:=bas[z]*d;
od;
ans:=ans+d;
od;
od;

sc:=[];
coeff:=Coefficients(bas,ans);
for x in [1..Length(coeff)] do
if not IsZero(coeff[x]) then 
Append(sc,[coeff[x],x]); fi;
od;

return sc;
end;
##########################################
else
##########################################
Compose:=function(i,j)
local a,b,c,x,y,coeff,sc;
a:=[];

for x in [1..dim] do
if not IsZero(nicbas[1][i][x]) then
for y in [1..nicbas[1][i][x]] do
Add(a,nicbas[2][x]);
od;
fi;
od;

b:=zero;
for x in a do
c:=StructuralCopy(bas[j]);
for y in Reversed(x) do
c:=bas[y]*c;
od;
b:=b+c;
od;

sc:=[];
coeff:=Coefficients(bas,b);
for x in [1..Length(coeff)] do
if not IsZero(coeff[x]) then
Append(sc,[coeff[x],x]); fi;
od;

return sc;
end;
##########################################
fi;


for i in [1..Length(bas)] do
for j in [i..Length(bas)] do
#if not ((i in gens1) or (j in gens1) or (i in gens2 and j in gens2)) then
SetEntrySCTable(SCT,i,j,Compose(i,j));
SetEntrySCTable(SCT,j,i,Compose(j,i));
#fi;
od;od;

B:=AlgebraByStructureConstants(LeftActingDomain(A),SCT);


#####################################################################
degree:=function(x)
local i;

i:=Position(GeneratorsOfAlgebra(B),x);

if i=1 then return 0; fi;

return A!.intToPair(i-1)[1];
end;
#####################################################################


B!.degree:=degree;
B!.intToPair:=A!.intToPair;
B!.intToPairModified:=A!.intToPairModified;
B!.pairToInt:=A!.pairToInt;
B!.pairToIntModified:=A!.pairToIntModified;
B!.niceBasis:=nicbas;

return B;

end);
###########################################################
###########################################################