alexmat.sa


Generated by gen_html_sa_files from ICSI. Contact gomes@icsi.berkeley.edu for details
 
-- Copyright (C) 1983 1992 1996 Kouji KODAMA
--
-- 1998/1 
--LongInt
--
--1997/1
--Theta curve
--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.
--1992/6/20:  10para99(parallel of k10c99. 40 crossing) 10sec.
--K. Kodama


class ALEXMAT

class ALEXMAT is -- ALEXMATmaxC=maxC; --matV=array[1..ALEXMATmaxC] OF PolyInt; --pmatV=POINTER TO matV; --amatV=array[1..ALEXMATmaxC] OF pmatV; apoly2conway(apoly:POLYS_INTI, out cpoly:POLYS_INTI) is deg::=apoly.degree; CN:ARRAY{POLYS_INTI}:=POLY_COEFF::AllocCN(deg); cpoly:=#; loop z::=deg.downto!((deg+1)/2); cpoly:=cpoly+#POLYS_INTI(apoly[z],z*2-deg); apoly:=apoly-CN[z*2-deg]*#POLYS_INTI(apoly[z],deg-z); end; end; conway2apoly(cpoly:POLYS_INTI, out apoly:POLYS_INTI) is apoly:=#; px:POLYS_INTI:=#(1.inti,1); cn:POLYS_INTI:=#(1.inti); cn1::=POLYS_INTI::gen_func(|(-1).inti,1.inti|); loop z::=0.upto!(cpoly.degree); apoly:=apoly*px+cn*cpoly[z]; cn:=cn*cn1; end; end; printConway(cpoly:POLYS_INTI) is LOGOUT::Title("Conway","Polynomial"); #LOGOUT+cpoly.str("tex","z",true)+"\n"; LOGOUT::flush; end; printApoly(apoly:POLYS_INTI) is LOGOUT::Title("Alexander","Polynomial"); loop i::=0.upto!(apoly.degree); if (i>0) and (apoly[i]>=0.inti) then #LOGOUT+"+"; end; #LOGOUT+apoly[i]; end; #LOGOUT+"\n"; LOGOUT::flush; end; shared AMat:MAT_POLYS_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","t",true)+"\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","t",true); end; #LOGOUT+" \\cr"+"\n"; end; #LOGOUT+"}\n"; end; if zFlg then #LOGOUT+"0\n"; end; LOGOUT::flush; end; MakeMatrix(TCode:TCODE) is -- RLength 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; 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); -- Make relation with Fox's free differential AMat[i][Relator[i][0]-1]:= AMat[i][Relator[i][0]-1]+(POLYS_INTI::one); AMat[i][Relator[i][1]-1]:= AMat[i][Relator[i][1]-1]+(#POLYS_INTI(1.inti,1)); if Relator[i].w.has_ind(2) then AMat[i][-Relator[i][2]-1]:= AMat[i][-Relator[i][2]-1]-(#POLYS_INTI(1.inti,1)); end; if Relator[i].w.has_ind(3) then AMat[i][-Relator[i][3]-1]:= AMat[i][-Relator[i][3]-1]-(POLYS_INTI::one) 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 -- delete a crossing relation 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 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;
AlexPoly(p0:INT, out apoly:POLYS_INTI) is apoly:=POLYS_INTI::one; --- alex.poly if AMat.nr/=AMat.nc then #OUT+"Alexander matrix is not square.\n"; apoly:=POLYS_INTI::zero; return; end; pw:POLYS_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:=POLYS_INTI::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(1.inti)<0.inti then apoly:=-apoly; end; end; end; APolyOut(p0:INT, testSym:BOOL) is pa:POLYS_INTI; AlexPoly(p0,out pa); printApoly(pa); if testSym then -- Test symmetry using Murasugi's condition. SYMMET::TestSym(pa); end; end; AlexMat(TCode:TCODE, testSym:BOOL) is rDeg:INT; if testSym then if TCode.has_band then #OUT+"[test cyclic] not support knotting surface.\n"; return; elsif TCode.number_compo/=1 then #OUT+"[test cyclic] not support links.\n"; return; end; end; POLYS_INTI::init; -- matrix MakeMatrix(TCode); -- print #LOGOUT+"\n"; if AMat.nr<1 or AMat.nc<1 then #LOGOUT+"The "; if TCode[TCode.length].compo=1 then #LOGOUT+"knot"; else #LOGOUT+"link"; end; if AMat.nc<1 then #LOGOUT+" is empty."; else #LOGOUT+" is Trivial."; end; return; else LOGOUT::LogTime; WriteMatrix(0); trimMat1(TCode); MAT_POLYS_INTI_REDUCTION::reduce(inout AMat,out jPivot,out rDeg); -- WriteMatrix(0); WriteMatrix(rDeg); -- polynomial if ~TCode.has_band then APolyOut(rDeg,testSym); end; end; #LOGOUT+"\n"; LOGOUT::flush; end; end;