File: barcode.gi

package info (click to toggle)
gap-hap 1.66%2Bds-1
  • links: PTS
  • area: main
  • in suites: trixie
  • size: 55,348 kB
  • sloc: xml: 15,368; sh: 216; javascript: 155; makefile: 126; ansic: 57; perl: 36
file content (60 lines) | stat: -rw-r--r-- 1,384 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
HAPBARCODE:=0;

#############################################################
InstallGlobalFunction(UniversalBarCode,
function(arg)
local str, n, d, B, i, j, M, file,PolRing,x;

str:=arg[1];
n:=arg[2];
d:=arg[3];

if not str in
["DerivedSeries", "LowerCentralSeries", "UpperCentralSeries", "PCentralSeries",
"PUpperCentralSeries"] then 
Print("The first argument must be a string equal to one of \"DerivedSeries\", \"LowerCentralSeries\", \"UpperCentralSeries\", \"PCentralseries\", \"PUpperCentralSeries\" \n");
return fail;
fi;

 
PolRing:=HapConstantPolRing;
x:=GeneratorsOfAlgebra(PolRing)[2];

file:=Concatenation("lib/Homology/BarCodes/",str,"_",String(n),".gi");
ReadPackage("HAP",file);

M:=HAPBARCODE[d];

B:=[];
for i in [1..Length(M)] do
B[i]:=[];
for j in [1..Length(M[i])] do
B[i][j]:=ValuePol(M[i][j][1],x)/ValuePol(M[i][j][2],x);
od;
od;

if Length(arg)=4 then
return UniversalBarCodeEval(B,arg[4]);
fi;

return B;
end);
#############################################################

#############################################################
InstallGlobalFunction(UniversalBarCodeEval,
function(BB,k)
local i,j,B;

B:=StructuralCopy(BB);
for i in [1..Length(B)] do
for j in [1..Length(B[i])] do
if not IsInt(B[i][j]) then
B[i][j]:=ExpansionOfRationalFunction(B[i][j],k)[k];
fi;
od;
od;

return B;
end);
#############################################################