alexmatm.sa
Generated by gen_html_sa_files from ICSI. Contact gomes@icsi.berkeley.edu for details
--
--
--
-- 2001/02 merge codes for knot and theta curve.
--
-- 1998/1
-- Modula2 LongInt module.
--
--1999/2 K.Kodama
-- theta curve Linux version
--
--1997/1
--Theta curve
-- Alexander polynomial on Theta curve.
-- c.f. Litherland's method.
--un-oriented surface in S^4
--
--1996/10
--LINUX version
--
--bug fix for 2-knot
--
--92/09/30 03:14:42
--1992/6 Alexander matrix and Alexander polynomial for 1-knot/link
--1992/6/20: 10para99(parallel of k10c99. 40 crossing) 10sec.
--K. Kodama
--
--1989/9 Kouji Kodama
--
class ALEXMATM
class ALEXMATM is
-- Alexander matrix and Alexander polynomial
-- for 1-knot, 2-knot, theta curve.
shared AMat:MAT_POLYM_INTI;
shared trimN:INT; -- number of deleted relation
shared trimC:INT; -- component of over bridge of deleted relation
shared jPivot:ARRAY{INT};
shared Relator:ARRAY{WORD};
shared g2c:ARRAY{INT};
shared compoN:INT; -- #of component
WriteMatrix(p0:INT) is
zFlg:BOOL;
LOGOUT::Title("Alexander","matrix");
zFlg:=true;
degR::=AMat.nr; degG::=AMat.nc;
--if p0>degR then p0:=degR; end;
--if p0>degG then p0:=degG; end;
-- Alexander matrix is the form of
--\pmatrix{
--diagonal & 0 \cr
-- 0 & matrix \cr
--}
if (degR=degG)and(p0=degR-1) then p0:=degR; end;
-- Write diagonal part.
d0:INT; -- length of diagonel part
d0:=(p0).min(degR).min(degG);
loop i::=1.upto!(trimN);
zFlg:=false;
#LOGOUT+"diagonal part: 0\n";
end;
loop i::=0.upto!(d0-1); j::=jPivot[i];
if (~AMat[i][j].is_one)and(~AMat[i][j].negate.is_one)
then
zFlg:=false;
#LOGOUT+"diagonal part: "+
AMat[i][j].str("tex")+"\n";
end;
end;
-- Write other part
if (p0<degR)or(p0<degG) then
#LOGOUT+"\pmatrix{\n";
loop i::=(p0).upto!(degR-1);
loop j::=(p0).upto!(degG-1); zFlg:=false;
if p0<j then #LOGOUT+" & "; end;
#LOGOUT+AMat[i][jPivot[j]].str("tex");
end;
#LOGOUT+" \\cr"+"\n";
end;
#LOGOUT+"}\n";
end;
if zFlg then #LOGOUT+"0\n"; end;
end;
MakeMatrix(TCode:TCODE) is
-- Make relation with Fox's free differential.
-- Note that
-- (1) w=(a b a~ c~) at crossings
-- (2) w=(a b c) at verteces of theta curve
-- (3) w=(a b) at the end of un-coherent band
trimN:=0; trimC:=0; compoN:=TCode[TCode.length].compo;
g:INT:=g2c.size-1;
r:INT:=Relator.size;
jPivot:=#(g); loop i::=jPivot.ind!; jPivot[i]:=i; end;
AMat:=#(r,g); AMat.clear;
if (r=0)or(g=0) then return; end;
loop i::=0.upto!(r-1);
AMat[i][Relator[i][0]-1]:=
AMat[i][Relator[i][0]-1]
+(POLYM_INTI::one);
AMat[i][Relator[i][1]-1]:=
AMat[i][Relator[i][1]-1]
+(#POLYM_INTI("x"+g2c[Relator[i][0]].str));
if Relator[i].w.has_ind(2) then
if Relator[i][2]<0 then -- crossing relatijon
AMat[i][-Relator[i][2]-1]:=
AMat[i][-Relator[i][2]-1]
-(#POLYM_INTI("x"+g2c[Relator[i][1]].str));
else -- theta curve vertex relation
AMat[i][Relator[i][2]-1]:=
AMat[i][Relator[i][2]-1]
+(#POLYM_INTI("x"+g2c[Relator[i][0]].str)*
#POLYM_INTI("x"+g2c[Relator[i][1]].str)
);
end;
end;
if Relator[i].w.has_ind(3) then -- crossing relation
AMat[i][-Relator[i][3]-1]:=
AMat[i][-Relator[i][3]-1]
-(POLYM_INTI::one);
end;
--#OUT+"Rel:\n";
--loop i::=Relator.ind!; #OUT+Relator[i].str+"\n"; end;
--
-- #OUT+"AMat:"+i.int+":"
-- +AMat[i][Relator[i][0]-1].str+", "
-- +AMat[i][Relator[i][1]-1].str+", "
-- +AMat[i][-Relator[i][2]-1].str+", "
-- +AMat[i][-Relator[i][3]-1].str+"\n";
end;
end;
trimMat1(TCode:TCODE) is
delR,delG:INT;
pt:INT:=0; word:WORD;
trimN:=0;
if TCode.has_band then -- 2-dim knot/link
res::=KNOT_GROUP::getCrossR(TCode, inout pt, out word);
if res and (pt<TCode.bandStart) then
-- not implemented.
end;
else -- 1-dim knot/link
-- delete a crossing relation
res::=KNOT_GROUP::getCrossR(TCode, inout pt, out word);
if res and (pt<TCode.bandStart) then
trimN:=1;
delR:=1; delG:=word[1];
trimC:=g2c[delG];
AMat:=AMat.minor_matrix(delR-1,delG-1);
jPivot:=#(AMat.nc); loop i::=jPivot.ind!; jPivot[i]:=i; end;
end;
end;
end;
trimMat1_Theta(TCode:TCODE) is
delR,delG:INT;
pt:INT:=0; word:WORD;
trimN:=0;
-- remove verteces relations
AMat:=AMat.minor_matrix_row(AMat.nr-1);
AMat:=AMat.minor_matrix_row(AMat.nr-1);
-- remove generators at the head of each string
loop c::=3.downto!(1); -- component
j::=TCode.endOfString(TCode.compoStart(c),1);
g::=TCode[j].gen;
AMat:=AMat.minor_matrix_column(g-1);
end;
if AMat.nr/=AMat.nc then raise "trimMat_Theta: nr/=nc\n"; end;
trimC:=3;
jPivot:=#(AMat.nc); loop i::=jPivot.ind!; jPivot[i]:=i; end;
end;
AlexPoly(p0:INT, out apoly:POLYM_INTI) is
apoly:=POLYM_INTI::one; --- alex.poly
if AMat.nr/=AMat.nc then
#OUT+"Alexander matrix is not square.\n";
apoly:=POLYM_INTI::zero;
return;
end;
pw:POLYM_INTI; -- work
-- diagonal part
countz::=0; -- count "0"
loop i::=0.upto!(p0-1);
pw:=AMat[i,jPivot[i]];
if pw.is_zero then countz:=countz+1;
else
apoly:=apoly*pw;
end;
end;
-- non-diagonal part
if countz+trimN<=1 then
if p0<AMat.nr then
mat::=AMat.copy;
loop i::=0.upto!(p0-1);
mat:=mat.minor_matrix(0,jPivot[i]);
loop j::=i.upto!(jPivot.size-1);
if jPivot[j]>jPivot[i] then jPivot[j]:=jPivot[j]-1; end;
end;
end;
apoly:=apoly*mat.det;
end;
else apoly:=POLYM_INTI::zero;
end;
if apoly.is_zero.not then
apoly:=apoly/#POLYM_INTI(apoly.gcd_term);
-- if apoly.substitute(1.inti)<0.inti then apoly:=-apoly; end;
--printApoly(apoly);
if (trimN=1)and(compoN>1) then
apoly:=apoly/(#POLYM_INTI("x"+trimC.str)-1.inti);
end;
slist:MAP{STR,POLYM_INTI}:=#;
loop i::=1.upto!(compoN);
slist["x"+i.str]:=#POLYM_INTI(1.inti);
end;
res_p::=apoly.substitute(slist);
if res_p.lc<0.inti then apoly:=-apoly; end;
end;
end;
printApoly(apoly:POLYM_INTI) is
LOGOUT::Title("Alexander","Polynomial");
#LOGOUT+apoly.str("tex");
#LOGOUT+"\n";
end;
AlexMat(TCode:TCODE) is
rDeg:INT;
POLYM_INTI::init;
KNOT_GROUP::get_Relator(TCode, out Relator, out g2c);
MakeMatrix(TCode);
#LOGOUT+"\n";
if AMat.nr<1 or AMat.nc<1 then
s:STR:="The ";
if TCode.number_compo=1 then s:=s+"knot"; else s:=s+"link"; end;
s:=s+" is ";
if AMat.nc<1 then s:=s+"empty"; else s:=s+"Trivial"; end;
#LOGOUT+s+".\n";
return;
else
LOGOUT::LogTime;
WriteMatrix(0);
trimMat1(TCode);
MAT_POLYM_INTI_REDUCTION::reduce(inout AMat,out jPivot,out rDeg);
-- WriteMatrix(0);
WriteMatrix(rDeg);
if ~TCode.has_band then
pa:POLYM_INTI;
AlexPoly(rDeg,out pa);
printApoly(pa);
end;
end;
#LOGOUT+"\n"; LOGOUT::flush;
end;
AlexMat_Theta(TCode:TCODE) is
-- Assume TCode for Theta-curve
rDeg:INT;
POLYM_INTI::init;
KNOT_GROUP::get_Relator_Theta(TCode, out Relator, out g2c);
MakeMatrix(TCode);
#LOGOUT+"\n";
if AMat.nr<1 or AMat.nc<1 then
#LOGOUT+"The theta curve is Trivial.\n";
return;
else
LOGOUT::LogTime;
WriteMatrix(0);
trimMat1_Theta(TCode);
WriteMatrix(0);
MAT_POLYM_INTI_REDUCTION::reduce(inout AMat,out jPivot,out rDeg);
-- WriteMatrix(0);
WriteMatrix(rDeg);
--
pa:POLYM_INTI;
AlexPoly(rDeg,out pa);
printApoly(pa);
#LOGOUT+"with relation x1x2x3=1.\n";
--
end;
#LOGOUT+"\n"; LOGOUT::flush;
end;
end;