=================================================================== RCS file: /home/cvs/OpenXM/src/asir-contrib/testing/noro/ndbf.rr,v retrieving revision 1.2 retrieving revision 1.6 diff -u -p -r1.2 -r1.6 --- OpenXM/src/asir-contrib/testing/noro/ndbf.rr 2009/10/12 21:42:59 1.2 +++ OpenXM/src/asir-contrib/testing/noro/ndbf.rr 2009/10/16 07:39:33 1.6 @@ -263,15 +263,30 @@ def ann(F) { if ( member(s,vars(F)) ) error("ann : the variable 's' is reserved."); + F = ptozp(F); V = vars(F); N = length(V); D = newvect(N); + if ( type(Wt=getopt(weight)) == -1 ) + for ( I = N-1, Wt = []; I >= 0; I-- ) Wt = append([V[I],1],Wt); - for ( I = 0; I < N; I++ ) - D[I] = [deg(F,V[I]),V[I]]; + Wt1 = vector(N); + for ( I = 0, F1 =F; I < N; I++ ) { + VI = Wt[2*I]; WI = Wt[2*I+1]; + for ( J = 0; J < N; J++ ) + if ( VI == V[J] ) break; + F1 = subst(F1,VI,VI^WI); + } + for ( I = 0; I < N; I++ ) D[I] = [deg(F1,V[I]),V[I]]; qsort(D,compare_first); - for ( V = [], I = N-1; I >= 0; I-- ) - V = cons(D[I][1],V); + for ( V = [], I = 0; I < N; I++ ) V = cons(D[I][1],V); + V = reverse(V); + for ( I = 0; I < N; I++ ) { + VI = Wt[2*I]; WI = Wt[2*I+1]; + for ( J = 0; J < N; J++ ) if ( VI == V[J] ) break; + Wt1[J] = WI; + } + Wt = vtol(Wt1); for ( I = N-1, DV = []; I >= 0; I-- ) DV = cons(strtov("d"+rtostr(V[I])),DV); @@ -284,9 +299,23 @@ def ann(F) B = cons(DV[I]+TMP_Y1*diff(F,V[I])*TMP_DT,B); } - /* homogenized (heuristics) */ - dp_nelim(2); - G0 = nd_weyl_gr(B,append(W,DW),0,[[0,2],[0,length(W)*2-2]]); + Tdeg = w_tdeg(F,V,Wt); + /* y1*y2-1, t-y1*f, dx1+y1*df/dx1*dt ... */ + /* weight for [y1,y2,t, x1,...,xn, dy1,dy2, dt,dx1,...,dxn, h] */ + /* 0 1 2 3 N3-1 N3 N3+1 N3+2 2*N3 */ + /* 1 1 D+1 1 1 1 1 1 D D 1 */ + N3 = N+3; + WtV = newvect(2*N3+1); + WtV[0] = WtV[1] = 1; WtV[2] = Tdeg+1; + for ( I = 3; I <= N3+2; I++ ) WtV[I] = 1; + for ( ; I < 2*N3; I++ ) WtV[I] = Tdeg; + WtV[2*N3] = 1; + + /* B is already a GB => modular change of ordering can be applied */ + /* any prime is available => HC=[1] */ + dp_set_weight(WtV); + G0 = nd_gb_candidate(B,append(W,DW),[[0,2],[0,length(W)*2-2]],0,[1],1); + dp_set_weight(0); G1 = []; for ( T = G0; T != []; T = cdr(T) ) { E = car(T); VL = vars(E); @@ -335,7 +364,11 @@ def ann_n(F) VA = append(U,append(W,V)); DVA = append(DU,append(DW,DV)); VDV = append(VA,DVA); +#if 0 G0 = nd_weyl_gr(B,VDV,0,[[0,2*L],[0,length(VDV)-2*L]]); +#else + G0 = nd_gb_candidate(B,VDV,[[0,2*L],[0,length(VDV)-2*L]],0,[1],1); +#endif G1 = []; for ( T = G0; T != []; T = cdr(T) ) { E = car(T); VL = vars(E); @@ -1379,9 +1412,12 @@ def bf_strat_stage3(L) def bf_local(F,P) { + /* F -> F/Fcont */ + F1 = ptozp(F); Fcont = sdiv(F,F1); F = F1; if ( type(Heu=getopt(heuristic)) == -1 ) Heu = 0; if ( type(Vord=getopt(vord)) == -1 || type(Vord) != 4 ) Vord = 0; if ( type(Wt=getopt(weight)) == -1 ) Wt = 0; + if ( type(Op=getopt(op)) == -1 ) Op = 0; L = in_ww(F|weight=Wt,heuristic=Heu,vord=Vord); InData = L[0]; AllData = L[1]; VData = L[2]; G = InData[0]; VDV = InData[1]; @@ -1415,8 +1451,14 @@ def bf_local(F,P) break; if ( List == [] ) error("bf_local : inconsitent intersection"); Ax = car(List); - for ( BPT = 1, List = BP; List != []; List = cdr(List) ) + LB = []; + for ( BPT = 1, List = BP; List != []; List = cdr(List) ) { BPT *= car(List)[0]^car(List)[1]; + LB = cons([subst(car(List)[0],s,-s-1),car(List)[1]],LB); + } + LB = reverse(LB); + if ( !Op ) return LB; + BPT = weyl_subst(BPT,T*DT,VDV); /* computation using G0,GIN0,VDV0 */ @@ -1436,7 +1478,10 @@ def bf_local(F,P) CR = conv_tdt(R,F,V0,DV0,T,DT); dp_set_weight(0); - return [BP,Ax,CR]; + Cont = cont(CR); CR /= Cont; + Cont *= dn(Fcont); Den *= nm(Fcont); + Gcd = igcd(Den,Cont); + return [LB,(Den/Gcd)*Ax,(Cont/Gcd)*CR]; } /* t^(l+k)*dt^l (k>l) -> (s-k)(s-k-1)...(s-(k+l-1))t^k */