alex_twist.sa
Generated by gen_html_sa_files from ICSI. Contact gomes@icsi.berkeley.edu for details
-- GPL Copyright (C) 2002 Kouji KODAMA
-- 2002/12 twisted Alexander based on ALEXMAT class.
--K. Kodama
class ALEXMAT_TWIST
class ALEXMAT_TWIST is
include ALEXMAT_TWIST_ALG{MAT_POLYS_INTI,POLYS_INTI,INTI};
MatReduction:CARD is
rDeg:CARD;
MAT_POLYS_INTI_REDUCTION::reduce(inout AMat,out jPivot,out rDeg);
WriteMatrix(rDeg); LOGOUT::flush;
return rDeg;
end;
end;
class ALEXMAT_TWIST_FP
class ALEXMAT_TWIST_FP is
include ALEXMAT_TWIST_ALG{MAT_POLYS_FP,POLYS_FP,FINITE_FIELD};
MatReduction:CARD is
rDeg:CARD;
AMat.reduce(out jPivot,out rDeg);
WriteMatrix(rDeg); LOGOUT::flush;
return rDeg;
end;
end;
class ALEXMAT_TWIST_ALG{MT,ET,CT}
class ALEXMAT_TWIST_ALG{MT,ET,CT} is
-- matrix MT
-- element polynomial ET
-- coeffifient of polynomial CT
shared AMat:MT;
printApoly(apoly:ET) is
LOGOUT::Title("Twisted Alexander","Polynomial");
ps:STR:="";
loop i::=apoly.degree.card.downto!(0);
if (apoly[i].inti>=0.inti) then #LOGOUT+ps; end;
#LOGOUT+apoly[i].str;
ps:="+";
end;
#LOGOUT+"\n"; LOGOUT::flush;
end;
shared jPivot:ARRAY{CARD};
shared rep_deg:CARD; -- degree of representation matrix
shared num_gen:CARD; -- number of generatrs
shared trimN:CARD; -- number of free generators
shared trimC:CARD; -- component of over bridge of deleted relation
shared Relator:ARRAY{WORD};
shared g2c:ARRAY{CARD}; -- map: generator to comploent
shared compoN:CARD; -- #of component
WriteMatrix(p0:CARD) is
LOGOUT::Title("Alexander matrix",""); -- (mod +-1)
zFlg:BOOL; 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:CARD:=(p0).min(degR).min(degG);-- length of diagonel part
loop i::=1.upto!(trimN);
zFlg:=false; #LOGOUT+"diagonal part: 0\n";
end;
if d0>0 then
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","t",true)+"\n";
end;
end;
end;
-- Write other part
if (p0<degR)or(p0<degG) then
sub1:ARRAY{CARD}:=#(degR-p0); loop sub1[0.up!]:=p0.upto!(degR-1); end;
sub2:ARRAY{CARD}:=#(degG-p0); loop sub2[0.up!]:=jPivot[p0.upto!(degG-1)]; end;
#LOGOUT+AMat.sub_matrix(sub1,sub2).str_pmatrix("t");
if (p0<degR)and(p0<degG) then zFlg:=false; end;
end;
if zFlg then #LOGOUT+"0\n"; end;
LOGOUT::flush;
end;
MakeMatrix(TCode:TCODE,Rep:ARRAY{MT},RepR:ARRAY{MT}) is
-- RLength
rep_deg:=Rep[1].nc;
KNOT_GROUP::get_Relator(TCode, out Relator, out g2c);
#OUT+"Rel:\n";
loop i::=Relator.ind!; #OUT+Relator[i].str+"\n"; end;
trimN:=0; trimC:=0; compoN:=(TCode[TCode.length].compo).card;
g:CARD:=g2c.size-1; -- # of generators
num_gen:=g;
r:CARD:=Relator.size; -- # of relators
jPivot:=#(g*rep_deg); loop i::=jPivot.ind!; jPivot[i]:=i; end;
AMat:=#(r*rep_deg,g*rep_deg); AMat.clear;
if (r=0)or(g=0) then return; end;
warr:MT:=#(rep_deg,rep_deg);
warr.to_unit;
p_one::=ET::one;
p_x::=ET::x;
loop i:CARD:=0.upto!(r-1);
-- Make relation matrix with Fox's free differential
-- w=(a b a~ c~) or (a b c~ b~)
AMat.plus(warr,i*rep_deg,((Relator[i][0]-1)*rep_deg).card);
warr:=warr*Rep[(Relator[i][0]).card];
AMat.plus(warr*p_x,i*rep_deg,((Relator[i][1]-1)*rep_deg).card);
if Relator[i].w.has_ind(2) then
warr:=warr*Rep[(Relator[i][1]).card]*RepR[(-Relator[i][2]).card];
AMat.minus(warr*p_x, i*rep_deg, ((-Relator[i][2]-1)*rep_deg).card);
end;
if Relator[i].w.has_ind(3) then
warr:=warr*RepR[(-Relator[i][3]).card];
AMat.minus(warr, i*rep_deg, ((-Relator[i][3]-1)*rep_deg).card);
end;
--#OUT+"AMat "+i.int+"-th relation:"+"\n";
end;
end;
trimMat1(TCode:TCODE) is
trimN:=0; -- Set # of "0" element.
delR,delG:CARD;
pt:INT:=0.int; word:WORD;
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 ; 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:=rep_deg;
delR:=1; delG:=word[1].card;
trimC:=g2c[delG].card;
loop i::=(delR*rep_deg-1).downto!((delR-1)*rep_deg);
AMat:=AMat.minor_matrix_row(i);
end;
loop i::=(delG*rep_deg-1).downto!((delG-1)*rep_deg);
AMat:=AMat.minor_matrix_column(i);
end;
jPivot:=#(AMat.nc); loop i::=jPivot.ind!; jPivot[i]:=i; end;
end;
end;
end;
AlexPoly(p0:CARD, out apoly:ET) is
apoly:=ET::one;
if AMat.nr/=AMat.nc then
#OUT+"Alexander matrix is not square.\n";
apoly:=ET::zero;
return;
end;
pw:ET; -- 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<=rep_deg then
if p0<AMat.nr then
mat::=AMat.copy; jPivotm::=jPivot.copy;
loop i::=0.upto!(p0-1); mat:=mat.minor_matrix(0,jPivotm[i]);
loop j::=i.upto!(jPivotm.size-1);
if jPivotm[j]>jPivotm[i] then jPivotm[j]:=jPivotm[j]-1; end;
end;
end;
apoly:=apoly*mat.det;
end;
else apoly:=ET::zero;
end;
if apoly.is_zero.not then
apoly:=apoly.shift_deg(-(apoly.low_deg));
--if (trimN=1)and(compoN>1) then
-- apoly:=apoly/(#POLYS_INTI(1.inti,1)-1.inti);
--end;
-- if apoly.substitute(#CT(1.int)).inti.is_neg then apoly:=-apoly; end;
end;
end;
APolyOut(p0:CARD) is
pa:ET;
AlexPoly(p0,out pa);
printApoly(pa);
end;
AlexMat(TCode:TCODE, Rep:ARRAY{MT},RepR:ARRAY{MT}) is
-- Rep/RepR: Representation / reverse
-- Rep[i] : image of generator x_i.
-- Rep[0] : not used.
#LOGOUT+"\n";
num_gen:=Rep.size-1;
if num_gen<=1 then
#LOGOUT+"The ";
if TCode[TCode.length].compo=1.int then #LOGOUT+"knot"; else #LOGOUT+"link"; end;
if num_gen=0 then #LOGOUT+" is empty.";
else #LOGOUT+" is Trivial.";
end;
LOGOUT::flush;
return;
end;
POLYS_INTI::init;
MakeMatrix(TCode,Rep,RepR);
LOGOUT::LogTime; WriteMatrix(0); LOGOUT::flush;
trimMat1(TCode);
rDeg::=MatReduction;
if ~TCode.has_band then APolyOut(rDeg); end;
#LOGOUT+"\n"; LOGOUT::flush;
AMat:=#(0,0);
end;
end;