[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.19 and 1.20

version 1.19, 2019/09/04 05:32:10 version 1.20, 2019/09/15 08:46:12
Line 1 
Line 1 
 /* $OpenXM: OpenXM_contrib2/asir2018/engine/nd.c,v 1.18 2019/09/04 01:12:02 noro Exp $ */  /* $OpenXM: OpenXM_contrib2/asir2018/engine/nd.c,v 1.19 2019/09/04 05:32:10 noro Exp $ */
   
 #include "nd.h"  #include "nd.h"
   
Line 478  int ndl_weight(UINT *d)
Line 478  int ndl_weight(UINT *d)
             for ( j = 0; j < nd_epw; j++, u>>=nd_bpe )              for ( j = 0; j < nd_epw; j++, u>>=nd_bpe )
                 t += (u&nd_mask0);                  t += (u&nd_mask0);
         }          }
     if ( nd_module && current_module_weight_vector && MPOS(d) )      if ( nd_module && nd_module_rank && MPOS(d) )
         t += current_module_weight_vector[MPOS(d)];          t += nd_module_weight[MPOS(d)-1];
       for ( i = nd_exporigin; i < nd_wpd; i++ )
         if ( d[i] && !t )
           printf("afo\n");
     return t;      return t;
 }  }
   
Line 494  int ndl_weight2(UINT *d)
Line 497  int ndl_weight2(UINT *d)
         u = GET_EXP(d,i);          u = GET_EXP(d,i);
         t += nd_sugarweight[i]*u;          t += nd_sugarweight[i]*u;
     }      }
     if ( nd_module && current_module_weight_vector && MPOS(d) )      if ( nd_module && nd_module_rank && MPOS(d) )
         t += current_module_weight_vector[MPOS(d)];          t += nd_module_weight[MPOS(d)-1];
     return t;      return t;
 }  }
   
Line 713  int ndl_module_grlex_compare(UINT *d1,UINT *d2)
Line 716  int ndl_module_grlex_compare(UINT *d1,UINT *d2)
 {  {
     int i,c;      int i,c;
   
     if ( nd_module_rank && (c = ndl_module_weight_compare(d1,d2)) ) return c;  //    if ( nd_module_rank && (c = ndl_module_weight_compare(d1,d2)) ) return c;
     if ( nd_ispot ) {      if ( nd_ispot ) {
       if ( nd_pot_nelim && MPOS(d1)>=nd_pot_nelim+1 && MPOS(d2) >= nd_pot_nelim+1 ) {        if ( nd_pot_nelim && MPOS(d1)>=nd_pot_nelim+1 && MPOS(d2) >= nd_pot_nelim+1 ) {
          if ( TD(d1) > TD(d2) ) return 1;           if ( TD(d1) > TD(d2) ) return 1;
Line 740  int ndl_module_glex_compare(UINT *d1,UINT *d2)
Line 743  int ndl_module_glex_compare(UINT *d1,UINT *d2)
 {  {
     int i,c;      int i,c;
   
     if ( nd_module_rank && (c = ndl_module_weight_compare(d1,d2)) ) return c;  //    if ( nd_module_rank && (c = ndl_module_weight_compare(d1,d2)) ) return c;
     if ( nd_ispot ) {      if ( nd_ispot ) {
         if ( MPOS(d1) < MPOS(d2) ) return 1;          if ( MPOS(d1) < MPOS(d2) ) return 1;
         else if ( MPOS(d1) > MPOS(d2) ) return -1;          else if ( MPOS(d1) > MPOS(d2) ) return -1;
Line 759  int ndl_module_lex_compare(UINT *d1,UINT *d2)
Line 762  int ndl_module_lex_compare(UINT *d1,UINT *d2)
 {  {
     int i,c;      int i,c;
   
     if ( nd_module_rank && (c = ndl_module_weight_compare(d1,d2)) ) return c;  //    if ( nd_module_rank && (c = ndl_module_weight_compare(d1,d2)) ) return c;
     if ( nd_ispot ) {      if ( nd_ispot ) {
         if ( MPOS(d1) < MPOS(d2) ) return 1;          if ( MPOS(d1) < MPOS(d2) ) return 1;
         else if ( MPOS(d1) > MPOS(d2) ) return -1;          else if ( MPOS(d1) > MPOS(d2) ) return -1;
Line 776  int ndl_module_block_compare(UINT *d1,UINT *d2)
Line 779  int ndl_module_block_compare(UINT *d1,UINT *d2)
 {  {
     int i,c;      int i,c;
   
     if ( nd_module_rank && (c = ndl_module_weight_compare(d1,d2)) ) return c;  //    if ( nd_module_rank && (c = ndl_module_weight_compare(d1,d2)) ) return c;
     if ( nd_ispot ) {      if ( nd_ispot ) {
         if ( MPOS(d1) < MPOS(d2) ) return 1;          if ( MPOS(d1) < MPOS(d2) ) return 1;
         else if ( MPOS(d1) > MPOS(d2) ) return -1;          else if ( MPOS(d1) > MPOS(d2) ) return -1;
Line 793  int ndl_module_matrix_compare(UINT *d1,UINT *d2)
Line 796  int ndl_module_matrix_compare(UINT *d1,UINT *d2)
 {  {
     int i,c;      int i,c;
   
     if ( nd_module_rank && (c = ndl_module_weight_compare(d1,d2)) ) return c;  //    if ( nd_module_rank && (c = ndl_module_weight_compare(d1,d2)) ) return c;
     if ( nd_ispot ) {      if ( nd_ispot ) {
         if ( MPOS(d1) < MPOS(d2) ) return 1;          if ( MPOS(d1) < MPOS(d2) ) return 1;
         else if ( MPOS(d1) > MPOS(d2) ) return -1;          else if ( MPOS(d1) > MPOS(d2) ) return -1;
Line 810  int ndl_module_composite_compare(UINT *d1,UINT *d2)
Line 813  int ndl_module_composite_compare(UINT *d1,UINT *d2)
 {  {
     int i,c;      int i,c;
   
     if ( nd_module_rank && (c = ndl_module_weight_compare(d1,d2)) ) return c;  //    if ( nd_module_rank && (c = ndl_module_weight_compare(d1,d2)) ) return c;
     if ( nd_ispot ) {      if ( nd_ispot ) {
         if ( MPOS(d1) > MPOS(d2) ) return 1;          if ( MPOS(d1) > MPOS(d2) ) return 1;
         else if ( MPOS(d1) < MPOS(d2) ) return -1;          else if ( MPOS(d1) < MPOS(d2) ) return -1;
Line 5538  NODE dpm_sort_list(NODE l)
Line 5541  NODE dpm_sort_list(NODE l)
   return t;    return t;
 }  }
   
   int nmv_comp(NMV a,NMV b)
   {
     return -DL_COMPARE(a->dl,b->dl);
   }
   
 NDV dpmtondv(int mod,DPM p)  NDV dpmtondv(int mod,DPM p)
 {  {
   NDV d;    NDV d;
Line 5562  NDV dpmtondv(int mod,DPM p)
Line 5570  NDV dpmtondv(int mod,DPM p)
   for ( i = 0; i < len; i++, NMV_ADV(m) ) {    for ( i = 0; i < len; i++, NMV_ADV(m) ) {
     dltondl(n,a[i]->dl,DL(m));      dltondl(n,a[i]->dl,DL(m));
     MPOS(DL(m)) = a[i]->pos;      MPOS(DL(m)) = a[i]->pos;
       TD(DL(m)) = ndl_weight(DL(m));
     CZ(m) = (Z)a[i]->c;      CZ(m) = (Z)a[i]->c;
   }    }
     qsort(m0,len,nmv_adv,(int (*)(const void *,const void *))nmv_comp);
   MKNDV(NV(p),m0,len,d);    MKNDV(NV(p),m0,len,d);
   SG(d) = SG(p);    SG(d) = SG(p);
   return d;    return d;
Line 7865  int ndv_ishomo(NDV p)
Line 7875  int ndv_ishomo(NDV p)
     h = TD(DL(m));      h = TD(DL(m));
     NMV_ADV(m);      NMV_ADV(m);
     for ( len--; len; len--, NMV_ADV(m) )      for ( len--; len; len--, NMV_ADV(m) )
         if ( TD(DL(m)) != h ) return 0;          if ( TD(DL(m)) != h ) {
             return 0;
           }
     return 1;      return 1;
 }  }
   

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.20

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