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

Diff for /OpenXM/src/kan96xx/Kan/gb.c between version 1.8 and 1.14

version 1.8, 2003/08/19 08:02:09 version 1.14, 2020/10/06 11:33:46
Line 1 
Line 1 
 /* $OpenXM: OpenXM/src/kan96xx/Kan/gb.c,v 1.7 2003/07/30 09:00:52 takayama Exp $ */  /* $OpenXM: OpenXM/src/kan96xx/Kan/gb.c,v 1.13 2005/07/07 02:59:47 takayama Exp $ */
 /*  untabify on May 4, 2001 */  /*  untabify on May 4, 2001 */
 #include <stdio.h>  #include <stdio.h>
   #include <string.h>
 #include "datatype.h"  #include "datatype.h"
 #include "extern2.h"  #include "extern2.h"
 #include "matrix.h"  #include "matrix.h"
Line 162  struct gradedPairs *updatePairs(grD,gt,gtGrade,t,grG)
Line 163  struct gradedPairs *updatePairs(grD,gt,gtGrade,t,grG)
   return(grD);    return(grD);
 }  }
   
 struct gradedPolySet *groebner_gen(f,needBack,needSyz,grP,countDown,forceReduction)  struct gradedPolySet *groebner_gen(f,needBack,needSyz,grP,countDown,forceReduction,reduceOnly,gbCheck)
      struct arrayOfPOLY *f;       struct arrayOfPOLY *f;
      int needBack;       int needBack;
      int needSyz;       int needSyz;
      struct pair **grP;  /* if (needSyz), it is set. */       struct pair **grP;  /* if (needSyz), it is set. */
      int countDown;       int countDown;
      int forceReduction;       int forceReduction;
        int reduceOnly;
        int gbCheck;
 {  {
   int r;    int r;
   struct gradedPolySet *g;    struct gradedPolySet *g;
Line 193  struct gradedPolySet *groebner_gen(f,needBack,needSyz,
Line 196  struct gradedPolySet *groebner_gen(f,needBack,needSyz,
   extern int StopDegree;    extern int StopDegree;
   extern struct ring *CurrentRingp;    extern struct ring *CurrentRingp;
   extern char *F_mpMult;    extern char *F_mpMult;
     extern int Homogenize;
   struct ring *rp;    struct ring *rp;
   int first;    int first;
   int statisticsPL, statisticsCount;    int statisticsPL, statisticsCount;
   
     if (KanGBmessage) {
           printf("Homogenize=%d, countDown=%d, forceReduction=%d, reduceOnly=%d, gbCheck=%d\n",
                      Homogenize,countDown, forceReduction, reduceOnly, gbCheck);
     }
   if (Statistics) {    if (Statistics) {
     for (i=0; i<DMAX; i++) MaxLength[i] = SpNumber[i] = 0;      for (i=0; i<DMAX; i++) MaxLength[i] = SpNumber[i] = 0;
   }    }
Line 213  struct gradedPolySet *groebner_gen(f,needBack,needSyz,
Line 221  struct gradedPolySet *groebner_gen(f,needBack,needSyz,
   
   Spairs = Criterion1 = Criterion2B = Criterion2F = Criterion2M = 0;    Spairs = Criterion1 = Criterion2B = Criterion2F = Criterion2M = 0;
   
   g = newGradedPolySet(INITGRADE);    g = newGradedPolySet(INITGRADE); g->gb = 1;
     if (reduceOnly) g->gb = 2; /* unknown */
   d = newGradedPairs(INITGRADE*2);    d = newGradedPairs(INITGRADE*2);
   for (i=0; i<g->lim; i++) {    for (i=0; i<g->lim; i++) {
     g->polys[i] = newPolySet(INITSIZE);      g->polys[i] = newPolySet(INITSIZE);
Line 269  struct gradedPolySet *groebner_gen(f,needBack,needSyz,
Line 278  struct gradedPolySet *groebner_gen(f,needBack,needSyz,
     gj = g->polys[jg]->g[ji];      gj = g->polys[jg]->g[ji];
   
     Spairs++;      Spairs++;
     h = (*sp)(gi,gj);          if (reduceOnly && (!needSyz) && (!needBack)) h = spZero(); /* rd = 0 */
           else h = (*sp)(gi,gj);
     rd = ppAddv(ppMult(h.a,gi),ppMult(h.b,gj));      rd = ppAddv(ppMult(h.a,gi),ppMult(h.b,gj));
   
     if (Statistics) {      if (Statistics) {
Line 314  struct gradedPolySet *groebner_gen(f,needBack,needSyz,
Line 324  struct gradedPolySet *groebner_gen(f,needBack,needSyz,
     }      }
   
     if (!(rd ISZERO)) {      if (!(rd ISZERO)) {
         if (gbCheck) {
                   /* Abort the calculation. */
                   g->gb = 0;
                   if (KanGBmessage) {
                     printf("gbCheck failed. \n");
                     printf("Note that the result is NOT groebner basis.\n");
                   }
                   break;
         }
       if (needBack || needSyz) {        if (needBack || needSyz) {
         syzp = newSyz0();          syzp = newSyz0();
         syzp->cf = syzCf; /* no meaning */          syzp->cf = syzCf; /* no meaning */
Line 353  struct gradedPolySet *groebner_gen(f,needBack,needSyz,
Line 372  struct gradedPolySet *groebner_gen(f,needBack,needSyz,
           if (countDown == 0) {            if (countDown == 0) {
             printf("\nThe computation of the Groebner basis is suspended because of countDown==0.\n");              printf("\nThe computation of the Groebner basis is suspended because of countDown==0.\n");
             printf("Note that the result is NOT groebner basis.\n");              printf("Note that the result is NOT groebner basis.\n");
               g->gb = 0;
             break;              break;
           }            }
         }          }
Line 374  struct gradedPolySet *groebner_gen(f,needBack,needSyz,
Line 394  struct gradedPolySet *groebner_gen(f,needBack,needSyz,
         printf("Computation of the Groebner basis is suspended bacause of StopDegree < computing grade.\n");          printf("Computation of the Groebner basis is suspended bacause of StopDegree < computing grade.\n");
         printf("Note that the result is NOT groebner basis.\n");          printf("Note that the result is NOT groebner basis.\n");
       }        }
         g->gb = 0;
       break;        break;
     }      }
   }    }
Line 409  struct gradedPolySet *groebner_gen(f,needBack,needSyz,
Line 430  struct gradedPolySet *groebner_gen(f,needBack,needSyz,
     printf("\n");      printf("\n");
   }    }
   
   if (AutoReduce) {    if (AutoReduce || reduceOnly) {
     toReducedBasis(g,needBack,needSyz);      toReducedBasis(g,needBack,needSyz);
   }    }
   
Line 506  void toReducedBasis(struct gradedPolySet *grP,int need
Line 527  void toReducedBasis(struct gradedPolySet *grP,int need
   if (KanGBmessage) {    if (KanGBmessage) {
     printf("Done(reduced basis)\n");      printf("Done(reduced basis)\n");
   }    }
     grP->reduced = 1;
 }  }
   
   

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.14

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