[BACK]Return to poly3.c CVS log [TXT][DIR] Up to [local] / OpenXM / src / kan96xx / Kan

Diff for /OpenXM/src/kan96xx/Kan/poly3.c between version 1.2 and 1.4

version 1.2, 2000/01/16 07:55:40 version 1.4, 2002/02/04 07:58:28
Line 1 
Line 1 
 /* $OpenXM$ */  /* $OpenXM: OpenXM/src/kan96xx/Kan/poly3.c,v 1.3 2001/05/04 01:06:25 takayama Exp $ */
 #include <stdio.h>  #include <stdio.h>
 #include "datatype.h"  #include "datatype.h"
 #include "extern2.h"  #include "extern2.h"
Line 19  static int Maxv;
Line 19  static int Maxv;
 static POLY *RList;  static POLY *RList;
 static POLY *RListRoot;  static POLY *RListRoot;
 static struct coeff *Tc = (struct coeff *)NULL;  static struct coeff *Tc = (struct coeff *)NULL;
      /* It is initialized in mpMult_diff() */  /* It is initialized in mpMult_diff() */
   
 void initT(void) {  void initT(void) {
   int i;    int i;
Line 28  void initT(void) {
Line 28  void initT(void) {
   EList = (int *)sGC_malloc(sizeof(int)*Lsize);    EList = (int *)sGC_malloc(sizeof(int)*Lsize);
   Mark = (int *)sGC_malloc(sizeof(int)*Lsize);    Mark = (int *)sGC_malloc(sizeof(int)*Lsize);
   /* The following line causes the warning 'needed to allocate blacklisted..'    /* The following line causes the warning 'needed to allocate blacklisted..'
   DList = (int *)sGC_malloc(sizeof(int)*Lsize*N0);       DList = (int *)sGC_malloc(sizeof(int)*Lsize*N0);
   MList = (int *)sGC_malloc(sizeof(int)*Lsize*N0);       MList = (int *)sGC_malloc(sizeof(int)*Lsize*N0);
   */    */
   DList = (int *)malloc(sizeof(int)*Lsize*N0);    DList = (int *)malloc(sizeof(int)*Lsize*N0);
   MList = (int *)malloc(sizeof(int)*Lsize*N0);    MList = (int *)malloc(sizeof(int)*Lsize*N0);
Line 41  void initT(void) {
Line 41  void initT(void) {
 }  }
   
 void makeTable(c,e,ringp)  void makeTable(c,e,ringp)
 struct coeff *c; /* read only */       struct coeff *c; /* read only */
 struct exps e[];       struct exps e[];
 struct ring *ringp;       struct ring *ringp;
 {  {
   int i,j,k,p,q,deg,m,n;    int i,j,k,p,q,deg,m,n;
   m = ringp->m; n = ringp->n;    m = ringp->m; n = ringp->n;
Line 66  struct ring *ringp;
Line 66  struct ring *ringp;
     /* Copy j-th row to k-th row and modify it. */      /* Copy j-th row to k-th row and modify it. */
     for (j=0; j<Plist; j++) {      for (j=0; j<Plist; j++) {
       for (q=1; q<=DList[I(j,i)]; q++) {        for (q=1; q<=DList[I(j,i)]; q++) {
         for (p=0; p<Maxv; p++) { /* copy */          for (p=0; p<Maxv; p++) { /* copy */
           DList[I(k,p)] = DList[I(j,p)];            DList[I(k,p)] = DList[I(j,p)];
           MList[I(k,p)] = MList[I(j,p)];            MList[I(k,p)] = MList[I(j,p)];
         }          }
         /* modify */          /* modify */
         DList[I(k,i)] -= q;          DList[I(k,i)] -= q;
         MList[I(k,i)] += q;          MList[I(k,i)] += q;
   
         CiiComb(Tc,DList[I(j,i)],q);          CiiComb(Tc,DList[I(j,i)],q);
         /* Tc->val.bigp is read only. */          /* Tc->val.bigp is read only. */
         CList[k] = coeffCopy(Tc);          CList[k] = coeffCopy(Tc);
         Cmult(CList[k],CList[k],CList[j]);          Cmult(CList[k],CList[k],CList[j]);
         /*CList[k] = normalize(CList[j]*BiiComb(DList[I(j,i)],q));*/          /*CList[k] = normalize(CList[j]*BiiComb(DList[I(j,i)],q));*/
   
         EList[k] = EList[j]-2*q;          EList[k] = EList[j]-2*q;
         Mark[k] = 0;          Mark[k] = 0;
         k++;          k++;
         if (k>= Lsize) {          if (k>= Lsize) {
           errorPoly("makeTable(): Lsize is not large enough.\n");            errorPoly("makeTable(): Lsize is not large enough.\n");
         }          }
       }        }
     }      }
     Plist = k;      Plist = k;
Line 93  struct ring *ringp;
Line 93  struct ring *ringp;
 }  }
   
 void monomialMult_diff(e,f)  void monomialMult_diff(e,f)
 struct exps e[];       struct exps e[];
 POLY f;       POLY f;
 /* (e) * f = [Plist] monomials  */       /* (e) * f = [Plist] monomials  */
 {  {
   
   int n,k,c,l,q,i,m;    int n,k,c,l,q,i,m;
Line 117  POLY f;
Line 117  POLY f;
     }      }
     if (Homogenize) {      if (Homogenize) {
       tmp.e[0].D += EList[k]; /* homogenization.        tmp.e[0].D += EList[k]; /* homogenization.
                                  e[0].D will be added later. */                                   e[0].D will be added later. */
     }      }
   
     /* from m to n:  Differential variables. */      /* from m to n:  Differential variables. */
Line 138  POLY f;
Line 138  POLY f;
     if (l-c > 0) {      if (l-c > 0) {
       q =0;        q =0;
       for (i=c; i<l; i++) {        for (i=c; i<l; i++) {
         q += (e[i].D)*(tmp.e[i].x);  /* Don't repeat these things. */          q += (e[i].D)*(tmp.e[i].x);  /* Don't repeat these things. */
         tmp.e[i].D += e[i].D;          tmp.e[i].D += e[i].D;
       }        }
       /*printf("l=%d, q=%d\n",l,q);*/        /*printf("l=%d, q=%d\n",l,q);*/
       if (ringp->next == (struct ring *)NULL) {        if (ringp->next == (struct ring *)NULL) {
         tmp.e[0].x += q;          tmp.e[0].x += q;
       }else{        }else{
         Cmult(a,a,polyToCoeff(cxx(1,0,q,ringp->next),ringp));          Cmult(a,a,polyToCoeff(cxx(1,0,q,ringp->next),ringp));
                               /* x[0]^q */          /* x[0]^q */
       }        }
     }      }
   
Line 176  POLY f;
Line 176  POLY f;
   
 /* Note that you cannot call mpMult_diff recursively. */  /* Note that you cannot call mpMult_diff recursively. */
 /* Note also that mpMult_diff assumes coefficients and Dx commutes each other*/  /* Note also that mpMult_diff assumes coefficients and Dx commutes each other*/
 POLY mpMult_diff(POLY f,POLY g)  POLY mpMult_diff_org(POLY f,POLY g)
 {  {
   int k;    int k;
   POLY r,temp;    POLY r,temp;
Line 237  POLY mpMult_difference(POLY f,POLY g)
Line 237  POLY mpMult_difference(POLY f,POLY g)
     if (f->m->e[i].D) {      if (f->m->e[i].D) {
       lRule[size] = cxx(1,i,1,f->m->ringp);        lRule[size] = cxx(1,i,1,f->m->ringp);
       if (Homogenize) {        if (Homogenize) {
         rRule[size] = ppAdd(cxx(1,i,1,f->m->ringp),cdd(f->m->e[i].D,0,1,f->m->ringp));          rRule[size] = ppAdd(cxx(1,i,1,f->m->ringp),cdd(f->m->e[i].D,0,1,f->m->ringp));
                            /* x_i               + e[i].D  h */          /* x_i               + e[i].D  h */
       }else{        }else{
         rRule[size] = ppAdd(cxx(1,i,1,f->m->ringp),cdd(f->m->e[i].D,0,0,f->m->ringp));          rRule[size] = ppAdd(cxx(1,i,1,f->m->ringp),cdd(f->m->e[i].D,0,0,f->m->ringp));
                            /* x_i               + e[i].D   */          /* x_i               + e[i].D   */
       }        }
       size++;        size++;
     }      }
   }    }

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.4

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