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

Diff for /OpenXM_contrib2/asir2000/engine/nd.c between version 1.41 and 1.42

version 1.41, 2003/08/21 07:39:25 version 1.42, 2003/08/21 08:20:06
Line 1 
Line 1 
 /* $OpenXM: OpenXM_contrib2/asir2000/engine/nd.c,v 1.40 2003/08/21 04:44:36 noro Exp $ */  /* $OpenXM: OpenXM_contrib2/asir2000/engine/nd.c,v 1.41 2003/08/21 07:39:25 noro Exp $ */
   
 #include "ca.h"  #include "ca.h"
 #include "inline.h"  #include "inline.h"
Line 73  typedef struct oND_pairs {
Line 73  typedef struct oND_pairs {
         unsigned int lcm[1];          unsigned int lcm[1];
 } *ND_pairs;  } *ND_pairs;
   
   /* index and shift count for each exponent */
   typedef struct oEPOS {
           int i; /* index */
           int s; /* shift */
   } *EPOS;
   
 int (*nd_compare_function)(unsigned int *a1,unsigned int *a2);  int (*nd_compare_function)(unsigned int *a1,unsigned int *a2);
   
 double nd_scale=2;  static double nd_scale=2;
 static unsigned int **nd_bound;  static unsigned int **nd_bound;
 struct order_spec *nd_ord;  static struct order_spec *nd_ord;
 int nd_nvar;  static EPOS nd_epos;
 int nd_isrlex;  static int nd_nvar;
 int nd_epw,nd_bpe,nd_wpd,nd_exporigin;  static int nd_isrlex;
 unsigned int nd_mask[32];  static int nd_epw,nd_bpe,nd_wpd,nd_exporigin;
 unsigned int nd_mask0,nd_mask1;  static unsigned int nd_mask[32];
   static unsigned int nd_mask0,nd_mask1;
   
 NM _nm_free_list;  static NM _nm_free_list;
 ND _nd_free_list;  static ND _nd_free_list;
 ND_pairs _ndp_free_list;  static ND_pairs _ndp_free_list;
   
 static NDV *nd_ps;  static NDV *nd_ps;
 static NDV *nd_psq;  static NDV *nd_psq;
 RHist *nd_psh;  static RHist *nd_psh;
 int nd_psn,nd_pslen;  static int nd_psn,nd_pslen;
   
 RHist *nd_red;  static RHist *nd_red;
   
 int nd_found,nd_create,nd_notfirst;  static int nd_found,nd_create,nd_notfirst;
 int nm_adv;  static int nm_adv;
 int nmv_adv;  static int nmv_adv;
 int nd_dcomp;  static int nd_dcomp;
   
 extern int Top,Reverse,dp_nelim;  extern int Top,Reverse,dp_nelim;
   
Line 114  extern int Top,Reverse,dp_nelim;
Line 121  extern int Top,Reverse,dp_nelim;
 #define SG(a) ((a)->sugar)  #define SG(a) ((a)->sugar)
 #define LEN(a) ((a)->len)  #define LEN(a) ((a)->len)
 #define LCM(a) ((a)->lcm)  #define LCM(a) ((a)->lcm)
   #define GET_EXP(d,a) (((d)[nd_epos[a].i]>>nd_epos[a].s)&nd_mask0)
   #define PUT_EXP(r,a,e) ((r)[nd_epos[a].i] |= ((e)<<nd_epos[a].s))
   
 /* macros for term comparison */  /* macros for term comparison */
 #define TD_DL_COMPARE(d1,d2)\  #define TD_DL_COMPARE(d1,d2)\
Line 2071  void dltondl(int n,DL dl,unsigned int *r)
Line 2080  void dltondl(int n,DL dl,unsigned int *r)
         d = dl->d;          d = dl->d;
         for ( i = 0; i < nd_wpd; i++ ) r[i] = 0;          for ( i = 0; i < nd_wpd; i++ ) r[i] = 0;
         if ( nd_isrlex )          if ( nd_isrlex )
                 for ( i = 0; i < n; i++ )                  for ( i = 0; i < n; i++ ) PUT_EXP(r,n-1-i,d[i]);
                         r[(n-1-i)/nd_epw+nd_exporigin] |= (d[i]<<((nd_epw-((n-1-i)%nd_epw)-1)*nd_bpe));  
         else          else
                 for ( i = 0; i < n; i++ )                  for ( i = 0; i < n; i++ ) PUT_EXP(r,i,d[i]);
                         r[i/nd_epw+nd_exporigin] |= d[i]<<((nd_epw-(i%nd_epw)-1)*nd_bpe);  
         TD(r) = ndl_weight(r);          TD(r) = ndl_weight(r);
 }  }
   
Line 2090  DL ndltodl(int n,unsigned int *ndl)
Line 2097  DL ndltodl(int n,unsigned int *ndl)
         d = dl->d;          d = dl->d;
         if ( nd_isrlex )          if ( nd_isrlex )
                 for ( i = 0; i < n; i++ )                  for ( i = 0; i < n; i++ )
                         d[i] = (ndl[(n-1-i)/nd_epw+nd_exporigin]>>((nd_epw-((n-1-i)%nd_epw)-1)*nd_bpe))                          d[i] = GET_EXP(ndl,n-1-i);
                                 &((1<<nd_bpe)-1);  
         else          else
                 for ( i = 0; i < n; i++ )                  for ( i = 0; i < n; i++ )
                         d[i] = (ndl[i/nd_epw+nd_exporigin]>>((nd_epw-(i%nd_epw)-1)*nd_bpe))                          d[i] = GET_EXP(ndl,i);
                                 &((1<<nd_bpe)-1);  
         return dl;          return dl;
 }  }
   
Line 2153  void ndl_print(unsigned int *dl)
Line 2158  void ndl_print(unsigned int *dl)
         n = nd_nvar;          n = nd_nvar;
         printf("<<");          printf("<<");
         if ( nd_isrlex )          if ( nd_isrlex )
                 for ( i = 0; i < n; i++ )                  for ( i = 0; i < n; i++ ) printf(i==n-1?"%d":"%d,",GET_EXP(dl,n-1-i));
                         printf(i==n-1?"%d":"%d,",  
                                 (dl[(n-1-i)/nd_epw+nd_exporigin]>>((nd_epw-((n-1-i)%nd_epw)-1)*nd_bpe))  
                                         &((1<<nd_bpe)-1));  
         else          else
                 for ( i = 0; i < n; i++ )                  for ( i = 0; i < n; i++ ) printf(i==n-1?"%d":"%d,",GET_EXP(dl,i));
                         printf(i==n-1?"%d":"%d,",  
                                 (dl[i/nd_epw+nd_exporigin]>>((nd_epw-(i%nd_epw)-1)*nd_bpe))  
                                         &((1<<nd_bpe)-1));  
         printf(">>");          printf(">>");
 }  }
   
Line 2432  unsigned int *nd_compute_bound(ND p)
Line 2431  unsigned int *nd_compute_bound(ND p)
         }          }
         l = nd_nvar+31;          l = nd_nvar+31;
         t = (unsigned int *)MALLOC_ATOMIC(l*sizeof(unsigned int));          t = (unsigned int *)MALLOC_ATOMIC(l*sizeof(unsigned int));
         for ( i = 0; i < l; i++ ) t[i] = 0;          for ( i = 0; i < nd_nvar; i++ ) t[i] = GET_EXP(d1,i);
         for ( i = 0; i < nd_nvar; i++ )  
                 t[i] = (d1[i/nd_epw+nd_exporigin]>>((nd_epw-(i%nd_epw)-1)*nd_bpe))&nd_mask0;  
         for ( ; i < l; i++ ) t[i] = 0;          for ( ; i < l; i++ ) t[i] = 0;
         return t;          return t;
 }  }
Line 2470  void nd_setup_parameters() {
Line 2467  void nd_setup_parameters() {
         }          }
         nm_adv = sizeof(struct oNM)+(nd_wpd-1)*sizeof(unsigned int);          nm_adv = sizeof(struct oNM)+(nd_wpd-1)*sizeof(unsigned int);
         nmv_adv = sizeof(struct oNMV)+(nd_wpd-1)*sizeof(unsigned int);          nmv_adv = sizeof(struct oNMV)+(nd_wpd-1)*sizeof(unsigned int);
   
           nd_epos = (EPOS)MALLOC_ATOMIC(nd_nvar*sizeof(struct oEPOS));
           for ( i = 0; i < nd_nvar; i++ ) {
                   nd_epos[i].i = nd_exporigin + i/nd_epw;
                   nd_epos[i].s = (nd_epw-(i%nd_epw)-1)*nd_bpe;
           }
 }  }
   
 ND_pairs nd_reconstruct(int mod,int trace,ND_pairs d)  ND_pairs nd_reconstruct(int mod,int trace,ND_pairs d)

Legend:
Removed from v.1.41  
changed lines
  Added in v.1.42

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