goeritz.sa


Generated by gen_html_sa_files from ICSI. Contact gomes@icsi.berkeley.edu for details
 
--Copyright (C) 1983 1989 1996 Kouji KODAMA
-- 1996/10
--LINUX version
--
--Kouji  Kodama    1989/9    
--Modula2 version
--
--1983 
--Bsaic version
--
-- Goeritz matrix is
--	(A+) + (A+)t - (A-) - (A-)t + (B+) + (B+)t - (B-) - (B-)t:
-- t is transpose.
-- A+ A- B+ B- are coded G_matrices.



class G_CROSS

class G_CROSS is attr surface:CARD; attr dir:INT; attr io:CARD; const ncP,inP,outP; -- io create:SAME is res:SAME:=new; res.surface:=0; res.dir:=0.int; res.io:=ncP; return res; end; end;

class GOERITZ_MAT

class GOERITZ_MAT is const gm,an,ap,bn,bp,mat_num; -- code/ori types printGMat(Graph:ARRAY{MAT_INTI}) is LOGOUT::Title("Coded oriented","Goeritz matrix"); #LOGOUT+"code A+ =\n"+Graph[ap].strTeX+"\n"; #LOGOUT+"code A- =\n"+Graph[an].strTeX+"\n"; #LOGOUT+"code B+ =\n"+Graph[bp].strTeX+"\n"; #LOGOUT+"code B- =\n"+Graph[bn].strTeX+"\n"; #LOGOUT+"Goreitz matrix"+"=\n"+Graph[gm].strTeX+"\n"; LOGOUT::flush; end; printKnotValue(kv:INTI) is LOGOUT::Title("Knot","Value"); #LOGOUT+kv.str+"\n"; LOGOUT::flush; end; ------------------coloring of the diagram--------------- SearchNewColor(TCode:TCODE,Bounds:ARRAY{ARRAY{G_CROSS}}, inout Sn:CARD,out stp:CARD, out dir0:INT):BOOL is stp:=0; loop stp:=stp+1;; until!( (stp>=TCode.length) or (VERTEXC::crossing.in(TCode[stp].sep) and (Bounds[stp][1].io=G_CROSS::outP) and(Bounds[stp][2].io=G_CROSS::ncP) ) ); end; if stp<TCode.length then dir0:=-Bounds[stp][1].dir; Sn:=Sn+1; return true; end; stp:=0; loop stp:=stp+1; until!( (stp>=TCode.length) or ( VERTEXC::crossing.in(TCode[stp].sep) and (Bounds[stp][1].io=G_CROSS::ncP)) ); end; if stp<TCode.length then if (VERTEXC::over.in(TCode[stp].sep) =VERTEXC::negative.in(TCode[stp].sep)) then dir0:=-1; else dir0:=1; end; stp:=TCode[stp].companion.card; -- dir0:=-1; -- on dual graph Sn:=Sn+1; return true; end; return false; end; Bound(TCode:TCODE,inout Bounds:ARRAY{ARRAY{G_CROSS}}, Sn:CARD, stp:CARD, dir0:INT) is dir1:INT; cn1, pt:CARD; dir1:=dir0; pt:=stp; loop pt:=(pt.int+dir1).card; if VERTEXC::separator.in(TCode[pt].sep) then Bounds[pt][1].dir:=dir1; Bounds[pt][1].surface:=Sn; Bounds[pt][1].io:=G_CROSS::inP; pt:=TCode[pt].companion.card; Bounds[pt][1].dir:=dir1; Bounds[pt][1].surface:=Sn; Bounds[pt][1].io:=G_CROSS::outP; pt:=(pt.int+dir1).card; end; if Bounds[pt][1].dir.is_zero then cn1:=1; else cn1:=2; end; Bounds[pt][cn1].surface:=Sn; Bounds[pt][cn1].dir:=dir1; Bounds[pt][cn1].io:=G_CROSS::inP; -- if (VERTEXC::over.in(TCode[pt].sep)= VERTEXC::negative.in(TCode[pt].sep)) then dir1:=-dir1; end; pt:=TCode[pt].companion.card; -- if Bounds[pt,1].dir=ncP then cn1:=1; else cn1:=2; end; Bounds[pt][cn1].surface:=Sn; Bounds[pt][cn1].dir:=dir1; Bounds[pt][cn1].io:=G_CROSS::outP; until!((dir0=dir1)and(pt=stp)); end; end; printBound(Bounds:ARRAY{ARRAY{G_CROSS}}) is #OUT+"suf,dir,io \n"; loop i::=0.upto!(Bounds.size-1); #OUT+Bounds[i][1].surface.str+" "+ Bounds[i][1].dir.str+" "+Bounds[i][1].io.str+":"; #OUT+Bounds[i][2].surface.str+" "+ Bounds[i][2].dir.str+" "+Bounds[i][2].io.str+":"; #OUT+"\n"; end; end; Coloring(TCode:TCODE,out Bounds:ARRAY{ARRAY{G_CROSS}},out Sn:CARD) is Bounds:=#(TCode.size); loop i::=Bounds.ind!; Bounds[i]:=#(3); Bounds[i][1]:=#; Bounds[i][2]:=#; end; Sn:=0; stp:CARD; dir0:INT; loop while!(SearchNewColor(TCode,Bounds,inout Sn,out stp,out dir0)); Bound(TCode,inout Bounds, Sn, stp,dir0); end; -- printBound; end; --------------set coded Goeritz Matrix-------------------- sMatSetEdge(TCode:TCODE, inout Graph:ARRAY{MAT_INTI},Bounds:ARRAY{ARRAY{G_CROSS}}, pt:CARD) is c,stp,enp,cn:CARD; if Bounds[pt][1].dir=1.int then cn:=1; stp:=Bounds[pt][1].surface; enp:=Bounds[pt][2].surface; else cn:=2; stp:=Bounds[pt][2].surface; enp:=Bounds[pt][1].surface; end; if Bounds[TCode[pt].companion.card][cn].dir=1.int then if VERTEXC::under.in(TCode[pt].sep) then c:=bp; else c:=bn; end; else if VERTEXC::under.in(TCode[pt].sep) then c:=ap; else c:=an; end; end; Graph[c][stp-1,enp-1]:=Graph[c][stp-1,enp-1]+1.inti; end; sMat(TCode:TCODE,out Graph:ARRAY{MAT_INTI}) is --Graph[code][i,j] is adjacent matrix -- of oriented and coded graph of the knot. -- Let A+ , A- , B+ and B- be adjacent matrices -- of code ap, an, bp and bn (resp.). -- Goeritz matrix is -- (A+) + (A+)t - (A-) - (A-)t + (B+) + (B+)t - (B-) - (B-)t: -- t is transpose. Sn:CARD; -- # of colored surface Bounds:ARRAY{ARRAY{G_CROSS}}; --[0..TCode.length][0..2] Coloring(TCode,out Bounds, out Sn); Graph:=#(mat_num); loop t::=0.upto!(mat_num-1); Graph[t]:=#(Sn,Sn); Graph[t].clear; end; loop pt::=0.upto!(TCode.length); if (Bounds[pt][1].io=G_CROSS::inP) and VERTEXC::crossing.in(TCode[pt].sep) then sMatSetEdge(TCode,inout Graph,Bounds,pt); end; end; Graph[gm]:=Graph[ap]+Graph[ap].trans-Graph[an]-Graph[an].trans +Graph[bp]+Graph[bp].trans-Graph[bn]-Graph[bn].trans; count:INTI; loop i::=0.up!;while!(i<Sn); Graph[gm][i,i]:=Graph[gm].r_0; count:=0.inti; loop j::=0.upto!(Sn-1); count:=count+Graph[gm][i,j]; end; Graph[gm][i,i]:=-count; end; end; KnotValue(TCode:TCODE) is --Goeritz Matrix and KnotValue if TCode.has_band then #OUT+"Band is not supported.\n"; return; end; Graph:ARRAY{MAT_INTI};--ARRAY[0..bp][0..GMatrixmaxC][0..GMatrixmaxC] sMat(TCode,out Graph); printGMat(Graph); gmat::=Graph[gm].copy; if gmat.nr>=2 then gmat:=gmat.resize(gmat.nr-1,gmat.nc-1); printKnotValue(gmat.det); else printKnotValue(1.inti); end; end; end;