File: modpcocycle.gi

package info (click to toggle)
gap-hap 1.74%2Bds-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 58,664 kB
  • sloc: xml: 16,678; sh: 197; javascript: 155; makefile: 121; ansic: 47; perl: 24
file content (172 lines) | stat: -rw-r--r-- 4,631 bytes parent folder | download
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
#RT:=0;
#####################################################################
#####################################################################
InstallGlobalFunction(HAP_CocyclesAndCoboundariesModP,
function(arg)
local  
	C, n,  Dimension,  
	M1, M2, row, 
	dim, dim2, BasisKerd2, BasisImaged1, 
        cohomology,
	CycleToClass, ClassToCycle,
	i, j, x, sum, ONE, char, V, v, lncoho;

C:=arg[1];
n:=arg[2];

char:=EvaluateProperty(C,"characteristic");
ONE:=One(GF(char));
Dimension:=C!.dimension;

if n <0 then return false; fi;
#if n=0 then return [0*ONE]; fi;

if Dimension(n)>0 then
M2:=CoboundaryMatrix(C,n);
else
M2:=[[ONE*0]]; 
fi;

#BasisKerd2:=SemiEchelonMatTransformation(TransposedMat(M2)).relations;
BasisKerd2:=NullspaceMat(TransposedMat(M2));
Unbind(M2);
M1:=CoboundaryMatrix(C,n-1);
if M1=[] then
M1:=[ONE*0*[1..Dimension(n)]];
if Dimension(n)=0 then M1:=[[ONE*0]]; fi;
fi;
#BasisImaged1:=SemiEchelonMatTransformation(TransposedMat(M1)).vectors;
BasisImaged1:=SemiEchelonMat(TransposedMat(M1)).vectors;
Unbind(M1);
dim:=Length(BasisImaged1);

cohomology:=[];
V:=MutableCopyMat(BasisImaged1);
for v in  BasisKerd2 do
Add( V, v*ONE);
V:=MutableCopyMat(SemiEchelonMatTransformation(V).vectors);
dim2:=Length(V);
if dim2>dim then Add(cohomology,v); dim:=dim2; fi;
od;

lncoho:=Length(cohomology);
if Length(cohomology)>0 then
cohomology:=ONE*SemiEchelonMatTransformation(cohomology).vectors;
#else
#cohomology:=[0*ONE];
fi;

cohomology:=Concatenation(cohomology,BasisImaged1);
Unbind(V); Unbind(BasisImaged1);

#####################################################################
CycleToClass:=function(v)
local cls;

cls:= SolutionMat(cohomology,v*ONE);
return cls{[1..lncoho]};
end;
#####################################################################

#####################################################################
ClassToCycle:=function(u)
local w, i;

w:=cohomology[1]*0;
for i in [1..Length(u)] do
if not IsZero(u[i]) then w:=w+u[i]*cohomology[i]; fi;
od;

return w;
end;
#####################################################################

return 	rec(
		cocyclesBasis:=BasisKerd2,
	 	cocycleToClass:=CycleToClass,        
	 	classToCocycle:=ClassToCycle );

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


#####################################################################
#####################################################################
InstallGlobalFunction(CupProductOfRegularCWComplexModP,
function(arg)
local X,prime,Xd,XX,A, CX, CXX, XdmapXX, XdmapX, CXmapCXX,
      DIAG, tc,i,n, w, HCXXmapHCX, tensor, quad2pair, HCXcab, 
      HCXsmallcab, CXsmall, HXsmall, CXsmallmapCX, HCXmapHCXsmall,
      HCXsmall,range, CXmapCXsmall, HCXsmallmapHCX, Equiv;

X:=arg[1];
prime:=arg[2];
X:=ContractedComplex(X);
CriticalCells(X);
XX:=DirectProductOfRegularCWComplexes(X,X,Dimension(X)+1);
CXmapCXX:=DiagonalChainMap(X);
HCXXmapHCX:=HomToIntegersModP(CXmapCXX,prime);
Equiv:=ChainComplexEquivalenceOfRegularCWComplex(X);
CXsmallmapCX:=Equiv[2];
HCXmapHCXsmall:=HomToIntegersModP(CXsmallmapCX,prime);
HCXsmall:=Target(HCXmapHCXsmall);   
CXmapCXsmall:=Equiv[1];
HCXsmallmapHCX:=HomToIntegersModP(CXmapCXsmall,prime);

range:=[1..Length(HCXsmall)];
HCXsmallcab:=
List(range,n->HAP_CocyclesAndCoboundariesModP(HCXsmall,n));

quad2pair:=XX!.quad2pair;


##############################
##############################
tensor:=function(p,q,vv,ww)
local  vvv,www,u, P, v, w, Q, i, j, cp, cq, cheat;
#inputs a  p-class vv and a q-class ww.
#outputs a p+q-cocycle u in HCXdsmall
#u:=0*[1..CXX!.dimension(p+q)];
if p=0 then return ww; fi;
if q=0 then return vv; fi;
 
u:=[];
vvv:=HCXsmallcab[p]!.classToCocycle(vv);
www:=HCXsmallcab[q]!.classToCocycle(ww);
v:=HCXsmallmapHCX!.mapping(vvv,p);
w:=HCXsmallmapHCX!.mapping(www,q);

P:=Filtered([1..Length(v)],i->not IsZero(v[i]));
Q:=Filtered([1..Length(w)],j->not IsZero(w[j]));

for i in P do
for j in Q do
Add(u,  [ quad2pair[p+1][q+1][i][j][2] , v[i]*w[j] ]);
od;od;


###############################
if p<q then cheat:=1;         #NEED TO THINK ABOUT THIS!
else cheat:=-1; 
fi;
Apply(u,x->[x[1],cheat*x[2]]);
###############################

#RT:=RT-Runtime();  #Takes all the time!
w:= HCXXmapHCX!.sparseMap(u, p+q);
#RT:=RT+Runtime();
w:=HCXmapHCXsmall!.mapping(w,p+q);
w:=HCXsmallcab[p+q]!.cocycleToClass(w);
return w;
end;
##############################
##############################

return tensor;
end);
#####################################################################
#####################################################################