[BACK]Return to gr.c CVS log [TXT][DIR] Up to [local] / OpenXM_contrib2 / asir2018 / builtin

Diff for /OpenXM_contrib2/asir2018/builtin/gr.c between version 1.2 and 1.8

version 1.2, 2018/09/28 08:20:27 version 1.8, 2021/02/17 22:18:39
Line 45 
Line 45 
  * 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/asir2018/builtin/gr.c,v 1.1 2018/09/19 05:45:06 noro Exp $   * $OpenXM: OpenXM_contrib2/asir2018/builtin/gr.c,v 1.7 2021/01/11 08:37:43 noro Exp $
 */  */
 #include "ca.h"  #include "ca.h"
 #include "parse.h"  #include "parse.h"
Line 84  static P *psc;
Line 84  static P *psc;
   
 static int *pss;  static int *pss;
 static int psn,pslen;  static int psn,pslen;
 static int NVars,CNVars;  static int NVars;
   int CNVars;
 static VL VC;  static VL VC;
   
 int PCoeffs;  int PCoeffs;
Line 99  int GenSyz = 0;
Line 100  int GenSyz = 0;
 int OXCheck = -1;  int OXCheck = -1;
 int OneZeroHomo = 0;  int OneZeroHomo = 0;
 int MaxDeg = 0;  int MaxDeg = 0;
   int NaiveSchreyer = 0;
   
 int NoSugar = 0;  int NoSugar = 0;
 static int NoCriB = 0;  static int NoCriB = 0;
Line 114  static int Max_mag = 0;
Line 116  static int Max_mag = 0;
 static int Max_coef = 0;  static int Max_coef = 0;
 char *Demand = 0;  char *Demand = 0;
 static int PtozpRA = 0;  static int PtozpRA = 0;
   int ReversePOT = 0;
   
 int doing_f4;  int doing_f4;
 NODE TraceList;  NODE TraceList;
Line 303  void dp_gr_main(LIST f,LIST v,Num homo,int modular,int
Line 306  void dp_gr_main(LIST f,LIST v,Num homo,int modular,int
   int i,mindex,m,nochk;    int i,mindex,m,nochk;
   struct order_spec *ord1;    struct order_spec *ord1;
   Z q;    Z q;
     Q cont;
     P pp;
   VL fv,vv,vc;    VL fv,vv,vc;
   NODE fd,fd0,fi,fi0,r,r0,t,subst,x,s,xx;    NODE fd,fd0,fi,fi0,r,r0,t,subst,x,s,xx;
   NODE ind,ind0;    NODE ind,ind0;
Line 316  void dp_gr_main(LIST f,LIST v,Num homo,int modular,int
Line 321  void dp_gr_main(LIST f,LIST v,Num homo,int modular,int
   if ( ord->id && NVars != ord->nv )    if ( ord->id && NVars != ord->nv )
     error("dp_gr_main : invalid order specification");      error("dp_gr_main : invalid order specification");
   initd(ord);    initd(ord);
     // clear denominators if the ground field is Q
     if ( field == 0 ) {
       for ( r0 = 0, t = BDY(f); t; t = NEXT(t) ) {
         ptozp((P)BDY(t),1,&cont,&pp);
         NEXTNODE(r0,r); BDY(r) = (pointer)pp;
       }
       if ( r0 ) NEXT(r) = 0;
       MKLIST(f,r0);
     }
   if ( homo ) {    if ( homo ) {
     homogenize_order(ord,NVars,&ord1);      homogenize_order(ord,NVars,&ord1);
     for ( fd0 = fi0 = 0, t = BDY(f); t; t = NEXT(t) ) {      for ( fd0 = fi0 = 0, t = BDY(f); t; t = NEXT(t) ) {
Line 370  void dp_gr_main(LIST f,LIST v,Num homo,int modular,int
Line 384  void dp_gr_main(LIST f,LIST v,Num homo,int modular,int
       } else        } else
         break;          break;
     }      }
     if ( modular )      if ( modular ) {
       if ( modular > 1 ) {        if ( modular > 1 ) {
         *rp = 0; return;          *rp = 0; return;
       } else        } else
         m = get_lprime(++mindex);          m = get_lprime(++mindex);
       }
     makesubst(vc,&subst);      makesubst(vc,&subst);
     psn = length(s);      psn = length(s);
     for ( i = psn; i < pslen; i++ ) {      for ( i = psn; i < pslen; i++ ) {
Line 711  NODE gb_f4(NODE f)
Line 726  NODE gb_f4(NODE f)
     rank = generic_gauss_elim(mat,&nm,&dn,&rind,&cind);      rank = generic_gauss_elim(mat,&nm,&dn,&rind,&cind);
 #endif  #endif
     if ( DP_Print )      if ( DP_Print )
       fprintf(asir_out,"done rank = %d\n",rank,row,col);        fprintf(asir_out,"done rank = %d\n",rank);
     for ( i = 0; i < rank; i++ ) {      for ( i = 0; i < rank; i++ ) {
       for ( k = 0; k < nred; k++ )        for ( k = 0; k < nred; k++ )
         if ( !cmpdl(nv,at[rind[i]],ht[k]) )          if ( !cmpdl(nv,at[rind[i]],ht[k]) )
Line 936  NODE gb_f4_mod(NODE f,int m)
Line 951  NODE gb_f4_mod(NODE f,int m)
     init_eg(&eg_split_elim2); add_eg(&eg_split_elim2,&tmp0,&tmp1);      init_eg(&eg_split_elim2); add_eg(&eg_split_elim2,&tmp0,&tmp1);
   
     if ( DP_Print ) {      if ( DP_Print ) {
       fprintf(asir_out,"done rank = %d\n",rank,row,col);        fprintf(asir_out,"done rank = %d\n",rank);
       print_eg("Symb",&eg_split_symb);        print_eg("Symb",&eg_split_symb);
       print_eg("Conv",&eg_split_conv);        print_eg("Conv",&eg_split_conv);
       print_eg("Elim1",&eg_split_elim1);        print_eg("Elim1",&eg_split_elim1);
Line 1124  NODE gb_f4_mod_old(NODE f,int m)
Line 1139  NODE gb_f4_mod_old(NODE f,int m)
     init_eg(&eg_split_elim2); add_eg(&eg_split_elim2,&tmp0,&tmp1);      init_eg(&eg_split_elim2); add_eg(&eg_split_elim2,&tmp0,&tmp1);
   
     if ( DP_Print ) {      if ( DP_Print ) {
       fprintf(asir_out,"done rank = %d\n",rank,row,col);        fprintf(asir_out,"done rank = %d\n",rank);
       print_eg("Symb",&eg_split_symb);        print_eg("Symb",&eg_split_symb);
       print_eg("Elim1",&eg_split_elim1);        print_eg("Elim1",&eg_split_elim1);
       print_eg("Elim2",&eg_split_elim2);        print_eg("Elim2",&eg_split_elim2);
Line 1226  void printsubst(NODE s)
Line 1241  void printsubst(NODE s)
   fputc('[',asir_out);    fputc('[',asir_out);
   while ( s ) {    while ( s ) {
     printv(CO,(V)BDY(s)); s = NEXT(s);      printv(CO,(V)BDY(s)); s = NEXT(s);
     fprintf(asir_out,"->%d",ZTOS((Q)BDY(s)));      fprintf(asir_out,"->%ld",ZTOS((Q)BDY(s)));
     if ( NEXT(s) ) {      if ( NEXT(s) ) {
       fputc(',',asir_out); s = NEXT(s);        fputc(',',asir_out); s = NEXT(s);
     } else      } else
Line 1369  NODE /* of DP */ NODE_sortb_insert( DP newdp, NODE /* 
Line 1384  NODE /* of DP */ NODE_sortb_insert( DP newdp, NODE /* 
     NEXT(newnd) = last;      NEXT(newnd) = last;
     return newnd;      return newnd;
   }    }
   for ( ; p = NEXT(last); last = p )    for ( ; (p = NEXT(last)) != 0; last = p )
     if ( sgn*(*cmpfun)( nv, newdl, BDY((DP) BDY(p))->dl ) > 0 ) break;      if ( sgn*(*cmpfun)( nv, newdl, BDY((DP) BDY(p))->dl ) > 0 ) break;
   if ( p ) NEXT(NEXT(last) = newnd) = p;    if ( p ) NEXT(NEXT(last) = newnd) = p;
   else NEXT(last) = newnd;    else NEXT(last) = newnd;
Line 1397  NODE /* of index */ NODE_sortbi_insert( int newdpi, NO
Line 1412  NODE /* of index */ NODE_sortbi_insert( int newdpi, NO
     NEXT(newnd) = last;      NEXT(newnd) = last;
     return newnd;      return newnd;
   }    }
   for ( ; p = NEXT(last); last = p )    for ( ; (p = NEXT(last)) != 0; last = p )
     if ( sgn*(*cmpfun)( nv, newdl, psh[(long)BDY(p)] ) > 0 ) break;      if ( sgn*(*cmpfun)( nv, newdl, psh[(long)BDY(p)] ) > 0 ) break;
   if ( p ) NEXT(NEXT(last) = newnd) = p;    if ( p ) NEXT(NEXT(last) = newnd) = p;
   else NEXT(last) = newnd;    else NEXT(last) = newnd;
Line 1695  DP_pairs minp( DP_pairs d, DP_pairs *prest )
Line 1710  DP_pairs minp( DP_pairs d, DP_pairs *prest )
   }    }
   for ( lcm = m->lcm, s = m->sugar, ml = 0, l = m; p; p = NEXT(l = p) )    for ( lcm = m->lcm, s = m->sugar, ml = 0, l = m; p; p = NEXT(l = p) )
     if ( NoSugar ? (*cmpfun)( nv, lcm, p->lcm ) >= 0 :      if ( NoSugar ? (*cmpfun)( nv, lcm, p->lcm ) >= 0 :
          (s > p->sugar || s == p->sugar && (*cmpfun)( nv, lcm, p->lcm ) >= 0) )           (s > p->sugar || (s == p->sugar && (*cmpfun)( nv, lcm, p->lcm ) >= 0)) )
       ml = l,  lcm = (m = p)->lcm,  s = p->sugar;        ml = l,  lcm = (m = p)->lcm,  s = p->sugar;
   if ( !ml ) *prest = NEXT(m);    if ( !ml ) *prest = NEXT(m);
   else {    else {
Line 1959  DP_pairs updpairs( DP_pairs d, NODE /* of index */ g, 
Line 1974  DP_pairs updpairs( DP_pairs d, NODE /* of index */ g, 
     dd = d1;      dd = d1;
   dl1 = DPPlength(dd); NDP += (dl-dl1);    dl1 = DPPlength(dd); NDP += (dl-dl1);
   if ( !(nd = d) ) return dd;    if ( !(nd = d) ) return dd;
   while ( nd = NEXT(d1 = nd) ) ;    while ( (nd = NEXT(d1 = nd)) != 0 ) ;
   NEXT(d1) = dd;    NEXT(d1) = dd;
   return d;    return d;
 }  }
Line 2097  DP_pairs criterion_F( DP_pairs d1 )
Line 2112  DP_pairs criterion_F( DP_pairs d1 )
   
   for ( head = last = 0, p = d1; NEXT(p); ) {    for ( head = last = 0, p = d1; NEXT(p); ) {
     s = (r = w = collect_pairs_of_hdlcm( p, &rest ))->sugar;      s = (r = w = collect_pairs_of_hdlcm( p, &rest ))->sugar;
     while ( w = NEXT(w) )      while ( (w = NEXT(w)) != 0 )
       if ( !do_weyl && criterion_2( w->dp1, w->dp2 ) ) {        if ( !do_weyl && criterion_2( w->dp1, w->dp2 ) ) {
         r = w;          r = w;
         break;          break;
Line 2333  void dp_set_flag(Obj name,Obj value)
Line 2348  void dp_set_flag(Obj name,Obj value)
     OneZeroHomo = v;      OneZeroHomo = v;
   else if ( !strcmp(n,"MaxDeg") )    else if ( !strcmp(n,"MaxDeg") )
     MaxDeg = v;      MaxDeg = v;
     else if ( !strcmp(n,"NaiveSchreyer") )
       NaiveSchreyer = v;
     else if ( !strcmp(n,"ReversePOT") )
       ReversePOT = v;
 }  }
   
 void dp_make_flaglist(LIST *list)  void dp_make_flaglist(LIST *list)
Line 2361  void dp_make_flaglist(LIST *list)
Line 2380  void dp_make_flaglist(LIST *list)
   STOZ(OXCheck,v); MKNODE(n1,v,n); n = n1; MKSTR(name,"OXCheck"); MKNODE(n1,name,n); n = n1;    STOZ(OXCheck,v); MKNODE(n1,v,n); n = n1; MKSTR(name,"OXCheck"); MKNODE(n1,name,n); n = n1;
   STOZ(GenTrace,v); MKNODE(n1,v,n); n = n1; MKSTR(name,"GenTrace"); MKNODE(n1,name,n); n = n1;    STOZ(GenTrace,v); MKNODE(n1,v,n); n = n1; MKSTR(name,"GenTrace"); MKNODE(n1,name,n); n = n1;
   STOZ(GenSyz,v); MKNODE(n1,v,n); n = n1; MKSTR(name,"GenSyz"); MKNODE(n1,name,n); n = n1;    STOZ(GenSyz,v); MKNODE(n1,v,n); n = n1; MKSTR(name,"GenSyz"); MKNODE(n1,name,n); n = n1;
     STOZ(NaiveSchreyer,v); MKNODE(n1,v,n); n = n1; MKSTR(name,"NaiveSchreyer"); MKNODE(n1,name,n); n = n1;
   STOZ(MaxDeg,v); MKNODE(n1,v,n); n = n1; MKSTR(name,"MaxDeg"); MKNODE(n1,name,n); n = n1;    STOZ(MaxDeg,v); MKNODE(n1,v,n); n = n1; MKSTR(name,"MaxDeg"); MKNODE(n1,name,n); n = n1;
   STOZ(OneZeroHomo,v); MKNODE(n1,v,n); n = n1; MKSTR(name,"OneZeroHomo"); MKNODE(n1,name,n); n = n1;    STOZ(OneZeroHomo,v); MKNODE(n1,v,n); n = n1; MKSTR(name,"OneZeroHomo"); MKNODE(n1,name,n); n = n1;
   STOZ(PtozpRA,v); MKNODE(n1,v,n); n = n1; MKSTR(name,"PtozpRA"); MKNODE(n1,name,n); n = n1;    STOZ(PtozpRA,v); MKNODE(n1,v,n); n = n1; MKSTR(name,"PtozpRA"); MKNODE(n1,name,n); n = n1;
Line 2372  void dp_make_flaglist(LIST *list)
Line 2392  void dp_make_flaglist(LIST *list)
   STOZ(NoGC,v); MKNODE(n1,v,n); n = n1; MKSTR(name,"NoGC"); MKNODE(n1,name,n); n = n1;    STOZ(NoGC,v); MKNODE(n1,v,n); n = n1; MKSTR(name,"NoGC"); MKNODE(n1,name,n); n = n1;
   STOZ(NoCriB,v); MKNODE(n1,v,n); n = n1; MKSTR(name,"NoCriB"); MKNODE(n1,name,n); n = n1;    STOZ(NoCriB,v); MKNODE(n1,v,n); n = n1; MKSTR(name,"NoCriB"); MKNODE(n1,name,n); n = n1;
   STOZ(NoSugar,v); MKNODE(n1,v,n); n = n1; MKSTR(name,"NoSugar"); MKNODE(n1,name,n); n = n1;    STOZ(NoSugar,v); MKNODE(n1,v,n); n = n1; MKSTR(name,"NoSugar"); MKNODE(n1,name,n); n = n1;
     STOZ(ReversePOT,v); MKNODE(n1,v,n); n = n1; MKSTR(name,"ReversePOT"); MKNODE(n1,name,n); n = n1;
   if ( Demand )    if ( Demand )
     MKSTR(path,Demand);      MKSTR(path,Demand);
   else    else

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.8

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