fpoly.sa
Generated by gen_html_sa_files from ICSI. Contact gomes@icsi.berkeley.edu for details
class POLY3
class POLY3 is
-- Copyright (C) 1986 1996 Kouji KODAMA
-- 1998/1 LongInt version
-- 1996/10
-- LINUX version
-- 1989/8
-- Modula-2 version
-- 1986/3 Q-poly., F-poly. Basic version.
-- Compute F-polynomial & Q-polynomial
shared Alloc0:CARD;
shared Poly:ARRAY{ARRAY{INTI}}; -- [0..Alloc0][0..Alloc0*2]
shared TCodeRes:ARRAY{RTCODE}; -- [0..Alloc0*2]
shared TdRes:ARRAY{ARRAY{INT}}; -- [0..Alloc0*2] [0..4]
shared TraceDeg:ARRAY{INT}; -- [0..4] ([1..2])
shared TraceRes:ARRAY{RES_MARK}; -- [0..Alloc0*2]
shared ResFlg:ARRAY{BOOL}; -- [0..Alloc0]
shared CN,CP,CQ:ARRAY{POLYS_INTI}; -- [0..Alloc0][0..Alloc0]
shared TCodeTmp,TCodePtr,TCodePtr1:RTCODE;
shared endTc:VERTEXP;
shared i:CARD;
shared r0,r1,r2:INT;
shared o1,o2,o3:INT;
shared n,n1,n2:INT;
shared enp,stp:CARD;
shared tmp,tmpMax,tmpMp:CARD;
shared c0p,c0n,compo0,compo:INT;
shared resPtr,tPtr,tPtr1,tPtr2:CARD;
shared wr,wr0,wr1:INT;
shared tPtr3:CARD;
shared wrC:INT;
shared wPtr1,wPtr2:CARD;
shared count:CARD; -- count resolution
------------------ init ------------------
closeRes is
Poly:=#; CP:=#; CN:=#; CQ:=#;
TCodeRes:=#; TraceRes:=#; TdRes:=#; TraceDeg:=#; ResFlg:=#;
end;
initRes(TCode:TCODE, tstep, cvRes, cvTime:FLT):BOOL is
if TCode.has_band then return false; end;
c0::=0.int; c0p:=0.int; c0n:=0.int; compo0:=0.int; b0::=0.int;
TCode.numbers_count(inout c0,inout c0p,inout c0n,inout compo0,inout b0);
Alloc0:=(c0p+c0n+compo0).card;
wr0:=c0p-c0n;
POLYS_INTI::init;
Poly:=#(Alloc0+1);
loop i::=Poly.ind!;
Poly[i]:=#(Alloc0*2+1); Poly[i].to_val(0.inti);
end;
TCodeRes:=#(Alloc0*2+1); loop i::=TCodeRes.ind!; TCodeRes[i]:=#; end;
TraceRes:=#(Alloc0*2+1); loop i::=TraceRes.ind!; TraceRes[i]:=#; end;
TdRes:=#(Alloc0*2+1); loop i::=TdRes.ind!; TdRes[i]:=#(5); end;
TraceDeg:=#(5); TraceDeg.to_val(0.int);
ResFlg:=#(Alloc0*2+1); ResFlg.to_val(false);
endTc:=#;
endTc.sep:=TCode[TCode.length].sep.clone;
endTc.companion:=0.int;
tmpMax:=TCode.length;
compo:=compo0;
wr:=wr0;
TCodeTmp:=#(TCode);
POLY_TIME::out_expected_time
(RTCODE_TRIM::SCode(inout TCodeTmp, tstep, cvRes, cvTime));
tmpMax:=TCodeTmp.length;
tmp:=0;
tPtr:=0; tmp:=0;
TCodeRes[0]:=TCodeTmp;
TraceRes[tmp].p:=tPtr;
TraceRes[tmp].m:=TCodeTmp.length;
TraceRes[tmp].c:=compo;
TraceRes[tmp].w:=wr0;
TdRes[tmp]:=TraceDeg.copy;
ResFlg[tmp]:=false;
tmp:=tmp+1;
TCodeRes[tmp]:=TCodeTmp.clone;
TraceRes[tmp]:=TraceRes[tmp-1].clone;
TdRes[tmp]:=TraceDeg.copy; ResFlg[tmp]:=true;
resPtr:=tmp; TCodeTmp:=TCodeRes[tmp].clone;
count:=0;
return true;
end;
--------- resolution-------------
MakeRes201 is
n::=TCodeTmp[i].companion;
TCodePtr.k[n1.card]:=#;
if n<tPtr1.int then TCodePtr[n1].companion:= n;
elsif n<=tPtr2.int then TCodePtr[n1].companion:= n+r2;
elsif n<=enp.int then TCodePtr[n1].companion:= n-r1;
else TCodePtr[n1].companion:=n;
end;
TCodePtr[n1].sep:=TCodeTmp[i].sep;
end;
MakeRes2 is
resPtr:=resPtr+1;
TCodePtr:=#;
TCodePtr.k:=#(TCodeTmp.size);
r1:=tPtr2.int-tPtr1.int+1; r2:=enp.int-tPtr2.int;
loop i:=tPtr1.upto!(tPtr2) ; n1:=i.int+r2; MakeRes201; end;
loop i:=(tPtr2+1).upto!(enp) ; n1:=i.int-r1; MakeRes201; end;
loop i:=(enp+1).upto!(tmpMax-1); n1:=i.int; MakeRes201; end;
TCodePtr[tmpMax]:=endTc;
TCodePtr[(tPtr1.int+r2).card].sep:=VERTEXC::knot_s;
TCodePtr[(tPtr2.int+r2).card].sep:=VERTEXC::knot_e;
end;
MakeRes2T is
TCodePtr.TrimC(tPtr,(tPtr1.int+r2).card);
TCodeRes[resPtr]:=TCodePtr;
TraceRes[resPtr].p:=tPtr;
TraceRes[resPtr].m:=TCodePtr.length;
TraceRes[resPtr].c:=compo+1;
--if tmpMp<=enp then tmpRes[resPtr]:=-1;
--else tmpRes[resPtr]:=tmpMp+tmpMaxT-tmpMax;
--end;
end;
MakeRes2R01 is
n::=TCodeTmp[i].companion;
TCodePtr.k[n1.card]:=#;
if n<tPtr1.int then TCodePtr[n1.card].companion:= n;
elsif n<=tPtr2.int then TCodePtr[n1.card].companion:= r0-n;
else TCodePtr[n1.card].companion:=n-2;
end;
TCodePtr[n1.card].sep:=TCodeTmp[i].sep;
end;
MakeRes2R is
resPtr:=resPtr+1;
TCodePtr:=#;
TCodePtr.k:=#(TCodeTmp.k.size-2);
r0:=tPtr2.int+tPtr1.int-1;
loop i:=(tPtr1+1).upto!(tPtr2-1) ; n1:=r0-i.int; MakeRes2R01; end;
loop i:=(tPtr2+1).upto!(tmpMax-1) ; n1:=i.int-2; MakeRes2R01; end;
TCodePtr[tmpMax-2]:=endTc;
tPtr2:=tPtr2-2; -- Prepare for FWrithe
end;
MakeRes2RT is
TCodePtr.TrimL(tPtr,tPtr2);
TCodeRes[resPtr]:=TCodePtr;
TraceRes[resPtr].p:=tPtr;
TraceRes[resPtr].m:=TCodePtr.length;
TraceRes[resPtr].c:=compo;
--if enp>=tmpMp then tmpRes[resPtr]:=-1;
--else tmpRes[resPtr]:=tmpMp-2;
--end;
end;
MakeRes301 is
n:=TCodeTmp[i].companion;
TCodePtr.k[n1.card]:=#;
if n<tPtr1.int then TCodePtr[n1.card].companion:= n;
elsif n<stp.int then TCodePtr[n1.card].companion:= n+o1;
elsif n<tPtr2.int then TCodePtr[n1.card].companion:= n+o2;
elsif n<enp.int then TCodePtr[n1.card].companion:= n+o3;
else TCodePtr[n1.card].companion:= n-4;
end;
TCodePtr[n1.card].sep:=TCodeTmp[i].sep;
end;
MakeRes3 is
resPtr:=resPtr+1;
TCodePtr:=#; TCodePtr.k:=#(TCodeTmp.k.size-4);
r0:=stp.int-tPtr1.int-1; r1:=tPtr2.int-stp.int-1; r2:=enp.int-tPtr2.int-1;
o1:=r1+r2-1; o2:=r2-r0-2; o3:=-r0-r1-3;
loop i:=(tPtr1+1).upto!(stp-1) ; n1:=i.int+o1; MakeRes301; end;
loop i:=(stp+1).upto!(tPtr2-1) ; n1:=i.int+o2; MakeRes301; end;
loop i:=(tPtr2+1).upto!(enp-1) ; n1:=i.int+o3; MakeRes301; end;
loop i:=(enp+1).upto!(tmpMax-1) ; n1:=i.int-4; MakeRes301; end;
TCodePtr[tmpMax-4]:=endTc;
TCodePtr1:=TCodePtr;
end;
shared trimPtr3T:CARD;
shared resPtr3T:CARD;
MakeRes3TPre is
trimPtr3T:=(tPtr2.int-1+o2).card;
resPtr3T:=resPtr;
end;
MakeRes3TPost is
TCodePtr1.TrimL(tPtr, trimPtr3T);
TCodeRes[resPtr3T]:=TCodePtr1;
TraceRes[resPtr3T].p:=tPtr;
TraceRes[resPtr3T].m:=TCodePtr1.length;
TraceRes[resPtr3T].c:=compo-1;
-- if enp>=tmpMp then tmpRes[resPtr]:=-1;
--else tmpRes[resPtr]:=tmpMp-4;
--end;
end;
MakeRes3R01 is
n::=TCodePtr1[i].companion;
TCodePtr.k[n1.card]:=#;
if n<tPtr1.int then TCodePtr[n1.card].companion:= n;
elsif n<=tPtr2.int then TCodePtr[n1.card].companion:= r0-n;
else TCodePtr[n1.card].companion:=n;
end;
TCodePtr[n1.card].sep:=TCodePtr1[i].sep;
end;
MakeRes3R is
resPtr:=resPtr+1;
TCodePtr:=#;
TCodePtr.k:=#(TCodeTmp.k.size-4);
tPtr2:=(tPtr1.int+r1+r2-1).card; r0:=tPtr1.int+tPtr2.int; -- tPtr2: prepare for FWrithe
loop i:=(tPtr1).upto!(tPtr2) ; n1:=r0-i.int; MakeRes3R01; end;
loop i:=(tPtr2+1).upto!(tmpMax-5) ; n1:=i.int; MakeRes3R01; end;
TCodePtr[tmpMax-4]:=endTc;
end;
MakeRes3RT is
TCodePtr.TrimL(tPtr,tPtr2);
TCodeRes[resPtr]:=TCodePtr;
TraceRes[resPtr].p:=tPtr;
TraceRes[resPtr].m:=TCodePtr.length;
TraceRes[resPtr].c:=compo-1;
-- if enp>=tmpMp then tmpRes[resPtr]:=-1;
--else tmpRes[resPtr]:=tmpMp-4;
--end;
end;
SetMp is
if tmpMp>tPtr then
flg:BOOL:=~VERTEXC::ks.in(TCodeTmp[tmpMp].sep);
chf:ARRAY{BOOL}:=#(TCodeTmp.size);
loop i:=tmpMp.upto!(tmpMax-1) ; chf[i]:=flg; end;
tmpMp:=tmpMp-1;
loop while!((tmpMp>=tPtr)and(tmpMp>0)) ;
if TCodeTmp[tmpMp].companion<(tmpMp.int+2) then
chf[tmpMp]:=true; tmpMp:=tmpMp-1;
else
tPtr1:=TCodeTmp[tmpMp].companion.card;
if chf[tPtr1] then
loop i:=tmpMp.upto!(tPtr1); chf[i]:=false; end;
tmpMp:=tmpMp-1;
elsif VERTEXC::over.in(TCodeTmp[tmpMp].sep) then
tmpMp:=tmpMp-1;
elsif VERTEXC::ks.in(TCodeTmp[tmpMp].sep) then
loop i:=tmpMp.upto!(tPtr1); chf[i]:=false; end;
tmpMp:=tmpMp-2;
else tmpMp:=tmpMp+1; return;
end;
end;
end;
end;
end;
SetMpC is
stp:=tmpMax;
loop enp:=stp-1; stp:=TCodeTmp[enp].companion.card;
until!(stp<=tPtr);
end;
tmpMp:=enp+1;
if tmpMp=tmpMax then tmpMp:=tmpMax-4; end;
SetMp;
end;
SetMpCn is
stp:=tmpMax;
loop enp:=stp-1; stp:=TCodeTmp[enp].companion.card;
until!(stp<=tPtr);
end;
stp:=enp+1; tPtr:=stp; -- head of a compo.
-- TCodeTmp.TrimDelPC(tPtr);
-- TCodeTmp.TrimRotOV(inout tPtr);
tmpMax:=TCodeTmp.length;
tmpMp:=TCodeTmp[stp].companion.card+1;
if tmpMp=tmpMax then tmpMp:=tmpMax-4; end;
SetMp;
assert (tmpMax=TCodeTmp.length);
end;
SetNotWell:BOOL is
loop
if (tPtr>=tmpMp) then return false;
--if TCodeTmp[tmpMax-1].companion<=tPtr then return false; end;
--SetMpCn;
elsif ((tPtr+2) < TCodeTmp[tPtr].companion.card)
and (VERTEXC::under.in(TCodeTmp[tPtr].sep)) then return true;
elsif VERTEXC::ks.in(TCodeTmp[tPtr].sep) then
TCodeTmp.TrimDelPC(tPtr);
TCodeTmp.TrimRotOV(inout tPtr);
-- TCodeTmp.TrimC(tPtr);
tmpMax:=TCodeTmp.length.card;
tmpMp:=tmpMax-4;
SetMp;
assert (tmpMax=TCodeTmp.length);
end;
tPtr:=tPtr+1;
end;
end;
SetTCodeTmp is
loop while!(ResFlg[resPtr]); resPtr:=resPtr-1; end;
tmp:=resPtr;
TraceDeg:=TdRes[tmp].copy; ResFlg[tmp]:=true;
tPtr:=TraceRes[tmp].p;
tmpMax:=TraceRes[tmp].m;
compo:=TraceRes[tmp].c;
wr:=TraceRes[tmp].w;
TCodeTmp:=TCodeRes[tmp].clone(tPtr);
--if compo=1 then
-- DelPC;
--end;
assert (tmpMax=TCodeTmp.length);
end;
end; -- class POLY3
class FPOLY
class FPOLY is
--------------------------F.poly------------------
-- f_{L+} + f_{L-} = x ( f_{L0} + f_{Ls} ).
--
-- f(trivial knot) := a^(wr).
--
-- F_L := f_L * a^(-wr0).
include POLY3;
-- exg=VERTEXC{minus,plus};
-- exg2=VERTEXC{under,over,minus,plus};
-- un=VERTEXC{under,minus,crossing};
-- up=VERTEXC{under,plus,crossing};
-- on=VERTEXC{over,minus,crossing};
-- op=VERTEXC{over,plus,crossing};
FWrithe is
-- Assume that tPtr1<tPtr2.
loop i::=tPtr1.upto!(tPtr2);
j::=TCodePtr[i].companion.card;
if j<tPtr1 then
if VERTEXC::positive.in(TCodePtr[i].sep) then wr1:=wr1-2;
else wr1:=wr1+2;
end;
TCodePtr[i].sep:=TCodePtr[i].sep.xor(VERTEXC::cross_exs);
elsif j>tPtr2 then
if VERTEXC::positive.in(TCodePtr[i].sep) then wr1:=wr1-2;
else wr1:=wr1+2;
end;
TCodePtr[j].sep:=TCodePtr[j].sep.xor(VERTEXC::cross_exs);
TCodePtr[i].sep:=TCodePtr[i].sep.xor(VERTEXC::cross_exs);
end;
end;
TraceRes[resPtr].w:=wr1;
end;
MakeRes is
tPtr1:=tPtr; tPtr2:=TCodeTmp[tPtr].companion.card;
cod0::=TCodeTmp[tPtr].sep;
if VERTEXC::positive.in(cod0) then
wr1:=wr-1; TCodeTmp[tPtr2].sep:=VERTEXC::cross_nu;
wr:=wr-2;
else
wr1:=wr+1; TCodeTmp[tPtr2].sep:=VERTEXC::cross_pu;
wr:=wr+2;
end;
stp:=tmpMax;
loop enp:=stp-1; stp:=TCodeTmp[enp].companion.card; until!(stp<=tPtr2); end;
if stp<tPtr1 then
MakeRes2; TraceRes[resPtr].w:=wr1; MakeRes2T;
TdRes[resPtr]:=TraceDeg.copy;
TdRes[resPtr][2]:=TdRes[resPtr][2]+1;
ResFlg[resPtr]:=false;
MakeRes2R; FWrithe; MakeRes2RT;
TdRes[resPtr]:=TdRes[resPtr-1]; ResFlg[resPtr]:=false;
else
MakeRes3; TraceRes[resPtr].w:=wr1; MakeRes3TPre;
TdRes[resPtr]:=TraceDeg.copy;
TdRes[resPtr][2]:=TdRes[resPtr][2]+1;
ResFlg[resPtr]:=false;
MakeRes3R; FWrithe; MakeRes3RT;
MakeRes3TPost;
TdRes[resPtr]:=TdRes[resPtr-1]; ResFlg[resPtr]:=false;
end;
TraceDeg[1]:=TraceDeg[1]+1; tPtr:=tPtr+1;
end;
SetPoly is
degX:INT:=(TraceDeg[2]+compo0-1); -- shifted compo0-1
wrC::=(wr+Alloc0.int).card; -- shifted Alloc0
case compo
when 1.int then
if TraceDeg[1].is_odd then
Poly[degX][wrC]:=Poly[degX][wrC]-1.inti;
else Poly[degX][wrC]:=Poly[degX][wrC]+1.inti;
end;
when 2.int then
if TraceDeg[1].is_odd then
Poly[degX][wrC]:=Poly[degX][wrC]+1.inti;
Poly[degX-1][wrC+1]:=Poly[degX-1][wrC+1]-1.inti;
Poly[degX-1][wrC-1]:=Poly[degX-1][wrC-1]-1.inti;
else
Poly[degX][wrC]:=Poly[degX][wrC]-1.inti;
Poly[degX-1][wrC+1]:=Poly[degX-1][wrC+1]+1.inti;
Poly[degX-1][wrC-1]:=Poly[degX-1][wrC-1]+1.inti;
end;
when 3.int then
if TraceDeg[1].is_odd then
Poly[degX][wrC]:=Poly[degX][wrC]-1.inti;
degX:=degX-1;
Poly[degX][wrC+1]:=Poly[degX][wrC+1]+2.inti;
Poly[degX][wrC-1]:=Poly[degX][wrC-1]+2.inti;
degX:=degX-1;
Poly[degX][wrC+2]:=Poly[degX][wrC+2]-1.inti;
Poly[degX][wrC]:=Poly[degX][wrC]-2.inti;
Poly[degX][wrC-2]:=Poly[degX][wrC-2]-1.inti;
else
Poly[degX][wrC]:=Poly[degX][wrC]+1.inti;
degX:=degX-1;
Poly[degX][wrC+1]:=Poly[degX][wrC+1]-2.inti;
Poly[degX][wrC-1]:=Poly[degX][wrC-1]-2.inti;
degX:=degX-1;
Poly[degX][wrC+2]:=Poly[degX][wrC+2]+1.inti;
Poly[degX][wrC]:=Poly[degX][wrC]+2.inti;
Poly[degX][wrC-2]:=Poly[degX][wrC-2]+1.inti;
end;
else
degC:CARD:=compo.card-1;
if TraceDeg[1].is_odd then
loop i:=0.upto!(degC);
degA:CARD:=wrC-i; cn::=CN[degC][i];
loop j::=0.upto!(i);
Poly[degX][degA]:=Poly[degX][degA]-cn*CP[i][j];
degA:=degA+2;
end;
degX:=degX-1;
end;
else
loop i:=0.upto!(degC);
degA::=wrC-i; cn::=CN[degC][i];
loop j::=0.upto!(i);
Poly[degX][degA]:=Poly[degX][degA]+cn*CP[i][j];
degA:=degA+2;
end;
degX:=degX-1;
end;
end;
end;
end;
FPrint is
count:CARD;
flg,flg2:BOOL;
flg1,flgSt:BOOL;
wofs:INT;
wofs:=wr0; -- wofs= 0:f-poly, wr0:F-poly
wofs:=wofs+Alloc0;
LOGOUT::Title("F-polynomial:" ,
"f_{L+}+f_{L-} = x*(f_{L0}+f_{L\infty}), "
"F_L = a^{-w(L)}*f_L");
flg:=false;
cw::=0.inti;
loop i::=Poly.ind!;
degX:INT:=i.int+1-compo0; count:=0;
loop j::=Poly[i].ind!;
if Poly[i][j].is_non_zero then count:=count+1; end;
end;
if count=1 then
loop j::=Poly[i].ind!;
if Poly[i][j].is_non_zero then
#LOGOUT+POLY_WRITE::wrCoeff(Poly[i][j],inout flg,out flgSt);
#LOGOUT+POLY_WRITE::wrVar("a",j.int-wofs,false,inout flgSt);
#LOGOUT+POLY_WRITE::wrVar("x",degX,true,inout flgSt);
end;
end;
#LOGOUT+"\n";
elsif count>1 then
cw:=1.inti;
#LOGOUT+POLY_WRITE::wrCoeff(cw,inout flg, out flgSt);
#LOGOUT+POLY_WRITE::wrVar("x",degX,false,inout flgSt);
if flgSt then #LOGOUT+"*"; end;
#LOGOUT+"(";
flg2:=false;
loop j::=Poly[i].ind!;
if Poly[i][j].is_non_zero then
#LOGOUT+POLY_WRITE::wrCoeff(Poly[i][j],inout flg2,out flgSt);
#LOGOUT+POLY_WRITE::wrVar("a",j.int-wofs,true,inout flgSt);
end;
end;
#LOGOUT+")\n";
end;
end;
#LOGOUT+"\n"; LOGOUT::flush;
end;
Fpoly(TCode:TCODE) is
count:=0;
if ~ initRes(TCode,1.402, 0.17, POLY_TIME::rateCl*0.97) then
closeRes; return;
end;
time:TIME_MEASURE:=#;
CP:=POLY_COEFF::AllocCP(Alloc0);
CN:=POLY_COEFF::AllocCN(Alloc0);
loop while!(resPtr>0);
count:=count+1;
-- if tmpRes[tmp]<0 then tmpMp:=tmpMax-4; SetMp;
--else tmpMp:=tmpRes[tmp];
--end;
tmpMp:=tmpMax-4; SetMp;
-- SetMpC;
loop while!(SetNotWell); MakeRes; end;
SetPoly; SetTCodeTmp;
end;
-- WriteWrap; WriteLn;
POLY_TIME::SetR(count.flt,"FPoly");
-- WriteCount;
FPrint;
closeRes;
end;
end; -- class FPOLY
class QPOLY
class QPOLY is
include POLY3;
----------------------Q.poly---------------------
MakeRes is
tPtr1:=tPtr; tPtr2:=TCodeTmp[tPtr].companion.card;
stp:=tmpMax;
loop enp:=stp-1; stp:=TCodeTmp[enp].companion.card; until!(stp<=tPtr2); end;
if stp<tPtr1 then
MakeRes2; MakeRes2T;
TdRes[resPtr]:=TraceDeg.copy;
TdRes[resPtr][2]:=TdRes[resPtr][2]+1;
ResFlg[resPtr]:=false;
MakeRes2R; MakeRes2RT;
TdRes[resPtr]:=TdRes[resPtr-1].copy; ResFlg[resPtr]:=false;
else
MakeRes3; MakeRes3TPre; -- MakeRes3T
TdRes[resPtr]:=TraceDeg.copy;
TdRes[resPtr][2]:=TdRes[resPtr][2]+1;
ResFlg[resPtr]:=false;
MakeRes3R; MakeRes3RT;
MakeRes3TPost;
TdRes[resPtr]:=TdRes[resPtr-1].copy; ResFlg[resPtr]:=false;
end;
TraceDeg[1]:=TraceDeg[1]+1; tPtr:=tPtr+1;
end;
SetPoly(inout PolyQ:ARRAY{INTI}) is
degX:CARD:=(TraceDeg[2]-compo+compo0).card;
if compo=1.int then
if TraceDeg[1].is_odd then PolyQ[degX]:=PolyQ[degX]-1.inti;
else PolyQ[degX]:=PolyQ[degX]+1.inti;
end;
else
degC:CARD:=compo.card-1;
if (TraceDeg[1]+degC).is_odd then
loop i::=0.upto!(degC); j::=degX.up!;
PolyQ[j]:=PolyQ[j]-CQ[degC][i];
end;
else
loop i::=0.upto!(degC); j::=degX.up!;
PolyQ[j]:=PolyQ[j]+CQ[degC][i];
end;
end;
end;
end;
QPrint(PolyQ:ARRAY{INTI}) is
x:INT;
flg,flgSt:BOOL;
LOGOUT::Title("Q-polynomial:",
"Q_{L+} + Q_{L-} = x*(Q_{L0} + Q_{L\infty})");
flg:=false;
loop x1::=PolyQ.ind!; -- upto!(Alloc0)
x:=x1.int-compo0+1;
if PolyQ[x1].is_non_zero then
#LOGOUT+POLY_WRITE::wrCoeff(PolyQ[x1],inout flg,out flgSt);
#LOGOUT+POLY_WRITE::wrVar("x",x,true,inout flgSt);
end;
end;
#LOGOUT+"\n"; LOGOUT::flush;
end;
Qpoly(TCode:TCODE) is
count:=0;
-- 1.400..1.402
if ~initRes(TCode,1.402, 0.17 ,POLY_TIME::rateCl*1.08) then
closeRes; return;
end;
time:TIME_MEASURE:=#;
PolyQ:ARRAY{INTI}:=#(Alloc0);
loop i::=PolyQ.ind!; PolyQ[i]:=0.inti; end;
CQ:=POLY_COEFF::AllocCQ(Alloc0);
loop while!(resPtr>0);
count:=count+1;
tmpMp:=tmpMax-4; SetMp;
loop while!(SetNotWell) ; MakeRes; end;
SetPoly(inout PolyQ);
SetTCodeTmp;
end;
-- WriteWrap; WriteLn;
POLY_TIME::SetR(count.flt,"QPoly");
QPrint(PolyQ);
closeRes;
end;
end; -- class QPOLY