File: HAPimport.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 (83 lines) | stat: -rw-r--r-- 2,422 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
#(C) Graham Ellis 2008

HAPTEMPORARYFUNCTION:=0;
MakeReadOnlyGlobal("HAPTEMPORARYFUNCTION");

#####################################################################
#####################################################################
InstallMethod(HAPRead,
   "method for reading in a HAp resolution from a text file",
   [IsString],

function(file)
	local 	R,
		Dimension,
		ChangeSign,
		Boundary,
		Homotopy;

##################### READ FILE TO R ################################
MakeReadWriteGlobal("HAPTEMPORARYFUNCTION");
Read(file);
if IsFunction(HAPTEMPORARYFUNCTION) then
R:=HAPTEMPORARYFUNCTION();
else
Print("YES\n");
R:=HAPTEMPORARYFUNCTION;
fi;
HAPTEMPORARYFUNCTION:=0;
MakeReadOnlyGlobal("HAPTEMPORARYFUNCTION");
##################### FILE READ TO R ################################

if not IsList(R) then return R; fi;



if not R.type=HapResolution then TryNextMethod(); fi;

#####################################################################
Dimension:=function(i)
if i<0 then return 0; fi;
if i=0 then return 1; fi;
return R.ranks[i+1];
end;
#####################################################################

#####################################################################
ChangeSign:=function(j,b)
if j>0 then return b; else
return NegateWord(b); fi;
end;
#####################################################################

#####################################################################
Boundary:=function(i,j)
if i=0 then return []; else
return ChangeSign(j,R.boundaries[i][AbsoluteValue(j)]); fi;
end;
#####################################################################

#####################################################################
Homotopy:=function(n,p)        
#if i <0 then return fail; fi;   
if p[1]>0 then 
return R.contracting_homotopy[n+1][p[1]][p[2]];
else
return NegateWord(R.contracting_homotopy[n+1][-p[1]][p[2]]);
fi;
end;
#####################################################################


return Objectify(HapResolution,
                rec(
                dimension:=Dimension,
                boundary:=Boundary,
                homotopy:=Homotopy,
                elts:=R.elements,
                group:=Group(R.elements),
                properties:=R.special_properties
                    ));
end);
#####################################################################
#####################################################################