File: spin.gi

package info (click to toggle)
gap-hap 1.73%2Bds-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 58,508 kB
  • sloc: xml: 16,467; sh: 197; javascript: 155; makefile: 121; ansic: 47; perl: 24
file content (153 lines) | stat: -rw-r--r-- 3,987 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

#DeclareGlobalFunction("Spin");
####################################################################
################### Spinning CW-complexes ##########################
####################################################################
############ Input: inclusion map from a subcomplex U to ###########
################### its parent (n-dimensional) regular #############
################### CW-complex X ###################################
########### Output: (n+1)-dimensional CW-complex S(X) ##############
################### corresponding to the `spinning' ################
################### of the original complex about U ################
####################################################################
InstallGlobalFunction(Spin, 
function(inc)
local X,Y,U, map, bndX, bndY, bnd, orient, quad2pair, pair2quad,
      indx,bndd,p,pr,INDX,pos,i, j, ij, n, x, y, a, b, ia, ib, 
      count, BND, ORIEN, M;

X:=Target(inc);
U:=Source(inc);
indx:=U!.boundaries;;
map:=inc!.mapping;
Y:=[ [[1,0],[1,0]], [[2,1,2],[2,1,2]], [[2,1,2]], [] ]; 
Y:=RegularCWComplex(Y);
#Y is the unit disk

bndX:=X!.boundaries;
bndY:=Y!.boundaries;
bnd:=List([0..Dimension(X)+Dimension(Y)],i->[]);
orient:=List([0..Dimension(X)+Dimension(Y)],i->[]);

###############################
###############################
quad2pair:=[];
pair2quad:=List([1..1+Dimension(X)+Dimension(Y)],i->[]);;
count:=List([1..1+Dimension(X)+Dimension(Y)],i->0);

for i in [1..1+Dimension(X)] do
quad2pair[i]:=[];
for j in [1..1+Dimension(Y)] do
quad2pair[i][j]:=[];
ij:=i-1+j;
for x in [1..Length(bndX[i])] do
quad2pair[i][j][x]:=[];
for y in [1..Length(bndY[j])] do
count[ij]:=count[ij]+1;
quad2pair[i][j][x][y]:=[ij,count[ij]];
pair2quad[ij][count[ij]]:=[i,j,x,y];
od; od;
od; od;
###############################
###############################

###############################
###############################
for i in [1..1+Dimension(X)] do
for j in [1..1+Dimension(Y)] do
for x in [1..Length(bndX[i])] do
for y in [1..Length(bndY[j])] do
BND:=[0];
ORIEN:=[];

if i>1 then
a:=bndX[i][x];

for ia in [2..Length(a)] do   #a{[2..Length(a)]} do
Add(BND,quad2pair[i-1][j][a[ia]][y][2]);
BND[1]:=BND[1]+1;
##############
##############
od;
fi;

if j>1 then 
b:=bndY[j][y];
for ib in [2..Length(b)] do #b{[2..Length(b)]} do
Add(BND,quad2pair[i][j-1][x][b[ib]][2]);
BND[1]:=BND[1]+1;
##############
##############
od;
fi;
bnd[i-1+j][quad2pair[i][j][x][y][2]]:=BND;
orient[i-1+j][quad2pair[i][j][x][y][2]]:=ORIEN;
od;od;
od;od;

bnd[1]:=List(bnd[1],i->[1,0]);
Add(bnd,[]);
##############################
##############################


#Let's now work on removing those cells of the
#form f x e with e the unique 2-cell in Y and f NOT in U.

indx:=List([1..Length(X!.boundaries)], a-> [1..Length(X!.boundaries[a])]);
for n in [1..Length(indx)-1] do
for j in [1..Length(U!.boundaries[n])] do
indx[n][map(n-1,j)]:=0;
od;
od;

#INDX[n] is a list of n-1-cells       
#bnd[n] is a list of boundaries of n-1-cells
#map(n,i) is the image of the ith n-cell in U
INDX:=List([1..Length(bnd)], a-> [1..Length(bnd[a])]);
for p in [1..1+Dimension(X)] do
for x in [1..X!.nrCells(p-1)] do
if indx[p][x]>0 then
pr:=quad2pair[p][3][x][1];
INDX[pr[1]][pr[2]]:=0;
fi;
od;
od;

for n in [1..Length(INDX)] do
INDX[n]:=Filtered(INDX[n],a->a>0);
od;

for n in [1..Length(bnd)] do
bnd[n]:=bnd[n]{INDX[n]};
od;

###########################
pos:=function(n,i)
return Position(INDX[n],i);
end;
###########################

#For safety, we'll be inefficient and create a copy of bnd rather 
#than modify bnd. This gets around silly mistakes that could arise 
#with pointers.

bndd:=List([1..Length(bnd)],i->[]);

bndd[1]:=bnd[1];
for n in [1..Length(bnd)-1] do
for x in bnd[n+1] do
Add(bndd[n+1], Concatenation([x[1]], List(x{[2..Length(x)]}, i-> pos(n,i))))  ;
od;
od;

M:= RegularCWComplex(1*bndd);
OrientRegularCWComplex(M);

return M;
end);
##################################################
##################################################