[BACK]Return to Hgfs.c CVS log [TXT][DIR] Up to [local] / OpenXM_contrib2 / asir2000 / engine

Diff for /OpenXM_contrib2/asir2000/engine/Hgfs.c between version 1.9 and 1.13

version 1.9, 2001/06/26 03:00:40 version 1.13, 2001/06/29 09:08:53
Line 1 
Line 1 
 /* $OpenXM: OpenXM_contrib2/asir2000/engine/Hgfs.c,v 1.8 2001/06/25 10:01:28 noro Exp $ */  /* $OpenXM: OpenXM_contrib2/asir2000/engine/Hgfs.c,v 1.12 2001/06/27 04:07:57 noro Exp $ */
   
 #include "ca.h"  #include "ca.h"
   
Line 19  void sfcsump(VL,P,P *);
Line 19  void sfcsump(VL,P,P *);
 void mulsfbmarray(int,BM,ML,int,int *,V,V,P *);  void mulsfbmarray(int,BM,ML,int,int *,V,V,P *);
 void const_term(P,UM);  void const_term(P,UM);
   
   int comp_dum(a,b)
   DUM a,b;
   {
           if ( DEG(a->f) > DEG(b->f) )
                   return -1;
           else if ( DEG(a->f) < DEG(b->f) )
                   return 1;
           else
                   return 0;
   }
   
 void fctrsf(p,dcp)  void fctrsf(p,dcp)
 P p;  P p;
 DCP *dcp;  DCP *dcp;
Line 66  DCP *dcp;
Line 77  DCP *dcp;
                         }                          }
                 }                  }
         udc = udc1;          udc = udc1;
           for ( i = 0; udc[i].f; i++ );
           qsort(udc,i,sizeof(struct oDUM),
                   (int (*)(const void *,const void *))comp_dum);
   
         NEWDC(dc0); COEF(dc0) = lc; DEG(dc0) = ONE; dc = dc0;          NEWDC(dc0); COEF(dc0) = lc; DEG(dc0) = ONE; dc = dc0;
         for ( n = 0; udc[n].f; n++ ) {          for ( n = 0; udc[n].f; n++ ) {
                 NEWDC(NEXT(dc)); dc = NEXT(dc);                  NEWDC(NEXT(dc)); dc = NEXT(dc);
Line 564  ML *listp;
Line 579  ML *listp;
         DCP dc;          DCP dc;
         UM w,w1,q,fm,hm;          UM w,w1,q,fm,hm;
         UM *gm;          UM *gm;
           struct oEGT tmp0,tmp1,eg_hensel,eg_hensel_t;
   
         clctv(CO,f,&vl);          clctv(CO,f,&vl);
         if ( vl->v != x ) {          if ( vl->v != x ) {
Line 610  ML *listp;
Line 626  ML *listp;
   
         q = W_UMALLOC(dx);          q = W_UMALLOC(dx);
         rlist = MLALLOC(fn); rlist->n = fn; rlist->bound = bound;          rlist = MLALLOC(fn); rlist->n = fn; rlist->bound = bound;
           fprintf(asir_out,"%d candidates\n",fn);
           init_eg(&eg_hensel);
         for ( i = 0; i < fn-1; i++ ) {          for ( i = 0; i < fn-1; i++ ) {
                 fprintf(stderr,"%d\n",i);                  fprintf(asir_out,"deg(fm) = %d, deg(gm[%d]) = %d\n",
                           DEG(fm),i,DEG(gm[i]));
                   init_eg(&eg_hensel_t);
                   get_eg(&tmp0);
                 /* fl = gm[i]*hm mod y */                  /* fl = gm[i]*hm mod y */
                 divsfum(fm,gm[i],hm);                  divsfum(fm,gm[i],hm);
                 /* fl is replaced by the cofactor of gk mod y^bound */                  /* fl is replaced by the cofactor of gk mod y^bound */
                 /* rlist->c[i] = gk */                  /* rlist->c[i] = gk */
                 sfhenmain2(fl,gm[i],hm,bound,(BM *)&rlist->c[i]);                  sfhenmain2(fl,gm[i],hm,bound,(BM *)&rlist->c[i]);
                 cpyum(hm,fm);                  cpyum(hm,fm);
                   get_eg(&tmp1); add_eg(&eg_hensel_t,&tmp0,&tmp1);
                   add_eg(&eg_hensel,&tmp0,&tmp1);
                   print_eg("Hensel",&eg_hensel_t);
                   fprintf(asir_out,"\n");
         }          }
           print_eg("Hensel total",&eg_hensel);
           fprintf(asir_out,"\n");
         /* finally, fl must be the lift of gm[fn-1] */          /* finally, fl must be the lift of gm[fn-1] */
         rlist->c[i] = fl;          rlist->c[i] = fl;
   
Line 942  BM fl;
Line 969  BM fl;
         int d,i,n;          int d,i,n;
         UM t;          UM t;
   
           n = QTOS(DEG(DC(f)));
           clearsfbm(bound,n,fl);
         DEG(fl) = bound;          DEG(fl) = bound;
         t = UMALLOC(bound);          t = UMALLOC(bound);
         for ( dc = DC(f); dc; dc = NEXT(dc) ) {          for ( dc = DC(f); dc; dc = NEXT(dc) ) {
Line 950  BM fl;
Line 979  BM fl;
                 for ( i = 0; i <= DEG(t); i++ )                  for ( i = 0; i <= DEG(t); i++ )
                         COEF(COEF(fl)[i])[d] = COEF(t)[i];                          COEF(COEF(fl)[i])[d] = COEF(t)[i];
         }          }
         n = QTOS(DEG(DC(f)));  
         for ( i = 0; i < bound; i++ )          for ( i = 0; i < bound; i++ )
                 degum(COEF(fl)[i],n);                  degum(COEF(fl)[i],n);
 }  }
Line 1045  DCP *dcp;
Line 1073  DCP *dcp;
   
         /* sf(x) = f(x+ev) = list->c[0]*list->c[1]*... */          /* sf(x) = f(x+ev) = list->c[0]*list->c[1]*... */
         sfhensel(5,f,x,&ev,&sf,&list);          sfhensel(5,f,x,&ev,&sf,&list);
           if ( list->n == 0 )
                   error("sfbfctr : short of evaluation points");
           else if ( list->n == 1 ) {
                   /* f is irreducible */
                   NEWDC(dc); DEG(dc) = ONE; COEF(dc) = f; NEXT(dc) = 0;
                   *dcp = dc;
                   return;
           }
         sfdtest(sf,list,x,y,&dc);          sfdtest(sf,list,x,y,&dc);
         n = getdeg(x,sf);          n = getdeg(x,sf);
         bound = list->bound;          bound = list->bound;
Line 1184  P *fp,*cofp;
Line 1220  P *fp,*cofp;
                                 return 0;                                  return 0;
                 }                  }
         }          }
         if ( divtp(vl,lcg,fmul,&q) ) {          if ( divtp_by_sfbm(vl,lcg,fmul,&q) ) {
                 pp_sfp(vl,fmul,fp);                  pp_sfp(vl,fmul,fp);
                 pp_sfp(vl,q,cofp);                  pp_sfp(vl,q,cofp);
                 return 1;                  return 1;
Line 1332  P *fp;
Line 1368  P *fp;
                 sfumtop(y,gcd,&dvr);                  sfumtop(y,gcd,&dvr);
                 divsp(vl,f,dvr,fp);                  divsp(vl,f,dvr,fp);
         }          }
   }
   
   int divtp_by_sfbm(vl,f,g,qp)
   VL vl;
   P f,g;
   P *qp;
   {
           V x,y;
           int fx,fy,gx,gy;
           BM fl,gl,ql;
           UM *cf,*cg,*cq;
           UM hg,q,t,s;
           int i,j,dr;
   
           x = vl->v; y = vl->next->v;
           fx = getdeg(x,f); fy = getdeg(y,f);
           gx = getdeg(x,g); gy = getdeg(y,g);
   
           if ( fx < gx || fy < gy )
                   return 0;
           W_BMALLOC(fx,fy+1,fl); ptosfbm(fy+1,f,fl); cf = COEF(fl);
           W_BMALLOC(gx,gy+1,gl); ptosfbm(gy+1,g,gl); cg = COEF(gl);
           W_BMALLOC(fx-gx,fy-gy+1,ql); cq = COEF(ql);
   
           hg = cg[gy];
           q = W_UMALLOC(fx); t = W_UMALLOC(fx); s = W_UMALLOC(fx);
   
           for ( i = fy; i >= gy; i-- ) {
                   if ( DEG(cf[i]) < 0 )
                           continue;
                   dr = divsfum(cf[i],hg,q);
                   if ( dr >= 0 )
                           return 0;
                   if ( DEG(q) > fx-gx )
                           return 0;
                   cpyum(q,cq[i-gy]);
                   for ( j = 0; j <= gy; j++ ) {
                           mulsfum(cg[j],q,t);
                           subsfum(cf[j+i-gy],t,s);
                           cpyum(s,cf[j+i-gy]);
                   }
           }
           for ( j = gy-1; j >= 0 && DEG(cf[j]) < 0; j-- );
           if ( j >= 0 )
                   return 0;
           sfbmtop(DEG(ql),ql,x,y,qp);
 }  }

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.13

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