version 1.13, 2000/12/27 07:17:39 |
version 1.18, 2002/01/28 02:42:27 |
|
|
* 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.12 2000/12/15 07:15:18 noro Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/lib/bfct,v 1.17 2002/01/28 01:02:03 noro Exp $ |
*/ |
*/ |
/* requires 'primdec' */ |
/* requires 'primdec' */ |
|
|
Line 212 def generic_bfct(F,V,DV,W) |
|
Line 212 def generic_bfct(F,V,DV,W) |
|
N = length(V); |
N = length(V); |
N2 = N*2; |
N2 = N*2; |
|
|
/* create a term order M in D<x,d> */ |
/* If W is a list, convert it to a vector */ |
|
if ( type(W) == 4 ) |
|
W = newvect(length(W),W); |
|
dp_weyl_set_weight(W); |
|
|
|
/* create a term order M in D<x,d> (DRL) */ |
M = newmat(N2,N2); |
M = newmat(N2,N2); |
for ( J = 0; J < N2; J++ ) |
for ( J = 0; J < N2; J++ ) |
M[0][J] = 1; |
M[0][J] = 1; |
Line 244 def generic_bfct(F,V,DV,W) |
|
Line 249 def generic_bfct(F,V,DV,W) |
|
FH = map(dp_dtop,map(dp_homo,map(dp_ptod,F,VDV)),VDVH); |
FH = map(dp_dtop,map(dp_homo,map(dp_ptod,F,VDV)),VDVH); |
|
|
/* compute a groebner basis of FH w.r.t. MWH */ |
/* compute a groebner basis of FH w.r.t. MWH */ |
GH = dp_weyl_gr_main(FH,VDVH,0,0,MWH); |
dp_gr_flags(["Top",1,"NoRA",1]); |
|
GH = dp_weyl_gr_main(FH,VDVH,0,1,11); |
|
dp_gr_flags(["Top",0,"NoRA",0]); |
|
|
/* dehomigenize GH */ |
/* dehomigenize GH */ |
G = map(subst,GH,h,1); |
G = map(subst,GH,h,1); |
Line 259 def generic_bfct(F,V,DV,W) |
|
Line 266 def generic_bfct(F,V,DV,W) |
|
/* find b(W1*x1*d1+...+WN*xN*dN) in Id(GIN) */ |
/* find b(W1*x1*d1+...+WN*xN*dN) in Id(GIN) */ |
for ( I = 0, T = 0; I < N; I++ ) |
for ( I = 0, T = 0; I < N; I++ ) |
T += W[I]*V[I]*DV[I]; |
T += W[I]*V[I]*DV[I]; |
B = weyl_minipoly(GIN,VDV,M,T); |
B = weyl_minipoly(GIN,VDV,0,T); /* M represents DRL order */ |
return B; |
return B; |
} |
} |
|
|
|
/* all term reduction + interreduce */ |
|
def generic_bfct_1(F,V,DV,W) |
|
{ |
|
N = length(V); |
|
N2 = N*2; |
|
|
|
/* If W is a list, convert it to a vector */ |
|
if ( type(W) == 4 ) |
|
W = newvect(length(W),W); |
|
dp_weyl_set_weight(W); |
|
|
|
/* create a term order M in D<x,d> (DRL) */ |
|
M = newmat(N2,N2); |
|
for ( J = 0; J < N2; J++ ) |
|
M[0][J] = 1; |
|
for ( I = 1; I < N2; I++ ) |
|
M[I][N2-I] = -1; |
|
|
|
VDV = append(V,DV); |
|
|
|
/* create a non-term order MW in D<x,d> */ |
|
MW = newmat(N2+1,N2); |
|
for ( J = 0; J < N; J++ ) |
|
MW[0][J] = -W[J]; |
|
for ( ; J < N2; J++ ) |
|
MW[0][J] = W[J-N]; |
|
for ( I = 1; I <= N2; I++ ) |
|
for ( J = 0; J < N2; J++ ) |
|
MW[I][J] = M[I-1][J]; |
|
|
|
/* create a homogenized term order MWH in D<x,d,h> */ |
|
MWH = newmat(N2+2,N2+1); |
|
for ( J = 0; J <= N2; J++ ) |
|
MWH[0][J] = 1; |
|
for ( I = 1; I <= N2+1; I++ ) |
|
for ( J = 0; J < N2; J++ ) |
|
MWH[I][J] = MW[I-1][J]; |
|
|
|
/* homogenize F */ |
|
VDVH = append(VDV,[h]); |
|
FH = map(dp_dtop,map(dp_homo,map(dp_ptod,F,VDV)),VDVH); |
|
|
|
/* compute a groebner basis of FH w.r.t. MWH */ |
|
/* dp_gr_flags(["Top",1,"NoRA",1]); */ |
|
GH = dp_weyl_gr_main(FH,VDVH,0,1,11); |
|
/* dp_gr_flags(["Top",0,"NoRA",0]); */ |
|
|
|
/* dehomigenize GH */ |
|
G = map(subst,GH,h,1); |
|
|
|
/* G is a groebner basis w.r.t. a non term order MW */ |
|
/* take the initial part w.r.t. (-W,W) */ |
|
GIN = map(initial_part,G,VDV,MW,W); |
|
|
|
/* GIN is a groebner basis w.r.t. a term order M */ |
|
/* As -W+W=0, gr_(-W,W)(D<x,d>) = D<x,d> */ |
|
|
|
/* find b(W1*x1*d1+...+WN*xN*dN) in Id(GIN) */ |
|
for ( I = 0, T = 0; I < N; I++ ) |
|
T += W[I]*V[I]*DV[I]; |
|
B = weyl_minipoly(GIN,VDV,0,T); /* M represents DRL order */ |
|
return B; |
|
} |
|
|
def initial_part(F,V,MW,W) |
def initial_part(F,V,MW,W) |
{ |
{ |
N2 = length(V); |
N2 = length(V); |
|
|
return Minipoly; |
return Minipoly; |
} |
} |
|
|
|
/* b-function computation via generic_bfct() (experimental) */ |
|
|
|
def bfct_via_gbfct(F) |
|
{ |
|
V = vars(F); |
|
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); |
|
V = reverse(V); |
|
for ( I = N-1, DV = []; I >= 0; I-- ) |
|
DV = cons(strtov("d"+rtostr(V[I])),DV); |
|
|
|
B = [t-F]; |
|
for ( I = 0; I < N; I++ ) { |
|
B = cons(DV[I]+diff(F,V[I])*dt,B); |
|
} |
|
V1 = cons(t,V); DV1 = cons(dt,DV); |
|
W = newvect(N+1); |
|
W[0] = 1; |
|
R = generic_bfct_1(B,V1,DV1,W); |
|
|
|
return subst(R,s,-s-1); |
|
} |
|
|
|
/* use an order s.t. [t,x,y,z,...,dt,dx,dy,dz,...,h] */ |
|
|
|
def bfct_via_gbfct_weight(F,V) |
|
{ |
|
N = length(V); |
|
D = newvect(N); |
|
Wt = getopt(weight); |
|
if ( type(Wt) != 4 ) { |
|
for ( I = 0, Wt = []; I < N; I++ ) |
|
Wt = cons(1,Wt); |
|
} |
|
Tdeg = w_tdeg(F,V,Wt); |
|
WtV = newvect(2*(N+1)+1); |
|
WtV[0] = Tdeg; |
|
WtV[N+1] = 1; |
|
/* wdeg(V[I])=Wt[I], wdeg(DV[I])=Tdeg-Wt[I]+1 */ |
|
for ( I = 1; I <= N; I++ ) { |
|
WtV[I] = Wt[I-1]; |
|
WtV[N+1+I] = Tdeg-Wt[I-1]+1; |
|
} |
|
WtV[2*(N+1)] = 1; |
|
dp_set_weight(WtV); |
|
for ( I = N-1, DV = []; I >= 0; I-- ) |
|
DV = cons(strtov("d"+rtostr(V[I])),DV); |
|
|
|
B = [t-F]; |
|
for ( I = 0; I < N; I++ ) { |
|
B = cons(DV[I]+diff(F,V[I])*dt,B); |
|
} |
|
V1 = cons(t,V); DV1 = cons(dt,DV); |
|
W = newvect(N+1); |
|
W[0] = 1; |
|
R = generic_bfct_1(B,V1,DV1,W); |
|
dp_set_weight(0); |
|
return subst(R,s,-s-1); |
|
} |
|
|
|
/* use an order s.t. [x,y,z,...,t,dx,dy,dz,...,dt,h] */ |
|
|
|
def bfct_via_gbfct_weight_1(F,V) |
|
{ |
|
N = length(V); |
|
D = newvect(N); |
|
Wt = getopt(weight); |
|
if ( type(Wt) != 4 ) { |
|
for ( I = 0, Wt = []; I < N; I++ ) |
|
Wt = cons(1,Wt); |
|
} |
|
Tdeg = w_tdeg(F,V,Wt); |
|
WtV = newvect(2*(N+1)+1); |
|
/* wdeg(V[I])=Wt[I], wdeg(DV[I])=Tdeg-Wt[I]+1 */ |
|
for ( I = 0; I < N; I++ ) { |
|
WtV[I] = Wt[I]; |
|
WtV[N+1+I] = Tdeg-Wt[I]+1; |
|
} |
|
WtV[N] = Tdeg; |
|
WtV[2*N+1] = 1; |
|
WtV[2*(N+1)] = 1; |
|
dp_set_weight(WtV); |
|
for ( I = N-1, DV = []; I >= 0; I-- ) |
|
DV = cons(strtov("d"+rtostr(V[I])),DV); |
|
|
|
B = [t-F]; |
|
for ( I = 0; I < N; I++ ) { |
|
B = cons(DV[I]+diff(F,V[I])*dt,B); |
|
} |
|
V1 = append(V,[t]); DV1 = append(DV,[dt]); |
|
W = newvect(N+1); |
|
W[N] = 1; |
|
R = generic_bfct(B,V1,DV1,W); |
|
dp_set_weight(0); |
|
return subst(R,s,-s-1); |
|
} |
|
|
def weyl_minipolym(G,V,O,M,V0) |
def weyl_minipolym(G,V,O,M,V0) |
{ |
{ |
N = length(V); |
N = length(V); |
Line 333 def weyl_minipolym(G,V,O,M,V0) |
|
Line 507 def weyl_minipolym(G,V,O,M,V0) |
|
GI = cons(I,GI); |
GI = cons(I,GI); |
|
|
U = dp_mod(dp_ptod(V0,V),M,[]); |
U = dp_mod(dp_ptod(V0,V),M,[]); |
|
U = dp_weyl_nf_mod(GI,U,PS,1,M); |
|
|
T = dp_mod(<<0>>,M,[]); |
T = dp_mod(<<0>>,M,[]); |
TT = dp_mod(dp_ptod(1,V),M,[]); |
TT = dp_mod(dp_ptod(1,V),M,[]); |
G = H = [[TT,T]]; |
G = H = [[TT,T]]; |
|
|
for ( I = 1; ; I++ ) { |
for ( I = 1; ; I++ ) { |
|
if ( dp_gr_print() ) |
|
print(".",2); |
T = dp_mod(<<I>>,M,[]); |
T = dp_mod(<<I>>,M,[]); |
|
|
TT = dp_weyl_nf_mod(GI,dp_weyl_mul_mod(TT,U,M),PS,1,M); |
TT = dp_weyl_nf_mod(GI,dp_weyl_mul_mod(TT,U,M),PS,1,M); |
H = cons([TT,T],H); |
H = cons([TT,T],H); |
L = dp_lnf_mod([TT,T],G,M); |
L = dp_lnf_mod([TT,T],G,M); |
if ( !L[0] ) |
if ( !L[0] ) { |
|
if ( dp_gr_print() ) |
|
print(""); |
return dp_dtop(L[1],[t]); /* XXX */ |
return dp_dtop(L[1],[t]); /* XXX */ |
else |
} else |
G = insert(G,L); |
G = insert(G,L); |
} |
} |
} |
} |
Line 377 def weyl_minipoly(G0,V0,O0,P) |
|
Line 556 def weyl_minipoly(G0,V0,O0,P) |
|
LCM = 1; |
LCM = 1; |
|
|
for ( J = 1; J <= D; J++ ) { |
for ( J = 1; J <= D; J++ ) { |
|
if ( dp_gr_print() ) |
|
print(".",2); |
NFPrev = car(NF); |
NFPrev = car(NF); |
NFJ = weyl_nf(GI, |
NFJ = weyl_nf(GI, |
dp_weyl_mul(NFP[0],NFPrev[0]),NFP[1]*NFPrev[1],PS); |
dp_weyl_mul(NFP[0],NFPrev[0]),NFP[1]*NFPrev[1],PS); |
Line 384 def weyl_minipoly(G0,V0,O0,P) |
|
Line 565 def weyl_minipoly(G0,V0,O0,P) |
|
NF = cons(NFJ,NF); |
NF = cons(NFJ,NF); |
LCM = ilcm(LCM,NFJ[1]); |
LCM = ilcm(LCM,NFJ[1]); |
} |
} |
|
if ( dp_gr_print() ) |
|
print(""); |
U = NF[0][0]*idiv(LCM,NF[0][1]); |
U = NF[0][0]*idiv(LCM,NF[0][1]); |
Coef = []; |
Coef = []; |
for ( J = D-1; J >= 0; J-- ) { |
for ( J = D-1; J >= 0; J-- ) { |
Line 504 def v_factorial(V,N) |
|
Line 687 def v_factorial(V,N) |
|
{ |
{ |
for ( J = N-1, R = 1; J >= 0; J-- ) |
for ( J = N-1, R = 1; J >= 0; J-- ) |
R *= V-J; |
R *= V-J; |
|
return R; |
|
} |
|
|
|
def w_tdeg(F,V,W) |
|
{ |
|
dp_set_weight(newvect(length(W),W)); |
|
T = dp_ptod(F,V); |
|
for ( R = 0; T; T = cdr(T) ) { |
|
D = dp_td(T); |
|
if ( D > R ) R = D; |
|
} |
return R; |
return R; |
} |
} |
end$ |
end$ |