Pensieve header: The Bedlewo and the Kashaev Programs.

Bed[K_,ω_]:=Module[{t,r,XingsByArmpits,bends,faces,p,A,is},
t=1-ω; r=t+t\[Conjugate];
XingsByArmpits=List@@PD[K]/.x:X[i_,j_,k_,l_]:>If[PositiveQ[x],(SubPlus[X])[-i,j,k,-l],(SubMinus[X])[-j,k,l,-i]];
bends=Times@@XingsByArmpits/._[X][a_,b_,c_,d_]:>(Subscript[p, a,-d])(Subscript[p, b,-a])(Subscript[p, c,-b])(Subscript[p, d,-c]);
faces=bends//.(Subscript[p, x__,y_])(Subscript[p, y_,z__]):>(Subscript[p, x,y,z]);
A=Table[0,Length@faces,Length@faces];
Do[is=Position[faces,#][[1,1]]& /@ List@@x;
A[[is,is]]+=If[Head[x]===(SubPlus[X]),
(({{-r, -t, 2 t, t\[Conjugate]}, {-t\[Conjugate], 0, t\[Conjugate], 0}, {2 t\[Conjugate], t, -r, -t\[Conjugate]}, {t, 0, -t, 0}})),(({{r, -t, -2 t\[Conjugate], t\[Conjugate]}, {-t\[Conjugate], 0, t\[Conjugate], 0}, {-2t, t, r, -t\[Conjugate]}, {t, 0, -t, 0}}))],
{x,XingsByArmpits}];
MatrixSignature[A] ];

Kas[K_,ω_]:=Module[{u,v,XingsByArmpits,bends,faces,p,A,is},
u=Re[(ω^(1/2))]; v= Re[ω];
XingsByArmpits=List@@PD[K]/.x:X[i_,j_,k_,l_]:>If[PositiveQ[x],(SubPlus[X])[-i,j,k,-l],(SubMinus[X])[-j,k,l,-i]];
bends=Times@@XingsByArmpits/._[X][a_,b_,c_,d_]:>(Subscript[p, a,-d])(Subscript[p, b,-a])(Subscript[p, c,-b])(Subscript[p, d,-c]);
faces=bends//.(Subscript[p, x__,y_])(Subscript[p, y_,z__]):>(Subscript[p, x,y,z]);
A=Table[0,Length@faces,Length@faces];
Do[is=Position[faces,#][[1,1]]& /@ List@@x;
A[[is,is]]+=If[Head[x]===(SubPlus[X]),
(({{v, u, 1, u}, {u, 1, u, 1}, {1, u, v, u}, {u, 1, u, 1}})),-(({{v, u, 1, u}, {u, 1, u, 1}, {1, u, v, u}, {u, 1, u, 1}}))],
{x,XingsByArmpits}];
(MatrixSignature[A]-Writhe[K])/2 ];

(Definition /@ {Bed,Kas}) >> "C:\\drorbn\\AcademicPensieve\\Talks\\CMS-2112\\BedAndKas.m"