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

Diff for /OpenXM/src/kan96xx/Kan/red.c between version 1.4 and 1.7

version 1.4, 2001/05/04 01:06:25 version 1.7, 2003/08/21 04:45:40
Line 1 
Line 1 
 /* $OpenXM: OpenXM/src/kan96xx/Kan/red.c,v 1.3 2000/02/24 00:27:12 takayama Exp $ */  /* $OpenXM: OpenXM/src/kan96xx/Kan/red.c,v 1.6 2003/08/21 02:30:23 takayama Exp $ */
 #include <stdio.h>  #include <stdio.h>
 #include "datatype.h"  #include "datatype.h"
 #include "extern2.h"  #include "extern2.h"
Line 7 
Line 7 
 #define mymax(p,q) (p>q?p:q)  #define mymax(p,q) (p>q?p:q)
   
 int DebugReductionRed = 0;  int DebugReductionRed = 0;
   int DebugContentReduction = 0;
 extern int Sugar;  extern int Sugar;
   
 struct spValue sp_gen(f,g)  struct spValue sp_gen(f,g)
Line 208  POLY reduction1_gen(f,g,needSyz,c,h)
Line 209  POLY reduction1_gen(f,g,needSyz,c,h)
   struct ring *rp;    struct ring *rp;
   struct spValue sv;    struct spValue sv;
   POLY f2;    POLY f2;
     extern DoCancel;
     static int crcount=0;
   
   if (needSyz) {    if (needSyz) {
     if (f ISZERO) { rp = CurrentRingp; } else {rp = f->m->ringp; }      if (f ISZERO) { rp = CurrentRingp; } else {rp = f->m->ringp; }
     *c = cxx(1,0,0,rp);      *c = cxx(1,0,0,rp);
     *h = ZERO;      *h = ZERO;
   }    }
     if ((DoCancel&4) && (f != POLYNULL)) shouldReduceContent(f,1);
   
   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));
Line 229  POLY reduction1_gen(f,g,needSyz,c,h)
Line 232  POLY reduction1_gen(f,g,needSyz,c,h)
     *h = ppAdd(ppMult(sv.a,*h),sv.b);      *h = ppAdd(ppMult(sv.a,*h),sv.b);
   }    }
   
   
   
   while ((*isReducible)(f,g)) {    while ((*isReducible)(f,g)) {
     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));
Line 242  POLY reduction1_gen(f,g,needSyz,c,h)
Line 247  POLY reduction1_gen(f,g,needSyz,c,h)
       *c = ppMult(sv.a,*c);        *c = ppMult(sv.a,*c);
       *h = ppAdd(ppMult(sv.a,*h),sv.b);        *h = ppAdd(ppMult(sv.a,*h),sv.b);
     }      }
   
           if ((DoCancel&4) && (f != POLYNULL)) {
             if (shouldReduceContent(f,0)) {
                   struct coeff *cont;
                   f = reduceContentOfPoly(f,&cont);
                   shouldReduceContent(f,1);
                   if (DebugContentReduction) {
                     printf("CoNT=%s ",coeffToString(cont));
                     if (crcount % 10 == 0) fflush(NULL);
                     crcount++;
                   }
             }
           }
   
   }    }
   return(f);    return(f);
 }  }
Line 325  POLY reduction_gen(f,gset,needSyz,syzp)
Line 344  POLY reduction_gen(f,gset,needSyz,syzp)
   
   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; }
     cf = cxx(1,0,0,rp);      cf = cxx(1,0,0,rp);
     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 */
   do {    do {
Line 347  POLY reduction_gen(f,gset,needSyz,syzp)
Line 372  POLY reduction_gen(f,gset,needSyz,syzp)
           if (f ISZERO) goto ss;            if (f ISZERO) goto ss;
           if ((*isReducible)(f,set->g[i])) {            if ((*isReducible)(f,set->g[i])) {
             f = (*reduction1)(f,set->g[i],needSyz,&cc,&cg);              f = (*reduction1)(f,set->g[i],needSyz,&cc,&cg);
   
               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 365  POLY reduction_gen(f,gset,needSyz,syzp)
Line 400  POLY reduction_gen(f,gset,needSyz,syzp)
     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 652  POLY reductionCdr_except_grd_i(POLY f,struct gradedPol
Line 696  POLY reductionCdr_except_grd_i(POLY f,struct gradedPol
           if (f ISZERO) goto ss;            if (f ISZERO) goto ss;
           if ((!((grd == skipGrd) && (i == skipi))) && (set->del[i]==0)) {            if ((!((grd == skipGrd) && (i == skipi))) && (set->del[i]==0)) {
             /*  Do not use deleted element.*/              /*  Do not use deleted element.*/
             if ((fs =(*isCdrReducible)(f,set->g[i])) != ZERO) {              if ((fs =(*isCdrReducible)(f,set->g[i])) != ZERO) {
               f = (*reduction1Cdr)(f,fs,set->g[i],needSyz,&cc,&cg);                f = (*reduction1Cdr)(f,fs,set->g[i],needSyz,&cc,&cg);
               /* What is cg? */                /* What is cg? */
               if (needSyz) {                if (needSyz) {

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

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