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

Diff for /OpenXM_contrib2/asir2018/engine/nd.c between version 1.38 and 1.39

version 1.38, 2020/10/26 02:41:05 version 1.39, 2020/10/29 01:50:35
Line 1 
Line 1 
 /* $OpenXM: OpenXM_contrib2/asir2018/engine/nd.c,v 1.37 2020/10/06 06:31:19 noro Exp $ */  /* $OpenXM: OpenXM_contrib2/asir2018/engine/nd.c,v 1.38 2020/10/26 02:41:05 noro Exp $ */
   
 #include "nd.h"  #include "nd.h"
   
Line 66  static int *nd_poly_weight,*nd_module_weight;
Line 66  static int *nd_poly_weight,*nd_module_weight;
 static NODE nd_tracelist;  static NODE nd_tracelist;
 static NODE nd_alltracelist;  static NODE nd_alltracelist;
 static int nd_gentrace,nd_gensyz,nd_nora,nd_newelim,nd_intersect,nd_lf;  static int nd_gentrace,nd_gensyz,nd_nora,nd_newelim,nd_intersect,nd_lf;
 static int nd_f4_td,nd_sba_f4step,nd_sba_pot,nd_sba_largelcm;  static int nd_f4_td,nd_sba_f4step,nd_sba_pot,nd_sba_largelcm,nd_sba_dontsort;
   static int nd_top;
 static int *nd_gbblock;  static int *nd_gbblock;
 static NODE nd_nzlist,nd_check_splist;  static NODE nd_nzlist,nd_check_splist;
 static int nd_splist;  static int nd_splist;
Line 2029  void free_pbucket(PGeoBucket b) {
Line 2030  void free_pbucket(PGeoBucket b) {
     GCFREE(b);      GCFREE(b);
 }  }
   
   #if 0
 void add_pbucket_symbolic(PGeoBucket g,ND d)  void add_pbucket_symbolic(PGeoBucket g,ND d)
 {  {
     int l,i,k,m;      int l,i,k,m;
Line 2046  void add_pbucket_symbolic(PGeoBucket g,ND d)
Line 2048  void add_pbucket_symbolic(PGeoBucket g,ND d)
     g->body[k] = d;      g->body[k] = d;
     g->m = MAX(g->m,k);      g->m = MAX(g->m,k);
 }  }
   #else
   void add_pbucket_symbolic(PGeoBucket g,ND d)
   {
     int l,i,k,m,m0;
   
     if ( !d )
       return;
     m0 = g->m;
     while ( 1 ) {
       l = LEN(d);
       for ( k = 0, m = 1; l > m; k++, m <<= 1 );
       /* 2^(k-1) < l <= 2^k (=m) */
       if ( g->body[k] == 0 ) {
         g->body[k] = d;
         m0 = MAX(k,m0);
         break;
       } else {
         d = nd_merge(g->body[k],d);
         g->body[k] = 0;
       }
     }
     g->m = m0;
   }
   #endif
   
   #if 0
 void add_pbucket(int mod,PGeoBucket g,ND d)  void add_pbucket(int mod,PGeoBucket g,ND d)
 {  {
     int l,i,k,m;      int l,i,k,m;
Line 2064  void add_pbucket(int mod,PGeoBucket g,ND d)
Line 2091  void add_pbucket(int mod,PGeoBucket g,ND d)
     g->body[k] = d;      g->body[k] = d;
     g->m = MAX(g->m,k);      g->m = MAX(g->m,k);
 }  }
   #else
   void add_pbucket(int mod,PGeoBucket g,ND d)
   {
     int l,i,k,m,m0;
   
     m0 = g->m;
     while ( d != 0 ) {
       l = LEN(d);
       for ( k = 0, m = 1; l > m; k++, m <<= 1 );
       /* 2^(k-1) < l <= 2^k (=m) */
       if ( g->body[k] == 0 ) {
         g->body[k] = d;
         m0 = MAX(k,m0);
         break;
       } else {
         d = nd_add(mod,g->body[k],d);
         g->body[k] = 0;
       }
     }
     g->m = m0;
   }
   #endif
   
 void mulq_pbucket(PGeoBucket g,Z c)  void mulq_pbucket(PGeoBucket g,Z c)
 {  {
     int k;      int k;
Line 2424  again:
Line 2473  again:
       goto again;        goto again;
     }      }
 #if USE_GEOBUCKET  #if USE_GEOBUCKET
     stat = (m&&!nd_gentrace)?nd_nf_pbucket(m,h,nd_ps,!Top,&nf)      stat = (m&&!nd_gentrace)?nd_nf_pbucket(m,h,nd_ps,!nd_top&&!Top,&nf)
       :nd_nf(m,0,h,nd_ps,!Top,&nf);        :nd_nf(m,0,h,nd_ps,!nd_top&&!Top,&nf);
 #else  #else
     stat = nd_nf(m,0,h,nd_ps,!Top,&nf);      stat = nd_nf(m,0,h,nd_ps,!nd_top&&!Top,&nf);
 #endif  #endif
     if ( !stat ) {      if ( !stat ) {
       NEXT(l) = d; d = l;        NEXT(l) = d; d = l;
Line 2619  NODE conv_ilist_s(int demand,int trace,int **indp);
Line 2668  NODE conv_ilist_s(int demand,int trace,int **indp);
   
 NODE nd_sba_buch(int m,int ishomo,int **indp)  NODE nd_sba_buch(int m,int ishomo,int **indp)
 {  {
   int i,j,nh,sugar,stat;    int i,j,nh,sugar,stat,pos;
   NODE r,t,g;    NODE r,t,g;
   ND_pairs d;    ND_pairs d;
   ND_pairs l;    ND_pairs l;
Line 2651  init_eg(&eg_remove);
Line 2700  init_eg(&eg_remove);
       syzlist[sig->pos] = insert_sig(syzlist[sig->pos],sig);        syzlist[sig->pos] = insert_sig(syzlist[sig->pos],sig);
     }      }
   sugar = 0;    sugar = 0;
     pos = 0;
   NEWDL(lcm,nd_nvar); NEWDL(quo,nd_nvar); NEWDL(mul,nd_nvar);    NEWDL(lcm,nd_nvar); NEWDL(quo,nd_nvar); NEWDL(mul,nd_nvar);
 init_eg(&eg_create);  init_eg(&eg_create);
 init_eg(&eg_merge);  init_eg(&eg_merge);
Line 2677  again:
Line 2727  again:
       if ( DP_Print ) fprintf(asir_out,"%d",sugar);        if ( DP_Print ) fprintf(asir_out,"%d",sugar);
     }      }
     sig = l->sig;      sig = l->sig;
       if ( DP_Print && nd_sba_pot ) {
         if ( sig->pos != pos ) {
           fprintf(asir_out,"[%d]",sig->pos);
           pos = sig->pos;
         }
       }
     stat = nd_sp(m,0,l,&h);      stat = nd_sp(m,0,l,&h);
     if ( !stat ) {      if ( !stat ) {
       NEXT(l) = d; d = l;        NEXT(l) = d; d = l;
Line 2685  again:
Line 2741  again:
     }      }
 get_eg(&eg1);  get_eg(&eg1);
 #if USE_GEOBUCKET  #if USE_GEOBUCKET
     stat = m?nd_nf_pbucket_s(m,h,nd_ps,!Top,&nf):nd_nf_s(m,0,h,nd_ps,!Top,&nf);      stat = m?nd_nf_pbucket_s(m,h,nd_ps,!nd_top&&!Top,&nf):nd_nf_s(m,0,h,nd_ps,!nd_top&&!Top,&nf);
 #else  #else
     stat = nd_nf_s(m,0,h,nd_ps,!Top,&nf);      stat = nd_nf_s(m,0,h,nd_ps,!nd_top&&!Top,&nf);
 #endif  #endif
 get_eg(&eg2);  get_eg(&eg2);
     if ( !stat ) {      if ( !stat ) {
Line 2760  again:
Line 2816  again:
       d = nd_reconstruct(0,d);        d = nd_reconstruct(0,d);
       goto again;        goto again;
     }      }
     stat = nd_nf(m,0,h,nd_ps,!Top,&nf);      stat = nd_nf(m,0,h,nd_ps,!nd_top&&!Top,&nf);
     if ( !stat ) {      if ( !stat ) {
       NEXT(l) = d; d = l;        NEXT(l) = d; d = l;
       d = nd_reconstruct(0,d);        d = nd_reconstruct(0,d);
Line 2935  again:
Line 2991  again:
       goto again;        goto again;
     }      }
 #if USE_GEOBUCKET  #if USE_GEOBUCKET
     stat = nd_nf_pbucket(m,h,nd_ps,!Top,&nf);      stat = nd_nf_pbucket(m,h,nd_ps,!nd_top&&!Top,&nf);
 #else  #else
     stat = nd_nf(m,0,h,nd_ps,!Top,&nf);      stat = nd_nf(m,0,h,nd_ps,!nd_top&&!Top,&nf);
 #endif  #endif
     if ( !stat ) {      if ( !stat ) {
       NEXT(l) = d; d = l;        NEXT(l) = d; d = l;
Line 2950  again:
Line 3006  again:
       } else        } else
         nfq = 0;          nfq = 0;
       if ( !nfq ) {        if ( !nfq ) {
         if ( !nd_sp(0,1,l,&h) || !nd_nf(0,0,h,nd_ps_trace,!Top,&nfq) ) {          if ( !nd_sp(0,1,l,&h) || !nd_nf(0,0,h,nd_ps_trace,!nd_top&&!Top,&nfq) ) {
           NEXT(l) = d; d = l;            NEXT(l) = d; d = l;
           d = nd_reconstruct(1,d);            d = nd_reconstruct(1,d);
           goto again;            goto again;
Line 4320  void nd_sba(LIST f,LIST v,int m,int homo,int retdp,int
Line 4376  void nd_sba(LIST f,LIST v,int m,int homo,int retdp,int
         ndv_homogenize((NDV)BDY(t),obpe,oadv,oepos,ompos);          ndv_homogenize((NDV)BDY(t),obpe,oadv,oepos,ompos);
   }    }
   
   ndv_setup(m,0,fd0,0,0,1);    ndv_setup(m,0,fd0,nd_sba_dontsort,0,1);
   x = f4 ? nd_sba_f4(m,&perm) : nd_sba_buch(m,ishomo || homo,&perm);    x = f4 ? nd_sba_f4(m,&perm) : nd_sba_buch(m,ishomo || homo,&perm);
   if ( !x ) {    if ( !x ) {
     *rp = 0; return;      *rp = 0; return;
Line 9574  void parse_nd_option(NODE opt)
Line 9630  void parse_nd_option(NODE opt)
   nd_splist = 0; nd_check_splist = 0;    nd_splist = 0; nd_check_splist = 0;
   nd_sugarweight = 0; nd_f4red =0; nd_rank0 = 0;    nd_sugarweight = 0; nd_f4red =0; nd_rank0 = 0;
   nd_f4_td = 0; nd_sba_f4step = 2; nd_sba_pot = 0; nd_sba_largelcm = 0;    nd_f4_td = 0; nd_sba_f4step = 2; nd_sba_pot = 0; nd_sba_largelcm = 0;
     nd_sba_dontsort = 0; nd_top = 0;
   
   for ( t = opt; t; t = NEXT(t) ) {    for ( t = opt; t; t = NEXT(t) ) {
     p = BDY((LIST)BDY(t));      p = BDY((LIST)BDY(t));
     key = BDY((STRING)BDY(p));      key = BDY((STRING)BDY(p));
Line 9632  void parse_nd_option(NODE opt)
Line 9690  void parse_nd_option(NODE opt)
       nd_sba_pot = value?1:0;        nd_sba_pot = value?1:0;
     } else if ( !strcmp(key,"sba_largelcm") ) {      } else if ( !strcmp(key,"sba_largelcm") ) {
       nd_sba_largelcm = value?1:0;        nd_sba_largelcm = value?1:0;
       } else if ( !strcmp(key,"sba_dontsort") ) {
         nd_sba_dontsort = value?1:0;
       } else if ( !strcmp(key,"top") ) {
         nd_top = value?1:0;
     }      }
   }    }
 }  }
Line 10929  again:
Line 10991  again:
       }        }
   get_eg(&eg1);    get_eg(&eg1);
   #if USE_GEOBUCKET    #if USE_GEOBUCKET
       stat = m?nd_nf_pbucket_s(m,h,nd_ps,!Top,&nf):nd_nf_s(m,0,h,nd_ps,!Top,&nf);        stat = m?nd_nf_pbucket_s(m,h,nd_ps,!nd_top&&!Top,&nf):nd_nf_s(m,0,h,nd_ps,!nd_top&&!Top,&nf);
   #else    #else
       stat = nd_nf_s(m,0,h,nd_ps,!Top,&nf);        stat = nd_nf_s(m,0,h,nd_ps,!nd_top&&!Top,&nf);
   #endif    #endif
   get_eg(&eg2);    get_eg(&eg2);
       if ( !stat ) {        if ( !stat ) {

Legend:
Removed from v.1.38  
changed lines
  Added in v.1.39

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