[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.88 and 1.91

version 1.88, 2003/12/24 02:20:19 version 1.91, 2004/03/13 07:32:08
Line 1 
Line 1 
 /* $OpenXM: OpenXM_contrib2/asir2000/engine/nd.c,v 1.87 2003/11/05 08:02:45 noro Exp $ */  /* $OpenXM: OpenXM_contrib2/asir2000/engine/nd.c,v 1.90 2004/03/13 06:49:15 noro Exp $ */
   
 #include "ca.h"  #include "ca.h"
 #include "parse.h"  #include "parse.h"
Line 146  static int nd_psn,nd_pslen;
Line 146  static int nd_psn,nd_pslen;
 static RHist *nd_red;  static RHist *nd_red;
   
 static int nd_found,nd_create,nd_notfirst;  static int nd_found,nd_create,nd_notfirst;
 static int nm_adv;  
 static int nmv_adv;  static int nmv_adv;
 static int nd_dcomp;  static int nd_dcomp;
 static int nd_demand;  static int nd_demand;
   
 extern struct order_spec dp_current_spec;  extern struct order_spec *dp_current_spec;
 extern char *Demand;  extern char *Demand;
 extern VL CO;  extern VL CO;
 extern int Top,Reverse,DP_Print,dp_nelim,do_weyl,NoSugar;  extern int Top,Reverse,DP_Print,dp_nelim,do_weyl,NoSugar;
Line 179  extern int *current_weyl_weight_vector;
Line 178  extern int *current_weyl_weight_vector;
 #define GET_EXP_OLD(d,a) (((d)[oepos[a].i]>>oepos[a].s)&omask0)  #define GET_EXP_OLD(d,a) (((d)[oepos[a].i]>>oepos[a].s)&omask0)
 #define PUT_EXP_OLD(r,a,e) ((r)[oepos[a].i] |= ((e)<<oepos[a].s))  #define PUT_EXP_OLD(r,a,e) ((r)[oepos[a].i] |= ((e)<<oepos[a].s))
   
   #define ROUND_FOR_ALIGN(s) ((((s)+sizeof(void *)-1)/sizeof(void *))*sizeof(void *))
   
 /* macros for term comparison */  /* macros for term comparison */
 #define TD_DL_COMPARE(d1,d2)\  #define TD_DL_COMPARE(d1,d2)\
 (TD(d1)>TD(d2)?1:(TD(d1)<TD(d2)?-1:ndl_lex_compare(d1,d2)))  (TD(d1)>TD(d2)?1:(TD(d1)<TD(d2)?-1:ndl_lex_compare(d1,d2)))
Line 1857  again:
Line 1858  again:
         return g;          return g;
 }  }
   
   void do_diagonalize(int sugar,int m)
   {
           int i,nh,stat;
           NODE r,g,t;
           ND h,nf,nfq,s,head;
           NDV nfv,nfqv;
           Q q,den,num;
           union oNDC dn;
   
           for ( i = nd_psn-1; i >= 0 && SG(nd_psh[i]) == sugar; i-- ) {
                   /* for nd_ps */
                   s = ndvtond(m,nd_ps[i]);
                   s = nd_separate_head(s,&head);
                   nd_nf_pbucket(m,s,nd_ps,1,&nf);
                   nf = nd_add(m,head,nf);
                   ndv_free(nd_ps[i]);
                   nd_ps[i] = ndtondv(m,nf);
                   nd_free(nf);
   
                   /* for nd_ps_trace */
                   if ( nd_demand )
                           nfv = ndv_load(i);
                   else
                           nfv = nd_ps_trace[i];
                   s = ndvtond(0,nfv);
                   s = nd_separate_head(s,&head);
                   nd_nf(0,s,nd_ps_trace,1,&dn,&nf);
                   NTOQ(NM(dn.z),SGN(dn.z),num);
                   mulq(HCQ(head),num,&q); HCQ(head) = q;
                   if ( DN(dn.z) ) {
                           NTOQ(DN(dn.z),1,den);
                           nd_mul_c_q(nf,den);
                   }
                   nf = nd_add(0,head,nf);
                   ndv_free(nfv);
                   nd_removecont(0,nf);
                   nfv = ndtondv(0,nf);
                   nd_free(nf);
                   nd_bound[i] = ndv_compute_bound(nfv);
                   if ( nd_demand ) {
                           ndv_save(nfv,i);
                           ndv_free(nfv);
                   } else
                           nd_ps_trace[i] = nfv;
           }
   }
   
 NODE nd_gb_trace(int m,int ishomo)  NODE nd_gb_trace(int m,int ishomo)
 {  {
         int i,nh,sugar,stat;          int i,nh,sugar,stat;
Line 1878  NODE nd_gb_trace(int m,int ishomo)
Line 1926  NODE nd_gb_trace(int m,int ishomo)
 again:  again:
                 l = nd_minp(d,&d);                  l = nd_minp(d,&d);
                 if ( SG(l) != sugar ) {                  if ( SG(l) != sugar ) {
                         if ( ishomo ) {                          if ( ishomo ) do_diagonalize(sugar,m);
                                 for ( i = nd_psn-1; i >= 0 && SG(nd_psh[i]) == sugar; i-- ) {  
                                         /* for nd_ps */  
                                         s = ndvtond(m,nd_ps[i]);  
                                         s = nd_separate_head(s,&head);  
                                         nd_nf_pbucket(m,s,nd_ps,1,&nf);  
                                         nf = nd_add(m,head,nf);  
                                         ndv_free(nd_ps[i]);  
                                         nd_ps[i] = ndtondv(m,nf);  
                                         nd_free(nf);  
   
                                         /* for nd_ps_trace */  
                                         if ( nd_demand )  
                                                 nfv = ndv_load(i);  
                                         else  
                                                 nfv = nd_ps_trace[i];  
                                         s = ndvtond(0,nfv);  
                                         s = nd_separate_head(s,&head);  
                                         nd_nf(0,s,nd_ps_trace,1,&dn,&nf);  
                                         NTOQ(NM(dn.z),SGN(dn.z),num);  
                                         mulq(HCQ(head),num,&q); HCQ(head) = q;  
                                         if ( DN(dn.z) ) {  
                                                 NTOQ(DN(dn.z),1,den);  
                                                 nd_mul_c_q(nf,den);  
                                         }  
                                         nf = nd_add(0,head,nf);  
                                         ndv_free(nfv);  
                                         nd_removecont(0,nf);  
                                         nfv = ndtondv(0,nf);  
                                         nd_free(nf);  
                                         nd_bound[i] = ndv_compute_bound(nfv);  
                                         if ( nd_demand ) {  
                                                 ndv_save(nfv,i);  
                                                 ndv_free(nfv);  
                                         } else  
                                                 nd_ps_trace[i] = nfv;  
                                 }  
                         }  
                         sugar = SG(l);                          sugar = SG(l);
                         if ( DP_Print ) fprintf(asir_out,"%d",sugar);                          if ( DP_Print ) fprintf(asir_out,"%d",sugar);
                 }                  }
Line 2446  void nd_gr(LIST f,LIST v,int m,int f4,struct order_spe
Line 2457  void nd_gr(LIST f,LIST v,int m,int f4,struct order_spe
   
 void nd_gr_trace(LIST f,LIST v,int trace,int homo,struct order_spec *ord,LIST *rp)  void nd_gr_trace(LIST f,LIST v,int trace,int homo,struct order_spec *ord,LIST *rp)
 {  {
         struct order_spec ord1;          struct order_spec *ord1;
         VL tv,fv,vv,vc;          VL tv,fv,vv,vc;
         NODE fd,fd0,in0,in,r,r0,t,s,cand;          NODE fd,fd0,in0,in,r,r0,t,s,cand;
         int m,nocheck,nvar,mindex,e,max;          int m,nocheck,nvar,mindex,e,max;
Line 2505  void nd_gr_trace(LIST f,LIST v,int trace,int homo,stru
Line 2516  void nd_gr_trace(LIST f,LIST v,int trace,int homo,stru
                                 wmax = MAX(TD(DL(a)),wmax);                                  wmax = MAX(TD(DL(a)),wmax);
                 }                  }
                 homogenize_order(ord,nvar,&ord1);                  homogenize_order(ord,nvar,&ord1);
                 nd_init_ord(&ord1);                  nd_init_ord(ord1);
                 nd_setup_parameters(nvar+1,wmax);                  nd_setup_parameters(nvar+1,wmax);
                 for ( t = fd0; t; t = NEXT(t) )                  for ( t = fd0; t; t = NEXT(t) )
                         ndv_homogenize((NDV)BDY(t),obpe,oadv,oepos);                          ndv_homogenize((NDV)BDY(t),obpe,oadv,oepos);
Line 2544  void nd_gr_trace(LIST f,LIST v,int trace,int homo,stru
Line 2555  void nd_gr_trace(LIST f,LIST v,int trace,int homo,stru
                         m = get_lprime(++mindex);                          m = get_lprime(++mindex);
                         /* reset the parameters */                          /* reset the parameters */
                         if ( !ishomo && homo ) {                          if ( !ishomo && homo ) {
                                 nd_init_ord(&ord1);                                  nd_init_ord(ord1);
                                 nd_setup_parameters(nvar+1,wmax);                                  nd_setup_parameters(nvar+1,wmax);
                         } else {                          } else {
                                 nd_init_ord(ord);                                  nd_init_ord(ord);
Line 2775  void ndv_dehomogenize(NDV p,struct order_spec *ord)
Line 2786  void ndv_dehomogenize(NDV p,struct order_spec *ord)
         for ( m = BDY(p), i = 0; i < len; NMV_ADV(m), i++ )          for ( m = BDY(p), i = 0; i < len; NMV_ADV(m), i++ )
                 ndl_dehomogenize(DL(m));                  ndl_dehomogenize(DL(m));
         if ( newwpd != nd_wpd ) {          if ( newwpd != nd_wpd ) {
                 newadv = sizeof(struct oNMV)+(newwpd-1)*sizeof(UINT);                  newadv = ROUND_FOR_ALIGN(sizeof(struct oNMV)+(newwpd-1)*sizeof(UINT));
                 for ( m = r = BDY(p), i = 0; i < len; NMV_ADV(m), NDV_NADV(r), i++ ) {                  for ( m = r = BDY(p), i = 0; i < len; NMV_ADV(m), NDV_NADV(r), i++ ) {
                         CQ(r) = CQ(m);                          CQ(r) = CQ(m);
                         for ( j = 0; j < newexporigin; j++ ) DL(r)[j] = DL(m)[j];                          for ( j = 0; j < newexporigin; j++ ) DL(r)[j] = DL(m)[j];
Line 2971  void nd_setup_parameters(int nvar,int max) {
Line 2982  void nd_setup_parameters(int nvar,int max) {
                 nd_mask[nd_epw-i-1] = (nd_mask0<<(i*nd_bpe));                  nd_mask[nd_epw-i-1] = (nd_mask0<<(i*nd_bpe));
                 nd_mask1 |= (1<<(nd_bpe-1))<<(i*nd_bpe);                  nd_mask1 |= (1<<(nd_bpe-1))<<(i*nd_bpe);
         }          }
         nm_adv = sizeof(struct oNM)+(nd_wpd-1)*sizeof(UINT);          nmv_adv = ROUND_FOR_ALIGN(sizeof(struct oNMV)+(nd_wpd-1)*sizeof(UINT));
         nmv_adv = sizeof(struct oNMV)+(nd_wpd-1)*sizeof(UINT);  
         nd_epos = nd_create_epos(nd_ord);          nd_epos = nd_create_epos(nd_ord);
         nd_blockmask = nd_create_blockmask(nd_ord);          nd_blockmask = nd_create_blockmask(nd_ord);
 }  }
Line 4433  NODE nd_f4_red_dist(int m,ND_pairs sp0,UINT *s0vect,in
Line 4443  NODE nd_f4_red_dist(int m,ND_pairs sp0,UINT *s0vect,in
         nd_send_int(nd_wpd);          nd_send_int(nd_wpd);
         nd_send_int(nmv_adv);          nd_send_int(nmv_adv);
   
         saveobj(nd_write,dp_current_spec.obj); fflush(nd_write);          saveobj(nd_write,dp_current_spec->obj); fflush(nd_write);
   
         nd_send_int(nd_psn);          nd_send_int(nd_psn);
         for ( i = 0; i < nd_psn; i++ ) nd_send_ndv(nd_ps[i]);          for ( i = 0; i < nd_psn; i++ ) nd_send_ndv(nd_ps[i]);
Line 4479  void nd_exec_f4_red_dist()
Line 4489  void nd_exec_f4_red_dist()
         ND_pairs *sp0;          ND_pairs *sp0;
         int *colstat;          int *colstat;
         int a,sprow,rank;          int a,sprow,rank;
         struct order_spec ord;          struct order_spec *ord;
         Obj ordspec;          Obj ordspec;
         ND spol;          ND spol;
         int maxrs;          int maxrs;
Line 4494  void nd_exec_f4_red_dist()
Line 4504  void nd_exec_f4_red_dist()
         nmv_adv = nd_recv_int();          nmv_adv = nd_recv_int();
   
         loadobj(nd_read,&ordspec);          loadobj(nd_read,&ordspec);
         create_order_spec(ordspec,&ord);          create_order_spec(0,ordspec,&ord);
         nd_init_ord(&ord);          nd_init_ord(ord);
         nd_setup_parameters(nd_nvar,0);          nd_setup_parameters(nd_nvar,0);
   
         nd_psn = nd_recv_int();          nd_psn = nd_recv_int();

Legend:
Removed from v.1.88  
changed lines
  Added in v.1.91

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