[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.146 and 1.148

version 1.146, 2006/11/27 07:31:25 version 1.148, 2006/11/28 02:17:54
Line 1 
Line 1 
 /* $OpenXM: OpenXM_contrib2/asir2000/engine/nd.c,v 1.145 2006/08/26 05:38:06 noro Exp $ */  /* $OpenXM: OpenXM_contrib2/asir2000/engine/nd.c,v 1.147 2006/11/27 07:54:41 noro Exp $ */
   
 #include "nd.h"  #include "nd.h"
   
Line 1733  int do_diagonalize_trace(int sugar,int m)
Line 1733  int do_diagonalize_trace(int sugar,int m)
 static struct oEGT eg_invdalg;  static struct oEGT eg_invdalg;
 struct oEGT eg_le;  struct oEGT eg_le;
   
   void nd_subst_vector(VL vl,P p,NODE subst,P *r)
   {
           NODE tn;
           P p1;
   
           for ( tn = subst; tn; tn = NEXT(NEXT(tn)) ) {
                   substp(vl,p,BDY(tn),BDY(NEXT(tn)),&p1); p = p1;
           }
           *r = p;
   }
   
 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 1742  NODE nd_gb_trace(int m,int ishomo)
Line 1753  NODE nd_gb_trace(int m,int ishomo)
         ND h,nf,nfq,s,head;          ND h,nf,nfq,s,head;
         NDV nfv,nfqv;          NDV nfv,nfqv;
         Q q,den,num;          Q q,den,num;
           P hc;
         union oNDC dn;          union oNDC dn;
         struct oEGT eg_monic,egm0,egm1;          struct oEGT eg_monic,egm0,egm1;
         int diag_count = 0;          int diag_count = 0;
Line 1803  again:
Line 1815  again:
                         }                          }
                         if ( nfq ) {                          if ( nfq ) {
                                 /* m|HC(nfq) => failure */                                  /* m|HC(nfq) => failure */
                                 if ( !rem(NM(HCQ(nfq)),m) ) return 0;                                  if ( nd_vc ) {
                                           nd_subst_vector(nd_vc,HCP(nfq),nd_subst,&hc); q = (Q)hc;
                                   } else
                                           q = HCQ(nfq);
                                   if ( !rem(NM(q),m) ) return 0;
   
                                 if ( DP_Print ) { printf("+"); fflush(stdout); }                                  if ( DP_Print ) { printf("+"); fflush(stdout); }
                                 if ( nd_nalg ) {                                  if ( nd_nalg ) {
Line 3298  ND nd_copy(ND p)
Line 3314  ND nd_copy(ND p)
   
 int nd_sp(int mod,int trace,ND_pairs p,ND *rp)  int nd_sp(int mod,int trace,ND_pairs p,ND *rp)
 {  {
         NM m;          NM m1,m2;
         NDV p1,p2;          NDV p1,p2;
         ND t1,t2;          ND t1,t2;
         UINT *lcm;          UINT *lcm;
           P gp,tp;
           Q g,t;
         int td;          int td;
   
         if ( !mod && nd_demand ) {          if ( !mod && nd_demand ) {
Line 3314  int nd_sp(int mod,int trace,ND_pairs p,ND *rp)
Line 3332  int nd_sp(int mod,int trace,ND_pairs p,ND *rp)
                 }                  }
         }          }
         lcm = LCM(p);          lcm = LCM(p);
         NEWNM(m);          NEWNM(m1); ndl_sub(lcm,HDL(p1),DL(m1));
         CQ(m) = HCQ(p2);          if ( ndl_check_bound2(p->i1,DL(m1)) ) {
         ndl_sub(lcm,HDL(p1),DL(m));                  FREENM(m1); return 0;
         if ( ndl_check_bound2(p->i1,DL(m)) )  
                 return 0;  
         t1 = ndv_mul_nm(mod,m,p1);  
         if ( mod == -1 ) CM(m) = _chsgnsf(HCM(p1));  
         else if ( mod ) CM(m) = mod-HCM(p1);  
         else chsgnp(HCP(p1),&CP(m));  
         ndl_sub(lcm,HDL(p2),DL(m));  
         if ( ndl_check_bound2(p->i2,DL(m)) ) {  
                 nd_free(t1);  
                 return 0;  
         }          }
         t2 = ndv_mul_nm(mod,m,p2);          NEWNM(m2); ndl_sub(lcm,HDL(p2),DL(m2));
           if ( ndl_check_bound2(p->i2,DL(m2)) ) {
                   FREENM(m1); FREENM(m2); return 0;
           }
   
           if ( mod == -1 ) {
                   CM(m1) = HCM(p2); CM(m2) = _chsgnsf(HCM(p1));
           } else if ( mod ) {
                   CM(m1) = HCM(p2); CM(m2) = mod-HCM(p1);
           } else if ( nd_vc ) {
                   ezgcdpz(nd_vc,HCP(p1),HCP(p2),&gp);
                   divsp(nd_vc,HCP(p2),gp,&CP(m1));
                   divsp(nd_vc,HCP(p1),gp,&tp); chsgnp(tp,&CP(m2));
           } else {
                   igcd_cofactor(HCQ(p1),HCQ(p2),&g,&t,&CQ(m1)); chsgnq(t,&CQ(m2));
           }
           t1 = ndv_mul_nm(mod,m1,p1); t2 = ndv_mul_nm(mod,m2,p2);
         *rp = nd_add(mod,t1,t2);          *rp = nd_add(mod,t1,t2);
         FREENM(m);          FREENM(m1); FREENM(m2);
         return 1;          return 1;
 }  }
   
Line 3710  void ndv_mod(int mod,NDV p)
Line 3734  void ndv_mod(int mod,NDV p)
         NMV t,d;          NMV t,d;
         int r,s,u;          int r,s,u;
         int i,len,dlen;          int i,len,dlen;
           P cp;
         Q c;          Q c;
         P cp,cp1;  
         NODE tn;  
         Obj gfs;          Obj gfs;
   
         if ( !p ) return;          if ( !p ) return;
Line 3730  void ndv_mod(int mod,NDV p)
Line 3753  void ndv_mod(int mod,NDV p)
         else          else
                 for ( t = d = BDY(p), i = 0; i < len; i++, NMV_ADV(t) ) {                  for ( t = d = BDY(p), i = 0; i < len; i++, NMV_ADV(t) ) {
                         if ( nd_vc ) {                          if ( nd_vc ) {
                                 for ( tn = nd_subst, cp = CP(t); tn; tn = NEXT(NEXT(tn)) ) {                                  nd_subst_vector(nd_vc,CP(t),nd_subst,&cp);
                                         substp(nd_vc,cp,BDY(tn),BDY(NEXT(tn)),&cp1); cp = cp1;  
                                 }  
                                 c = (Q)cp;                                  c = (Q)cp;
                         } else                          } else
                                 c = CQ(t);                                  c = CQ(t);

Legend:
Removed from v.1.146  
changed lines
  Added in v.1.148

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