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

Diff for /OpenXM/src/kan96xx/Kan/sugar.c between version 1.3 and 1.5

version 1.3, 2001/05/04 01:06:25 version 1.5, 2003/08/21 02:30:23
Line 1 
Line 1 
 /* $OpenXM: OpenXM/src/kan96xx/Kan/sugar.c,v 1.2 2000/01/16 07:55:41 takayama Exp $ */  /* $OpenXM: OpenXM/src/kan96xx/Kan/sugar.c,v 1.4 2003/05/01 01:58:05 takayama Exp $ */
 #include <stdio.h>  #include <stdio.h>
 #include "datatype.h"  #include "datatype.h"
 #include "extern2.h"  #include "extern2.h"
Line 6 
Line 6 
   
 #define mymax(p,q) (p>q?p:q)  #define mymax(p,q) (p>q?p:q)
   
 static int DebugReduction = 0;  /* static int DebugReduction = 0;
   */
   extern DebugReductionRed;
   extern DebugContentReduction;
   
 POLY reduction_sugar(POLY f,struct gradedPolySet *gset,int needSyz,  POLY reduction_sugar(POLY f,struct gradedPolySet *gset,int needSyz,
                      struct syz0 *syzp,int sugarGrade)                       struct syz0 *syzp,int sugarGrade)
Line 22  POLY reduction_sugar(POLY f,struct gradedPolySet *gset
Line 25  POLY reduction_sugar(POLY f,struct gradedPolySet *gset
   
   extern struct ring *CurrentRingp;    extern struct ring *CurrentRingp;
   struct ring *rp;    struct ring *rp;
     extern DoCancel;
   
   if (needSyz) {    if (needSyz) {
     if (f ISZERO) { rp = CurrentRingp; } else { rp = f->m->ringp; }      if (f ISZERO) { rp = CurrentRingp; } else { rp = f->m->ringp; }
Line 29  POLY reduction_sugar(POLY f,struct gradedPolySet *gset
Line 33  POLY reduction_sugar(POLY f,struct gradedPolySet *gset
     syz = ZERO;      syz = ZERO;
   }    }
   
     if (needSyz && DoCancel) {
           warningGradedSet("needSyz is not supported when DoCancel is turned on. DoCancel is set to 0.\n");
           DoCancel = 0;
     }
     if (DoCancel && (f != POLYNULL)) shouldReduceContent(f,1);
   
   reduced = 0; /* no */    reduced = 0; /* no */
   /* Take minimum */    /* Take minimum */
   gradelimit = (gset->maxGrade < sugarGrade+1 ?gset->maxGrade: sugarGrade+1);    gradelimit = (gset->maxGrade < sugarGrade+1 ?gset->maxGrade: sugarGrade+1);
Line 46  POLY reduction_sugar(POLY f,struct gradedPolySet *gset
Line 56  POLY reduction_sugar(POLY f,struct gradedPolySet *gset
             /* Reduce if and only if sugarGrade does not increase. */              /* Reduce if and only if sugarGrade does not increase. */
             if (tdegm+grd <= sugarGrade) {              if (tdegm+grd <= sugarGrade) {
               f = reduction1_sugar(f,set->g[i],needSyz,&cc,&cg,sugarGrade);                f = reduction1_sugar(f,set->g[i],needSyz,&cc,&cg,sugarGrade);
   
                 if (DoCancel && (f != POLYNULL)) {
                   if (shouldReduceContent(f,0)) {
                     struct coeff *cont;
                     f = reduceContentOfPoly(f,&cont);
                     shouldReduceContent(f,1);
                     if (DebugContentReduction) printf("CONT=%s ",coeffToString(cont));
                   }
                 }
   
               if (needSyz) {                if (needSyz) {
                 cf = ppMult(cc,cf);                  cf = ppMult(cc,cf);
                 syz = cpMult(toSyzCoeff(cc),syz);                  syz = cpMult(toSyzCoeff(cc),syz);
Line 65  POLY reduction_sugar(POLY f,struct gradedPolySet *gset
Line 85  POLY reduction_sugar(POLY f,struct gradedPolySet *gset
     syzp->cf = cf;   /* cf is in the CurrentRingp */      syzp->cf = cf;   /* cf is in the CurrentRingp */
     syzp->syz = syz; /* syz is in the SyzRingp */      syzp->syz = syz; /* syz is in the SyzRingp */
   }    }
   
     if (DoCancel && (f != POLYNULL)) {
       if (f->m->ringp->p == 0) {
             struct coeff *cont;
             f = reduceContentOfPoly(f,&cont);
             if (DebugContentReduction) printf("cont=%s ",coeffToString(cont));
       }
     }
   
   return(f);    return(f);
 }  }
   
Line 92  POLY reduction1_sugar(f,g,needSyz,c,h,sugarGrade)
Line 121  POLY reduction1_sugar(f,g,needSyz,c,h,sugarGrade)
   
   sv = (*sp)(f,g);    sv = (*sp)(f,g);
   f2 = ppAddv(cpMult((sv.a)->coeffp,f),ppMult(sv.b,g));    f2 = ppAddv(cpMult((sv.a)->coeffp,f),ppMult(sv.b,g));
   if (DebugReduction) {    if (DebugReductionRed) {
     printf("c=%s, d=%s, g=%s:  f --> c*f + d*g.\n",      printf("c=%s, d=%s, g=%s:  f --> c*f + d*g.\n",
            POLYToString(sv.a,'*',1),POLYToString(sv.b,'*',1),POLYToString(g,'*',1));             POLYToString(sv.a,'*',1),POLYToString(sv.b,'*',1),POLYToString(g,'*',1));
     printf("%s --> %s\n",POLYToString(f,'*',1),POLYToString(f2,'*',1));      printf("%s --> %s\n",POLYToString(f,'*',1),POLYToString(f2,'*',1));
Line 110  POLY reduction1_sugar(f,g,needSyz,c,h,sugarGrade)
Line 139  POLY reduction1_sugar(f,g,needSyz,c,h,sugarGrade)
     if (tdegm+grd <= sugarGrade) {      if (tdegm+grd <= sugarGrade) {
       sv = (*sp)(f,g);        sv = (*sp)(f,g);
       f2 = ppAddv(cpMult((sv.a)->coeffp,f),ppMult(sv.b,g));        f2 = ppAddv(cpMult((sv.a)->coeffp,f),ppMult(sv.b,g));
       if (DebugReduction) {        if (DebugReductionRed) {
         printf("! c=%s, d=%s, g=%s:  f --> c*f + d*g.\n",          printf("! c=%s, d=%s, g=%s:  f --> c*f + d*g.\n",
                POLYToString(sv.a,'*',1),POLYToString(sv.b,'*',1),POLYToString(g,'*',1));                 POLYToString(sv.a,'*',1),POLYToString(sv.b,'*',1),POLYToString(g,'*',1));
         printf("%s --> %s\n",POLYToString(f,'*',1),POLYToString(f2,'*',1));          printf("%s --> %s\n",POLYToString(f,'*',1),POLYToString(f2,'*',1));

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.5

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