[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.1 and 1.8

version 1.1, 1999/10/08 02:12:02 version 1.8, 2004/06/12 07:29:46
Line 1 
Line 1 
   /* $OpenXM: OpenXM/src/kan96xx/Kan/poly3.c,v 1.7 2004/02/23 09:03:42 takayama Exp $ */
 #include <stdio.h>  #include <stdio.h>
 #include "datatype.h"  #include "datatype.h"
 #include "extern2.h"  #include "extern2.h"
Line 18  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 27  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);
        MList = (int *)sGC_malloc(sizeof(int)*Lsize*N0);
     */
   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);  
   MList = (int *)malloc(sizeof(int)*Lsize*N0);  
   
   RList = (POLY *)sGC_malloc(sizeof(POLY)*Lsize);    RList = (POLY *)sGC_malloc(sizeof(POLY)*Lsize);
   RListRoot = (POLY *)sGC_malloc(sizeof(POLY)*Lsize);    RListRoot = (POLY *)sGC_malloc(sizeof(POLY)*Lsize);
Line 40  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 65  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 92  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, weightedHomogenization;
   struct coeff *a;    struct coeff *a;
   struct monomial tmp;    struct monomial tmp;
   struct ring *ringp;    struct ring *ringp;
Line 105  POLY f;
Line 106  POLY f;
   
   tmp.ringp = ringp = f->m->ringp;    tmp.ringp = ringp = f->m->ringp;
   n = ringp->n; c = ringp->c; l = ringp->l; m = ringp->m;    n = ringp->n; c = ringp->c; l = ringp->l; m = ringp->m;
     weightedHomogenization = ringp->weightedHomogenization;
   for (k=Plist-1; k>=0; k--) {    for (k=Plist-1; k>=0; k--) {
     /* coeff */      /* coeff */
     a = coeffCopy(CList[k]);      a = coeffCopy(CList[k]);
Line 114  POLY f;
Line 116  POLY f;
     for (i=0; i<n; i++) {      for (i=0; i<n; i++) {
       tmp.e[i] = f->m->e[i];        tmp.e[i] = f->m->e[i];
     }      }
     if (Homogenize) {      if ((!weightedHomogenization) && Homogenize) {
       tmp.e[0].D += EList[k]; /* homogenization.        if (Homogenize == 3) {
                                  e[0].D will be added later. */          tmp.e[0].D += EList[k]/2; /* Double homogenization. */
     }          tmp.e[0].x += EList[k]/2; /* Dx x = x Dx + h H */
         }else{
           tmp.e[0].D += EList[k]; /* homogenization.
                                      e[0].D will be added later. */
         }
       }else if (weightedHomogenization && Homogenize) {
         tmp.e[0].D += EList[k]/2 ; /* homogenization.  Weight is (1,0) (special).
                                                                     */
           }
   
     /* from m to n:  Differential variables. */      /* from m to n:  Differential variables. */
     for (i=0; i<Maxv; i++) {      for (i=0; i<Maxv; i++) {
Line 137  POLY f;
Line 147  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 213  POLY mpMult_diff(POLY f,POLY g)
Line 223  POLY mpMult_diff(POLY f,POLY g)
   return(r);    return(r);
 }  }
   
 POLY mpMult_difference(POLY f,POLY g)  POLY mpMult_difference_org(POLY f,POLY g)
 {  {
   POLY r;    POLY r;
   int m,l;    int m,l;
Line 236  POLY mpMult_difference(POLY f,POLY g)
Line 246  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.1  
changed lines
  Added in v.1.8

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