[BACK]Return to mwl.rr CVS log [TXT][DIR] Up to [local] / OpenXM / src / asir-contrib / testing / noro

Diff for /OpenXM/src/asir-contrib/testing/noro/mwl.rr between version 1.1 and 1.3

version 1.1, 2009/10/25 12:46:48 version 1.3, 2009/11/12 01:39:54
Line 19  E7=y^2-(x^3+t*x)$
Line 19  E7=y^2-(x^3+t*x)$
 F5=y^2-(x^3+t^11-t)$  F5=y^2-(x^3+t^11-t)$
 /* F6ss1new2.txt */  /* F6ss1new2.txt */
 F6=y^2-(x^3+t^12-1)$  F6=y^2-(x^3+t^12-1)$
   /* OS8split4 */
   OS8=y^2-240*x*y-300*t^2*y-x^3+476*t*x^2+65*t^3*x-t^5$
 import("gr")$  import("gr")$
 module mwl$  module mwl$
 localf generate_coef_ideal$  localf generate_coef_ideal$
 localf pdecomp,pdecomp_main,ideal_intersection,ldim$  localf pdecomp,pdecomp_main,ideal_intersection,ldim$
 localf pdecomp_ff,pdecomp_ff_main,ideal_intersection_ff,ldim_ff$  localf pdecomp_ff,pdecomp_ff_main,ideal_intersection_ff,ldim_ff$
 localf ideal_elimination,gbcheck,f4$  localf ideal_elimination,gbcheck,f4$
   localf pdecomp_de,pdecomp_de_main,split,zcolon$
 static GBCheck,F4$  static GBCheck,F4$
 #define Tmp ttttt  #define Tmp ttttt
   
Line 40  def f4(A)
Line 43  def f4(A)
         else F4 = 0;          else F4 = 0;
 }  }
   
   /* if option simp=1 is given, we try simplifying the output ideal. */
   /* Remove an^3-bm^2 and an -> v^2, bm -> v^3                       */
   
 def generate_coef_ideal(F)  def generate_coef_ideal(F)
 {  {
           if ( type(Simp=getopt(simp)) == -1 ) Simp = 0;
         A1 = coef(coef(F,1,x),1,y);          A1 = coef(coef(F,1,x),1,y);
         A2 = -coef(coef(F,2,x),0,y);          A2 = -coef(coef(F,2,x),0,y);
         A3 = coef(coef(F,0,x),1,y);          A3 = coef(coef(F,0,x),1,y);
Line 51  def generate_coef_ideal(F)
Line 58  def generate_coef_ideal(F)
                 [deg(A1,t)/1,deg(A2,t)/2,deg(A3,t)/3,deg(A4,t)/4,deg(A6,t)/6]);                  [deg(A1,t)/1,deg(A2,t)/2,deg(A3,t)/3,deg(A4,t)/4,deg(A6,t)/6]);
         D = map(ceil,D);          D = map(ceil,D);
         for ( K = D[0], I = 1; I < 5; I++ ) if ( K < D[I] ) K = D[I];          for ( K = D[0], I = 1; I < 5; I++ ) if ( K < D[I] ) K = D[I];
         F1 = (y^2+A1*x*y+A3*y)-(x^3+A2*x^2+A4*x+A6);  
         VX = [];          VX = [];
         for ( I = 0, X = 0; I <= 2*K; I++ ) {          for ( I = 0, X = 0; I <= 2*K; I++ ) {
                 V = strtov("a"+rtostr(I));                  V = strtov("a"+rtostr(I));
Line 67  def generate_coef_ideal(F)
Line 73  def generate_coef_ideal(F)
         S = subst(F,x,X,y,Y);          S = subst(F,x,X,y,Y);
         N = deg(S,t);          N = deg(S,t);
         for ( R = [], I = 0; I <= N; I++ ) R = cons(coef(S,I,t),R);          for ( R = [], I = 0; I <= N; I++ ) R = cons(coef(S,I,t),R);
         return [R,append((VY),(VX))];          if ( Simp ) {
                   R0 = car(R); R = cdr(R);
                   VX0 = car(VX); VX = cdr(VX);
                   VY0 = car(VY); VY = cdr(VY);
                   if ( subst(R0,VX0,v^2,VY0,v^3)==0 ) {
                           R = subst(R,VX0,v^2,VY0,v^3);
                           return [R,append(append(VY,VX),[v])];
                   } else
                           error("The output ideal cannot be simplified");
           } else
                   return [R,append((VY),(VX))];
 }  }
   
 def pdecomp(B,V) {  def pdecomp(B,V) {
Line 134  def pdecomp_ff_main(G,V,Ord,X,Mod) {
Line 150  def pdecomp_ff_main(G,V,Ord,X,Mod) {
                 G2 =cons(G1,G2);                  G2 =cons(G1,G2);
         }          }
         return G2;          return G2;
   }
   
   def pdecomp_de(B,V) {
           if ( F4 ) G0 = nd_f4_trace(B,V,1,GBCheck,0);
           else G0 = nd_gr_trace(B,V,1,GBCheck,0);
           G=[G0];
           for ( T = reverse(V); T !=[]; T = cdr(T) ) {
                   G1 = [];
                   X = car(T);
                   for ( S = G; S != []; S = cdr(S) ) {
                           GX = pdecomp_de_main(car(S),V,0,X);
                           G1 = append(GX,G1);
                   }
                   G = G1;
           }
           return [G,G0];
   }
   
   #if 1
   def pdecomp_de_main(G,V,Ord,X) {
           M = minipoly(G,V,Ord,X,Tmp);
           M = subst(M,Tmp,X);
           FM = cdr(fctr(M));
           if ( length(FM) == 1 ) return [G];
           G2 = [];
           G1 = G;
           for ( T = FM; length(T) > 1; T = cdr(T) ) {
                   F1 = car(T);
                   for ( I = 0, N = F1[1], NF=1; I < N; I++ )
                           NF = p_nf(NF*F1[0],G1,V,Ord);
                   C = split(V,G1,NF,Ord);
                   /* C = [G1:NF,G1+NF] */
                   G1 = C[0]; G2 =cons(C[1],G2);
           }
           G2 = cons(G1,G2);
           return G2;
   }
   #else
   def pdecomp_de_main(G,V,Ord,X) {
           M = minipoly(G,V,Ord,X,Tmp);
           M = subst(M,Tmp,X);
           FM = cdr(fctr(M));
           if ( length(FM) == 1 ) return [G];
           G2 = [];
           G1 = G;
           NFM = length(FM);
           A = vector(NFM);
           for ( J = 0; J < NFM; J++ ) {
                   FJ = FM[J];
                   for ( I = 0, N = FJ[1], NF=1; I < N; I++ )
                           NF = p_nf(NF*FJ[0],G1,V,Ord);
                   A[J] = NF;
           }
           for ( T = FM, J = 0; J < NFM; J++ ) {
                   for ( I = 0, NF=1; I < NFM; I++ )
                           if ( I != J )
                                   NF = p_nf(NF*A[I],G,V,Ord);
                   C = zcolon(V,G1,NF,Ord);
                   G2 =cons(C,G2);
           }
           return G2;
   }
   #endif
   
   /* from de.rr */
   
   def split(V,Id,F,Ord)
   {
           Id = map(ptozp,Id);
           N = length(V);
           dp_ord(Ord);
           set_field(Id,V,Ord);
           DF = dptodalg(dp_ptod(F,V));
           Ret = inv_or_split_dalg(DF);
           /* Ret = GB(Id:F) */
           /* compute GB(Id+<f>) */
           Gquo = append(map(ptozp,map(dp_dtop,Ret,V)),Id);
           /* inter-reduction */
           Gquo = nd_gr_postproc(Gquo,V,0,Ord,0);
           B = cons(F,Id);
           if ( F4 ) Grem = nd_f4_trace(B,V,1,GBCheck,Ord);
           else Grem = nd_gr_trace(B,V,1,GBCheck,Ord);
           return [map(ptozp,Gquo),map(ptozp,Grem)];
   }
   
   /* Id:F for zero-dim. ideal Id */
   
   def zcolon(V,Id,F,Ord)
   {
           Id = map(ptozp,Id);
           N = length(V);
           dp_ord(Ord);
           set_field(Id,V,Ord);
           DF = dptodalg(dp_ptod(F,V));
           Ret = inv_or_split_dalg(DF);
           /* Ret = GB(Id:F) */
           /* compute GB(Id+<f>) */
           Gquo = append(map(ptozp,map(dp_dtop,Ret,V)),Id);
           Gquo = nd_gr_postproc(Gquo,V,0,Ord,0);
           return map(ptozp,Gquo);
 }  }
   
 def ideal_intersection(L,V,Ord)  def ideal_intersection(L,V,Ord)

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.3

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>