version 1.2, 2000/08/21 08:31:40 |
version 1.11, 2000/12/15 01:52:36 |
|
|
* shall be made on your publication or presentation in any form of the |
* shall be made on your publication or presentation in any form of the |
* results obtained by use of the SOFTWARE. |
* results obtained by use of the SOFTWARE. |
* (4) In the event that you modify the SOFTWARE, you shall notify FLL by |
* (4) In the event that you modify the SOFTWARE, you shall notify FLL by |
* e-mail at risa-admin@flab.fujitsu.co.jp of the detailed specification |
* e-mail at risa-admin@sec.flab.fujitsu.co.jp of the detailed specification |
* for such modification or the source code of the modified part of the |
* for such modification or the source code of the modified part of the |
* SOFTWARE. |
* SOFTWARE. |
* |
* |
|
|
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* |
* |
* $OpenXM: OpenXM_contrib2/asir2000/lib/bfct,v 1.1 2000/06/05 04:59:34 noro Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/lib/bfct,v 1.10 2000/12/15 01:34:31 noro Exp $ |
*/ |
*/ |
/* requires 'primdec' */ |
/* requires 'primdec' */ |
|
|
/* annihilating ideal of F^s ? */ |
/* annihilating ideal of F^s */ |
|
|
def ann(F) |
def ann(F) |
{ |
{ |
V = vars(F); |
V = vars(F); |
W = append([y1,y2,t],V); |
|
N = length(V); |
N = length(V); |
B = [1-y1*y2,t-y1*F]; |
D = newvect(N); |
|
|
|
for ( I = 0; I < N; I++ ) |
|
D[I] = [deg(F,V[I]),V[I]]; |
|
qsort(D,compare_first); |
|
for ( V = [], I = N-1; I >= 0; I-- ) |
|
V = cons(D[I][1],V); |
|
|
for ( I = N-1, DV = []; I >= 0; I-- ) |
for ( I = N-1, DV = []; I >= 0; I-- ) |
DV = cons(strtov("d"+rtostr(V[I])),DV); |
DV = cons(strtov("d"+rtostr(V[I])),DV); |
|
|
|
W = append([y1,y2,t],V); |
DW = append([dy1,dy2,dt],DV); |
DW = append([dy1,dy2,dt],DV); |
|
|
|
B = [1-y1*y2,t-y1*F]; |
for ( I = 0; I < N; I++ ) { |
for ( I = 0; I < N; I++ ) { |
B = cons(DV[I]+y1*diff(F,V[I])*dt,B); |
B = cons(DV[I]+y1*diff(F,V[I])*dt,B); |
} |
} |
ctrl("do_weyl",1); |
|
|
/* homogenized (heuristics) */ |
dp_nelim(2); |
dp_nelim(2); |
G0 = dp_gr_main(B,append(W,DW),0,0,6); |
G0 = dp_weyl_gr_main(B,append(W,DW),1,0,6); |
G1 = []; |
G1 = []; |
for ( T = G0; T != []; T = cdr(T) ) { |
for ( T = G0; T != []; T = cdr(T) ) { |
E = car(T); VL = vars(E); |
E = car(T); VL = vars(E); |
|
|
G2 = map(subst,G1,dt,1); |
G2 = map(subst,G1,dt,1); |
G3 = map(b_subst,G2,t); |
G3 = map(b_subst,G2,t); |
G4 = map(subst,G3,t,-1-s); |
G4 = map(subst,G3,t,-1-s); |
ctrl("do_weyl",0); |
|
return G4; |
return G4; |
} |
} |
|
|
/* b-function of F ? */ |
/* |
|
* compute J_f|s=r, where r = the minimal integral root of global b_f(s) |
|
* ann0(F) returns [MinRoot,Ideal] |
|
*/ |
|
|
def bfct(F) |
def ann0(F) |
{ |
{ |
G4 = ann(F); |
|
|
|
ctrl("do_weyl",1); |
|
V = vars(F); |
V = vars(F); |
N = length(V); |
N = length(V); |
|
D = newvect(N); |
|
|
|
for ( I = 0; I < N; I++ ) |
|
D[I] = [deg(F,V[I]),V[I]]; |
|
qsort(D,compare_first); |
|
for ( V = [], I = 0; I < N; I++ ) |
|
V = cons(D[I][1],V); |
|
|
for ( I = N-1, DV = []; I >= 0; I-- ) |
for ( I = N-1, DV = []; I >= 0; I-- ) |
DV = cons(strtov("d"+rtostr(V[I])),DV); |
DV = cons(strtov("d"+rtostr(V[I])),DV); |
|
|
N1 = 2*(N+1); |
/* XXX : heuristics */ |
|
W = append([y1,y2,t],reverse(V)); |
|
DW = append([dy1,dy2,dt],reverse(DV)); |
|
WDW = append(W,DW); |
|
|
M = newmat(N1+1,N1); |
B = [1-y1*y2,t-y1*F]; |
for ( J = N+1; J < N1; J++ ) |
for ( I = 0; I < N; I++ ) { |
M[0][J] = 1; |
B = cons(DV[I]+y1*diff(F,V[I])*dt,B); |
for ( J = 0; J < N+1; J++ ) |
} |
M[1][J] = 1; |
|
#if 0 |
/* homogenized (heuristics) */ |
for ( I = 0; I < N+1; I++ ) |
dp_nelim(2); |
M[I+2][N-I] = -1; |
G0 = dp_weyl_gr_main(B,WDW,1,0,6); |
|
G1 = []; |
|
for ( T = G0; T != []; T = cdr(T) ) { |
|
E = car(T); VL = vars(E); |
|
if ( !member(y1,VL) && !member(y2,VL) ) |
|
G1 = cons(E,G1); |
|
} |
|
G2 = map(subst,G1,dt,1); |
|
G3 = map(b_subst,G2,t); |
|
G4 = map(subst,G3,t,-1-s); |
|
|
|
/* G4 = J_f(s) */ |
|
|
|
V1 = cons(s,V); DV1 = cons(ds,DV); V1DV1 = append(V1,DV1); |
|
G5 = dp_weyl_gr_main(cons(F,G4),V1DV1,0,1,0); |
|
Bf = weyl_minipoly(G5,V1DV1,0,s); |
|
|
|
FList = cdr(fctr(Bf)); |
|
for ( T = FList, Min = 0; T != []; T = cdr(T) ) { |
|
LF = car(car(T)); |
|
Root = -coef(LF,0)/coef(LF,1); |
|
if ( dn(Root) == 1 && Root < Min ) |
|
Min = Root; |
|
} |
|
return [Min,map(subst,G4,s,Min)]; |
|
} |
|
|
|
def indicial1(F,V) |
|
{ |
|
W = append([y1,t],V); |
|
N = length(V); |
|
B = [t-y1*F]; |
|
for ( I = N-1, DV = []; I >= 0; I-- ) |
|
DV = cons(strtov("d"+rtostr(V[I])),DV); |
|
DW = append([dy1,dt],DV); |
|
for ( I = 0; I < N; I++ ) { |
|
B = cons(DV[I]+y1*diff(F,V[I])*dt,B); |
|
} |
|
dp_nelim(1); |
|
|
|
/* homogenized (heuristics) */ |
|
G0 = dp_weyl_gr_main(B,append(W,DW),1,0,6); |
|
G1 = map(subst,G0,y1,1); |
|
Mat = newmat(2,2,[[-1,1],[0,1]]); |
|
G2 = map(psi,G1,t,dt); |
|
G3 = map(subst,G2,t,-s-1); |
|
return G3; |
|
} |
|
|
|
def psi(F,T,DT) |
|
{ |
|
D = dp_ptod(F,[T,DT]); |
|
Wmax = weight(D); |
|
D1 = dp_rest(D); |
|
for ( ; D1; D1 = dp_rest(D1) ) |
|
if ( weight(D1) > Wmax ) |
|
Wmax = weight(D1); |
|
for ( D1 = D, Dmax = 0; D1; D1 = dp_rest(D1) ) |
|
if ( weight(D1) == Wmax ) |
|
Dmax += dp_hm(D1); |
|
if ( Wmax >= 0 ) |
|
Dmax = dp_weyl_mul(<<Wmax,0>>,Dmax); |
|
else |
|
Dmax = dp_weyl_mul(<<0,-Wmax>>,Dmax); |
|
Rmax = dp_dtop(Dmax,[T,DT]); |
|
R = b_subst(subst(Rmax,DT,1),T); |
|
return R; |
|
} |
|
|
|
def weight(D) |
|
{ |
|
V = dp_etov(D); |
|
return V[1]-V[0]; |
|
} |
|
|
|
def compare_first(A,B) |
|
{ |
|
A0 = car(A); |
|
B0 = car(B); |
|
if ( A0 > B0 ) |
|
return 1; |
|
else if ( A0 < B0 ) |
|
return -1; |
|
else |
|
return 0; |
|
} |
|
|
|
/* b-function of F ? */ |
|
|
|
def bfct(F) |
|
{ |
|
V = vars(F); |
|
N = length(V); |
|
D = newvect(N); |
|
|
for ( I = 0; I < N; I++ ) |
for ( I = 0; I < N; I++ ) |
M[I+2+N+1][N1-1-I] = -1; |
D[I] = [deg(F,V[I]),V[I]]; |
#elif 1 |
qsort(D,compare_first); |
for ( I = 0; I < N1-1; I++ ) |
for ( V = [], I = 0; I < N; I++ ) |
M[I+2][N1-I-1] = 1; |
V = cons(D[I][1],V); |
#else |
for ( I = N-1, DV = []; I >= 0; I-- ) |
for ( I = 0; I < N1-1; I++ ) |
DV = cons(strtov("d"+rtostr(V[I])),DV); |
M[I+2][I] = 1; |
|
#endif |
|
V1 = cons(s,V); DV1 = cons(ds,DV); |
V1 = cons(s,V); DV1 = cons(ds,DV); |
G5 = dp_gr_main(cons(F,G4),append(V1,DV1),0,0,M); |
|
for ( T = G5, G6 = []; T != []; T = cdr(T) ) { |
G0 = indicial1(F,reverse(V)); |
E = car(T); |
G1 = dp_weyl_gr_main(G0,append(V1,DV1),0,1,0); |
if ( intersection(vars(E),DV1) == [] ) |
Minipoly = weyl_minipoly(G1,append(V1,DV1),0,s); |
G6 = cons(E,G6); |
return Minipoly; |
|
} |
|
|
|
def weyl_minipolym(G,V,O,M,V0) |
|
{ |
|
N = length(V); |
|
Len = length(G); |
|
dp_ord(O); |
|
setmod(M); |
|
PS = newvect(Len); |
|
PS0 = newvect(Len); |
|
|
|
for ( I = 0, T = G; T != []; T = cdr(T), I++ ) |
|
PS0[I] = dp_ptod(car(T),V); |
|
for ( I = 0, T = G; T != []; T = cdr(T), I++ ) |
|
PS[I] = dp_mod(dp_ptod(car(T),V),M,[]); |
|
|
|
for ( I = Len - 1, GI = []; I >= 0; I-- ) |
|
GI = cons(I,GI); |
|
|
|
U = dp_mod(dp_ptod(V0,V),M,[]); |
|
|
|
T = dp_mod(<<0>>,M,[]); |
|
TT = dp_mod(dp_ptod(1,V),M,[]); |
|
G = H = [[TT,T]]; |
|
|
|
for ( I = 1; ; I++ ) { |
|
T = dp_mod(<<I>>,M,[]); |
|
|
|
TT = dp_weyl_nf_mod(GI,dp_weyl_mul_mod(TT,U,M),PS,1,M); |
|
H = cons([TT,T],H); |
|
L = dp_lnf_mod([TT,T],G,M); |
|
if ( !L[0] ) |
|
return dp_dtop(L[1],[V0]); |
|
else |
|
G = insert(G,L); |
} |
} |
ctrl("do_weyl",0); |
} |
G6_0 = remove_zero(map(z_subst,G6,V)); |
|
F0 = flatmf(cdr(fctr(dp_gr_main(G6_0,[s],0,0,0)[0]))); |
def weyl_minipoly(G0,V0,O0,V) |
for ( T = F0, BF = []; T != []; T = cdr(T) ) { |
{ |
FI = car(T); |
HM = hmlist(G0,V0,O0); |
for ( J = 1; ; J++ ) { |
for ( I = 0; ; I++ ) { |
S = map(srem,map(z_subst,idealquo(G6,[FI^J],V1,0),V),FI); |
Prime = lprime(I); |
for ( ; S != [] && !car(S); S = cdr(S) ); |
if ( !valid_modulus(HM,Prime) ) |
if ( S != [] ) |
continue; |
|
MP = weyl_minipolym(G0,V0,O0,Prime,V); |
|
for ( D = deg(MP,V), TL = [], J = 0; J <= D; J++ ) |
|
TL = cons(V^J,TL); |
|
dp_ord(O0); |
|
NF = weyl_gennf(G0,TL,V0,O0)[0]; |
|
|
|
LHS = weyl_nf_tab(-car(TL),NF,V0); |
|
B = weyl_hen_ttob(cdr(TL),NF,LHS,V0,Prime); |
|
if ( B ) { |
|
R = ptozp(B[1]*car(TL)+B[0]); |
|
return R; |
|
} |
|
} |
|
} |
|
|
|
def weyl_gennf(G,TL,V,O) |
|
{ |
|
N = length(V); Len = length(G); dp_ord(O); PS = newvect(Len); |
|
for ( I = 0, T = G, HL = []; T != []; T = cdr(T), I++ ) { |
|
PS[I] = dp_ptod(car(T),V); HL = cons(dp_ht(PS[I]),HL); |
|
} |
|
for ( I = 0, DTL = []; TL != []; TL = cdr(TL) ) |
|
DTL = cons(dp_ptod(car(TL),V),DTL); |
|
for ( I = Len - 1, GI = []; I >= 0; I-- ) |
|
GI = cons(I,GI); |
|
T = car(DTL); DTL = cdr(DTL); |
|
H = [weyl_nf(GI,T,T,PS)]; |
|
|
|
T0 = time()[0]; |
|
while ( DTL != [] ) { |
|
T = car(DTL); DTL = cdr(DTL); |
|
if ( dp_gr_print() ) |
|
print(".",2); |
|
if ( L = search_redble(T,H) ) { |
|
DD = dp_subd(T,L[1]); |
|
NF = weyl_nf(GI,dp_weyl_mul(L[0],dp_subd(T,L[1])),dp_hc(L[1])*T,PS); |
|
} else |
|
NF = weyl_nf(GI,T,T,PS); |
|
NF = remove_cont(NF); |
|
H = cons(NF,H); |
|
} |
|
print(""); |
|
TNF = time()[0]-T0; |
|
if ( dp_gr_print() ) |
|
print("gennf(TAB="+rtostr(TTAB)+" NF="+rtostr(TNF)+")"); |
|
return [H,PS,GI]; |
|
} |
|
|
|
def weyl_nf(B,G,M,PS) |
|
{ |
|
for ( D = 0; G; ) { |
|
for ( U = 0, L = B; L != []; L = cdr(L) ) { |
|
if ( dp_redble(G,R=PS[car(L)]) > 0 ) { |
|
GCD = igcd(dp_hc(G),dp_hc(R)); |
|
CG = idiv(dp_hc(R),GCD); CR = idiv(dp_hc(G),GCD); |
|
U = CG*G-dp_weyl_mul(CR*dp_subd(G,R),R); |
|
if ( !U ) |
|
return [D,M]; |
|
D *= CG; M *= CG; |
break; |
break; |
|
} |
} |
} |
BF = cons([FI,J],BF); |
if ( U ) |
|
G = U; |
|
else { |
|
D += dp_hm(G); G = dp_rest(G); |
|
} |
} |
} |
return BF; |
return [D,M]; |
|
} |
|
|
|
def weyl_nf_mod(B,G,PS,Mod) |
|
{ |
|
for ( D = 0; G; ) { |
|
for ( U = 0, L = B; L != []; L = cdr(L) ) { |
|
if ( dp_redble(G,R=PS[car(L)]) > 0 ) { |
|
CR = dp_hc(G)/dp_hc(R); |
|
U = G-dp_weyl_mul_mod(CR*dp_mod(dp_subd(G,R),Mod,[]),R,Mod); |
|
if ( !U ) |
|
return D; |
|
break; |
|
} |
|
} |
|
if ( U ) |
|
G = U; |
|
else { |
|
D += dp_hm(G); G = dp_rest(G); |
|
} |
|
} |
|
return D; |
|
} |
|
|
|
def weyl_hen_ttob(T,NF,LHS,V,MOD) |
|
{ |
|
T0 = time()[0]; M = etom(weyl_leq_nf(T,NF,LHS,V)); TE = time()[0] - T0; |
|
T0 = time()[0]; U = henleq(M,MOD); TH = time()[0] - T0; |
|
if ( dp_gr_print() ) { |
|
print("(etom="+rtostr(TE)+" hen="+rtostr(TH)+")"); |
|
} |
|
return U ? vtop(T,U,LHS) : 0; |
|
} |
|
|
|
def weyl_leq_nf(TL,NF,LHS,V) |
|
{ |
|
TLen = length(NF); |
|
T = newvect(TLen); M = newvect(TLen); |
|
for ( I = 0; I < TLen; I++ ) { |
|
T[I] = dp_ht(NF[I][1]); |
|
M[I] = dp_hc(NF[I][1]); |
|
} |
|
Len = length(TL); INDEX = newvect(Len); COEF = newvect(Len); |
|
for ( L = TL, J = 0; L != []; L = cdr(L), J++ ) { |
|
D = dp_ptod(car(L),V); |
|
for ( I = 0; I < TLen; I++ ) |
|
if ( D == T[I] ) |
|
break; |
|
INDEX[J] = I; COEF[J] = strtov("u"+rtostr(J)); |
|
} |
|
if ( !LHS ) { |
|
COEF[0] = 1; NM = 0; DN = 1; |
|
} else { |
|
NM = LHS[0]; DN = LHS[1]; |
|
} |
|
for ( J = 0, S = -NM; J < Len; J++ ) { |
|
DNJ = M[INDEX[J]]; |
|
GCD = igcd(DN,DNJ); CS = DNJ/GCD; CJ = DN/GCD; |
|
S = CS*S + CJ*NF[INDEX[J]][0]*COEF[J]; |
|
DN *= CS; |
|
} |
|
for ( D = S, E = []; D; D = dp_rest(D) ) |
|
E = cons(dp_hc(D),E); |
|
BOUND = LHS ? 0 : 1; |
|
for ( I = Len - 1, W = []; I >= BOUND; I-- ) |
|
W = cons(COEF[I],W); |
|
return [E,W]; |
|
} |
|
|
|
def weyl_nf_tab(A,NF,V) |
|
{ |
|
TLen = length(NF); |
|
T = newvect(TLen); M = newvect(TLen); |
|
for ( I = 0; I < TLen; I++ ) { |
|
T[I] = dp_ht(NF[I][1]); |
|
M[I] = dp_hc(NF[I][1]); |
|
} |
|
A = dp_ptod(A,V); |
|
for ( Z = A, Len = 0; Z; Z = dp_rest(Z), Len++ ); |
|
INDEX = newvect(Len); COEF = newvect(Len); |
|
for ( Z = A, J = 0; Z; Z = dp_rest(Z), J++ ) { |
|
D = dp_ht(Z); |
|
for ( I = 0; I < TLen; I++ ) |
|
if ( D == T[I] ) |
|
break; |
|
INDEX[J] = I; COEF[J] = dp_hc(Z); |
|
} |
|
for ( J = 0, S = 0, DN = 1; J < Len; J++ ) { |
|
DNJ = M[INDEX[J]]; |
|
GCD = igcd(DN,DNJ); CS = DNJ/GCD; CJ = DN/GCD; |
|
S = CS*S + CJ*NF[INDEX[J]][0]*COEF[J]; |
|
DN *= CS; |
|
} |
|
return [S,DN]; |
} |
} |
|
|
def remove_zero(L) |
def remove_zero(L) |