source: git/Singular/gr_kstd2.cc @ 50cbdc

spielwiese
Last change on this file since 50cbdc was 50cbdc, checked in by Hans Schönemann <hannes@…>, 23 years ago
*hannes: merge-2-0-2 git-svn-id: file:///usr/local/Singular/svn/trunk@5619 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 20.0 KB
Line 
1/****************************************
2*  Computer Algebra System SINGULAR     *
3****************************************/
4/* $Id: gr_kstd2.cc,v 1.2 2001-08-27 14:47:00 Singular Exp $ */
5/* $Log: not supported by cvs2svn $
6/* Revision 1.1.2.2  2001/08/16 13:17:29  Singular
7/* * hannes: removed rcsid
8/*
9/* Revision 1.1.2.1  2001/04/17 15:33:35  levandov
10/* PosInS syntax change fixed
11/*
12/* Revision 1.1  2001/02/28 11:39:17  levandov
13/* * levandov: add gr_kstd2.cc
14/*
15/* Revision 1.1  2000/07/20 16:11:45  obachman
16/* * added stuff
17/*
18*/
19/*
20*  ABSTRACT -  Kernel: alg. of Buchberger
21*/
22
23#include "mod2.h"
24#ifdef HAVE_PLURAL
25#include "omalloc.h"
26#include "polys.h"
27#include "ideals.h"
28#include "febase.h"
29#include "kutil.h"
30#include "kstd1.h"
31#include "khstd.h"
32//#include "spolys.h"
33#include "cntrlc.h"
34#include "weight.h"
35#include "ipid.h"
36#include "ipshell.h"
37#include "intvec.h"
38#include "tok.h"
39
40/*2
41* consider the part above syzComp:
42* (assume the polynomial comes from a syz computation)
43* - it is a constant term: return a copy of it
44* - else: return NULL
45*/
46static poly kFromInput(poly p,kStrategy strat)
47{
48  poly q=p;
49
50  if (pGetComp(q)>strat->syzComp) return NULL;
51  while ((q!=NULL) && (pGetComp(q)<=strat->syzComp)) pIter(q);
52  if (pIsConstantComp(q))
53    return pHead(q);
54  return NULL;
55}
56
57/*2
58*  reduction procedure for the homogeneous case
59*  and the case of a degree-ordering
60*/
61static int redHomog (LObject* h,kStrategy strat)
62{
63  if (strat->tl<0)
64  {
65    enterTBba((*h),0,strat);
66    return 1;
67  }
68
69  int j = 0;
70
71  if (TEST_OPT_DEBUG)
72  {
73    PrintS("red:");
74    wrp(h->p);
75    PrintS(" ");
76  }
77  loop
78  {
79    if (TEST_OPT_DEBUG) Print("%d",j);
80    if (pDivisibleBy(strat->S[j],(*h).p))
81    {
82      if (TEST_OPT_DEBUG)
83      {
84        PrintS("+\nwith ");
85        wrp(strat->S[j]);
86      }
87      if (strat->interpt) test_int_std(strat->kIdeal);
88      /*- compute the s-polynomial -*/
89      (*h).p = spSpolyRed(strat->S[j],(*h).p,strat->kNoether);
90      if ((*h).p == NULL)
91      {
92        if (TEST_OPT_DEBUG) PrintS(" to 0\n");
93        if (h->lcm!=NULL) pLmFree((*h).lcm);
94        (*h).lcm=NULL;
95        return 0;
96      }
97/*
98*      else if (strat->syzComp)
99*      {
100*        if (pMinComp((*h).p) > strat->syzComp)
101*        {
102*          enterTBba((*h),strat->tl+1,strat);
103*          return;
104*        }
105*      }
106*/
107      /*- try to reduce the s-polynomial -*/
108      j = 0;
109    }
110    else
111    {
112      if (j >= strat->sl)
113      {
114        enterTBba((*h),strat->tl+1,strat);
115        return 1;
116      }
117      j++;
118    }
119  }
120}
121
122/*2
123*  reduction procedure for the homogeneous case
124*  and the case of a degree-ordering
125*/
126static int redHomog0 (LObject* h,kStrategy strat)
127{
128  if (strat->tl<0)
129  {
130    enterTBba((*h),0,strat);
131    return 0;
132  }
133
134  int j = 0;
135  int k = 0;
136
137  if (TEST_OPT_DEBUG)
138  {
139    PrintS("red:");
140    wrp(h->p);
141    PrintS(" ");
142  }
143  loop
144  {
145    if (TEST_OPT_DEBUG) Print("%d",j);
146    if (pDivisibleBy(strat->T[j].p,(*h).p))
147    {
148      if (strat->interpt) test_int_std(strat->kIdeal);
149      if (TEST_OPT_DEBUG)
150      {
151        PrintS("+\nwith ");
152        wrp(strat->S[j]);
153      }
154      /*- compute the s-polynomial -*/
155      (*h).p = spSpolyRed(strat->T[j].p,(*h).p,strat->kNoether);
156      if ((*h).p == NULL)
157      {
158        if (TEST_OPT_DEBUG) PrintS(" to 0\n");
159        if (h->lcm!=NULL) pLmFree((*h).lcm);
160        (*h).lcm=NULL;
161        return 0;
162      }
163      else if (strat->syzComp!=0)
164      {
165        if ((strat->syzComp>0) && (pMinComp((*h).p) > strat->syzComp))
166        {
167          //pContent((*h).p);
168          pCleardenom((*h).p);// also does a pContent
169/*
170*         (*h).length=pLength0((*h).p);
171*/
172          k=strat->posInT(strat->T,strat->tl,(*h));
173          enterTBba((*h),k,strat);
174          return 0;
175        }
176      }
177      /*- try to reduce the s-polynomial -*/
178      j = 0;
179    }
180    else
181    {
182      if (j >= strat->tl)
183      {
184        //pContent((*h).p);
185        pCleardenom((*h).p);// also does a pContent
186/*
187*       (*h).length=pLength0((*h).p);
188*/
189        k=strat->posInT(strat->T,strat->tl,(*h));
190        enterTBba((*h),k,strat);
191        return 0;
192      }
193      j++;
194    }
195  }
196}
197
198/*2
199*  reduction procedure for the inhomogeneous case
200*  and not a degree-ordering
201*/
202static int redLazy (LObject* h,kStrategy strat)
203{
204  if (strat->tl<0)
205  {
206    enterTBba((*h),0,strat);
207    return 0;
208  }
209
210  int at,d,i;
211  int j = 0;
212  int pass = 0;
213  int reddeg = pFDeg((*h).p);
214
215  if (TEST_OPT_DEBUG)
216  {
217    PrintS("red:");
218    wrp(h->p);
219    PrintS(" ");
220  }
221  loop
222  {
223    if (TEST_OPT_DEBUG) Print("%d",j);
224    if (pDivisibleBy(strat->S[j],(*h).p))
225    {
226      if (strat->interpt) test_int_std(strat->kIdeal);
227      if (TEST_OPT_DEBUG)
228      {
229        PrintS("+\nwith ");
230        wrp(strat->S[j]);
231      }
232      /*- compute the s-polynomial -*/
233      (*h).p = spSpolyRed(strat->S[j],(*h).p,strat->kNoether);
234      if ((*h).p == NULL)
235      {
236        if (TEST_OPT_DEBUG) PrintS(" to 0\n");
237        if (h->lcm!=NULL) pLmFree((*h).lcm);
238        (*h).lcm=NULL;
239        return 0;
240      }
241//      else if (strat->syzComp)
242//      {
243//        if ((strat->syzComp>0) && (pMinComp((*h).p) > strat->syzComp))
244//        {
245//          if (TEST_OPT_DEBUG) PrintS(" > syzComp\n");
246//          if (TEST_OPT_INTSTRATEGY) pContent(h->p);
247//          enterTBba((*h),strat->tl+1,strat);
248//          return;
249//        }
250//      }
251      else if (TEST_OPT_DEBUG)
252      {
253        PrintS("to:");
254        wrp((*h).p);
255        PrintLn();
256      }
257      /*- try to reduce the s-polynomial -*/
258      pass++;
259      d = pFDeg((*h).p);
260      if ((strat->Ll >= 0) && ((d > reddeg) || (pass > strat->LazyPass)))
261      {
262        at = posInL11(strat->L,strat->Ll,h,strat);
263        if (at <= strat->Ll)
264        {
265          i=strat->sl+1;
266          do
267          {
268            i--;
269            if (i<0)
270            {
271              enterTBba((*h),strat->tl+1,strat);
272              return 0;
273            }
274          }
275           while (!pDivisibleBy(strat->S[i],(*h).p));
276          if (TEST_OPT_DEBUG) Print(" ->L[%d]\n",at);
277          enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
278          (*h).p = NULL;
279          return 0;
280        }
281      }
282      else if ((TEST_OPT_PROT) && (strat->Ll < 0) && (d != reddeg))
283      {
284        Print(".%d",d);mflush();
285        reddeg = d;
286      }
287      j = 0;
288    }
289    else
290    {
291      if (TEST_OPT_DEBUG) PrintS("-");
292      if (j >= strat->sl)
293      {
294        if (TEST_OPT_DEBUG) PrintLn();
295        if (TEST_OPT_INTSTRATEGY)
296        {
297          //pContent(h->p);
298          pCleardenom(h->p);// also does a pContent
299        }
300        enterTBba((*h),strat->tl+1,strat);
301        return 0;
302      }
303      j++;
304    }
305  }
306}
307
308/*2
309*  reduction procedure for the sugar-strategy (honey)
310* reduces h with elements from T choosing first possible
311* element in T with respect to the given ecart
312*/
313static int redHoney (LObject*  h,kStrategy strat)
314{
315  if (strat->tl<0)
316  {
317    enterTBba((*h),0,strat);
318    return 0;
319  }
320
321  poly pi;
322  int i,j,at,reddeg,d,pass,ei;
323
324  pass = j = 0;
325  d = reddeg = pFDeg((*h).p)+(*h).ecart;
326  if (TEST_OPT_DEBUG)
327  {
328    PrintS("red:");
329    wrp((*h).p);
330  }
331  loop
332  {
333    if (TEST_OPT_DEBUG) Print("%d",j);
334    if (pDivisibleBy(strat->T[j].p,(*h).p))
335    {
336      if (TEST_OPT_DEBUG) PrintS("+");
337      pi = strat->T[j].p;
338      ei = strat->T[j].ecart;
339      /*
340      * the polynomial to reduce with (up to the moment) is;
341      * pi with ecart ei
342      */
343      i = j;
344      loop
345      {
346        /*- takes the first possible with respect to ecart -*/
347        i++;
348        if (i > strat->tl)
349          break;
350        if ((!BTEST1(20)) && (ei <= (*h).ecart))
351          break;
352        if (TEST_OPT_DEBUG) Print("%d",i);
353        if ((strat->T[i].ecart < ei) && pDivisibleBy(strat->T[i].p,(*h).p))
354        {
355          if (TEST_OPT_DEBUG) PrintS("+");
356          /*
357          * the polynomial to reduce with is now;
358          */
359          pi = strat->T[i].p;
360          ei = strat->T[i].ecart;
361        }
362        else if (TEST_OPT_DEBUG) PrintS("-");
363      }
364
365      /*
366      * end of search: have to reduce with pi
367      */
368      if (ei > (*h).ecart)
369      {
370        /*
371        * It is not possible to reduce h with smaller ecart;
372        * if possible h goes to the lazy-set L,i.e
373        * if its position in L would be not the last one
374        */
375        if (strat->Ll >= 0) /* L is not empty */
376        {
377          at = strat->posInL(strat->L,strat->Ll,h,strat);
378          if(at <= strat->Ll)
379          /*- h will not become the next element to reduce -*/
380          {
381            enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
382            if (TEST_OPT_DEBUG) Print(" ecart too big: -> L%d\n",at);
383            (*h).p = NULL;
384            return 0;
385          }
386        }
387      }
388      if (TEST_OPT_DEBUG)
389      {
390        PrintS("\nwith ");
391        wrp(pi);
392      }
393      if (strat->fromT)
394      {
395        strat->fromT=FALSE;
396        (*h).p = spSpolyRedNew(pi,(*h).p,strat->kNoether);
397      }
398      else
399        (*h).p = spSpolyRed(pi,(*h).p,strat->kNoether);
400      if (TEST_OPT_DEBUG)
401      {
402        PrintS(" to ");
403        wrp((*h).p);
404        PrintLn();
405      }
406      if ((*h).p == NULL)
407      {
408        if (h->lcm!=NULL) pLmFree((*h).lcm);
409        (*h).lcm=NULL;
410        return 0;
411      }
412      /* compute the ecart */
413      if (ei <= (*h).ecart)
414        (*h).ecart = d-pFDeg((*h).p);
415      else
416        (*h).ecart = d-pFDeg((*h).p)+ei-(*h).ecart;
417//      if (strat->syzComp)
418//      {
419//        if ((strat->syzComp>0) && (pMinComp((*h).p) > strat->syzComp))
420//        {
421//          if (TEST_OPT_DEBUG)
422//            PrintS("  >syzComp\n");
423//          if (TEST_OPT_INTSTRATEGY) pContent(h->p);
424//          at=strat->posInT(strat->T,strat->tl,(*h));
425//          enterTBba((*h),at,strat);
426//          return;
427//        }
428//      }
429      /*
430      * try to reduce the s-polynomial h
431      *test first whether h should go to the lazyset L
432      *-if the degree jumps
433      *-if the number of pre-defined reductions jumps
434      */
435      pass++;
436      d = pFDeg((*h).p)+(*h).ecart;
437      if ((strat->Ll >= 0) && ((d > reddeg) || (pass > strat->LazyPass)))
438      {
439        at = strat->posInL(strat->L,strat->Ll,h,strat);
440        if (at <= strat->Ll)
441        {
442          /*test if h is already standardbasis element*/
443          i=strat->sl+1;
444          do
445          {
446            i--;
447            if (i<0)
448            {
449              at=strat->posInT(strat->T,strat->tl,(*h));
450              enterTBba((*h),at,strat);
451              return 0;
452            }
453          } while (!pDivisibleBy(strat->S[i],(*h).p));
454          enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
455          if (TEST_OPT_DEBUG)
456            Print(" degree jumped: -> L%d\n",at);
457          (*h).p = NULL;
458          return 0;
459        }
460      }
461      else if (TEST_OPT_PROT && (strat->Ll < 0) && (d > reddeg))
462      {
463        reddeg = d;
464        Print(".%d",d); mflush();
465      }
466      j = 0;
467    }
468    else
469    {
470      if (TEST_OPT_DEBUG) PrintS("-");
471      if (j >= strat->tl)
472      {
473        if (TEST_OPT_DEBUG) PrintLn();
474        if (TEST_OPT_INTSTRATEGY)
475        {
476          //pContent(h->p);
477          pCleardenom(h->p);// also does a pContent
478        }
479        at=strat->posInT(strat->T,strat->tl,(*h));
480        enterTBba((*h),at,strat);
481        return 0;
482      }
483      j++;
484    }
485  }
486}
487
488/*2
489*  reduction procedure for tests only
490*  reduces with elements from T and chooses the best possible
491*/
492static int redBest (LObject*  h,kStrategy strat)
493{
494  if (strat->tl<0)
495  {
496    enterTBba((*h),0,strat);
497    return 0;
498  }
499
500  int j,jbest,at,reddeg,d,pass;
501  poly     p,ph;
502  pass = j = 0;
503
504  if (strat->honey)
505    reddeg = pFDeg((*h).p)+(*h).ecart;
506  else
507    reddeg = pFDeg((*h).p);
508  loop
509  {
510    if (pDivisibleBy(strat->T[j].p,(*h).p))
511    {
512      if (strat->interpt) test_int_std(strat->kIdeal);
513      /* compute the s-polynomial */
514      if (!TEST_OPT_INTSTRATEGY) pNorm((*h).p);
515#ifdef SDRING
516      // spSpolyShortBba will not work in the SRING case
517      if (pSDRING)
518      {
519        p=spSpolyCreate(strat->T[j].p,(*h).p,strat->kNoether);
520        if (p!=NULL) pDelete(&pNext(p));
521      }
522      else
523#endif
524      p = spSpolyShortBba(strat->T[j].p,(*h).p);
525      /* computes only the first monomial of the spoly  */
526      if (p)
527      {
528        jbest = j;
529        /* looking for the best possible reduction */
530        if ((strat->syzComp==0) || (pMinComp(p) <= strat->syzComp))
531        {
532          loop
533          {
534            j++;
535            if (j > strat->tl)
536              break;
537            if (pDivisibleBy(strat->T[j].p,(*h).p))
538            {
539#ifdef SDRING
540              // spSpolyShortBba will not work in the SRING case
541              if (pSDRING)
542              {
543                ph=spSpolyCreate(strat->T[j].p,(*h).p,strat->kNoether);
544                if (ph!=NULL) pDelete(&pNext(ph));
545              }
546              else
547#endif
548              ph = spSpolyShortBba(strat->T[j].p,(*h).p);
549              if (ph==NULL)
550              {
551                pLmFree(p);
552                pDelete(&((*h).p));
553                if (h->lcm!=NULL)
554                {
555                  pLmFree((*h).lcm);
556                  (*h).lcm=NULL;
557                }
558                return 0;
559              }
560              else if (pComp0(ph,p) == -1)
561              {
562                pLmFree(p);
563                p = ph;
564                jbest = j;
565              }
566              else
567              {
568                pLmFree(ph);
569              }
570            }
571          }
572        }
573        pLmFree(p);
574        (*h).p = spSpolyRed(strat->T[jbest].p,(*h).p,strat->kNoether);
575      }
576      else
577      {
578        if (h->lcm!=NULL)
579        {
580          pLmFree((*h).lcm);
581          (*h).lcm=NULL;
582        } 
583        (*h).p = NULL;
584        return 0;
585      }
586      if (strat->honey && pLexOrder)
587        strat->initEcart(h);
588      /* h.length:=l; */
589      /* try to reduce the s-polynomial */
590//      if (strat->syzComp)
591//      {
592//        if ((strat->syzComp>0) && (pMinComp((*h).p) > strat->syzComp))
593//        {
594//          if (TEST_OPT_DEBUG)
595//            PrintS(" >syzComp\n");
596//          if (TEST_OPT_INTSTRATEGY) pContent(h->p);
597//          at=strat->posInT(strat->T,strat->tl,(*h));
598//          enterTBba((*h),at,strat);
599//          return;
600//        }
601//      }
602      if (strat->honey || pLexOrder)
603      {
604        pass++;
605        d = pFDeg((*h).p);
606        if (strat->honey)
607          d += (*h).ecart;
608        if ((strat->Ll >= 0) && ((pass > strat->LazyPass) || (d > reddeg)))
609        {
610          at = strat->posInL(strat->L,strat->Ll,h,strat);
611          if (at <= strat->Ll)
612          {
613            enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
614            (*h).p = NULL;
615            return 0;
616          }
617        }
618        else if (TEST_OPT_PROT && (strat->Ll < 0) && (d != reddeg))
619        {
620          reddeg = d;
621          Print("%d.");
622          mflush();
623        }
624      }
625      j = 0;
626    }
627    else
628    {
629      if (j >= strat->tl)
630      {
631        if (TEST_OPT_INTSTRATEGY)
632        {
633          //pContent(h->p);
634          pCleardenom(h->p);// also does a pContent
635        }
636        at=strat->posInT(strat->T,strat->tl,(*h));
637        enterTBba((*h),at,strat);
638        return 0;
639      }
640      j++;
641    }
642  }
643}
644
645static void gr_initBba(ideal F,kStrategy strat)
646{
647  int i;
648  idhdl h;
649 /* setting global variables ------------------- */
650  strat->enterS = enterSBba;
651  if ((BTEST1(20)) && (!strat->honey))
652    strat->red = redBest;
653  else if (strat->honey)
654    strat->red = redHoney;
655  else if (pLexOrder && !strat->homog)
656    strat->red = redLazy;
657  else if (TEST_OPT_INTSTRATEGY && strat->homog)
658    strat->red = redHomog0;
659  else
660    strat->red = redHomog;
661
662  if (pLexOrder && strat->honey)
663    strat->initEcart = initEcartNormal;
664  else
665    strat->initEcart = initEcartBBA;
666  if (strat->honey)
667    strat->initEcartPair = initEcartPairMora;
668  else
669    strat->initEcartPair = initEcartPairBba;
670  strat->kIdeal = NULL;
671  //if (strat->ak==0) strat->kIdeal->rtyp=IDEAL_CMD;
672  //else              strat->kIdeal->rtyp=MODUL_CMD;
673  //strat->kIdeal->data=(void *)strat->Shdl;
674  if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
675  {
676    //interred  machen   Aenderung
677    pFDegOld=pFDeg;
678    pLDegOld=pLDeg;
679    h=ggetid("ecart");
680    if ((h!=NULL) && (IDTYP(h)==INTVEC_CMD))
681    {
682      ecartWeights=iv2array(IDINTVEC(h));
683    }
684    else
685    {
686      ecartWeights=(short *)omAlloc((pVariables+1)*sizeof(short));
687      /*uses automatic computation of the ecartWeights to set them*/
688      kEcartWeights(F->m,IDELEMS(F)-1,ecartWeights);
689    }
690    pFDeg=totaldegreeWecart;
691    pLDeg=maxdegreeWecart;
692    for(i=1; i<=pVariables; i++)
693      Print(" %d",ecartWeights[i]);
694    PrintLn();
695    mflush();
696  }
697}
698
699ideal gr_bba (ideal F, ideal Q,kStrategy strat)
700{
701  intvec *w=NULL;
702  intvec *hilb=NULL;
703  int   srmax,lrmax;
704  int   olddeg,reduc;
705  int red_result=1;
706  int hilbeledeg=1,hilbcount=0,minimcnt=0;
707
708  initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit*/
709  initHilbCrit(F,Q,&hilb,strat);
710  gr_initBba(F,strat);
711  initBuchMoraPos(strat);
712  /*set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair*/
713  /*Shdl=*/initBuchMora(F, Q,strat);
714  srmax = strat->sl;
715  reduc = olddeg = lrmax = 0;
716  /* compute------------------------------------------------------- */
717  while (strat->Ll >= 0)
718  {
719    if (strat->Ll > lrmax) lrmax =strat->Ll;/*stat.*/
720    if (TEST_OPT_DEBUG) messageSets(strat);
721    test_int_std(strat->kIdeal);
722    if (strat->Ll== 0) strat->interpt=TRUE;
723    if (TEST_OPT_DEGBOUND
724    && ((strat->honey && (strat->L[strat->Ll].ecart+pFDeg(strat->L[strat->Ll].p)>Kstd1_deg))
725       || ((!strat->honey) && (pFDeg(strat->L[strat->Ll].p)>Kstd1_deg))))
726    {
727      /*
728      *stops computation if
729      * 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
730      *a predefined number Kstd1_deg
731      */
732      while (strat->Ll >= 0) deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
733      break;
734    }
735    /* picks the last element from the lazyset L */
736    strat->P = strat->L[strat->Ll];
737    strat->Ll--;
738    kTest(strat);
739    if (pNext(strat->P.p) == strat->tail)
740    {
741      /* deletes the short spoly and computes */
742      pLmFree(strat->P.p);
743      /* the real one */
744      strat->P.p = spSpolyCreate(strat->P.p1,strat->P.p2,strat->kNoether);
745    }
746#ifdef SDRING
747    if (strat->P.p != NULL)
748#endif
749    {
750      if (TEST_OPT_PROT)
751      message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
752              &olddeg,&reduc,strat, red_result);
753      /* reduction of the element choosen from L */
754      strat->red(&strat->P,strat);
755    }
756    if (strat->P.p != NULL)
757    {
758          /* statistic */
759          if (TEST_OPT_PROT) PrintS("s");
760          /* enter P.p into s and L */
761          {
762            int pos=posInS(strat,strat->sl,strat->P.p, strat->P.ecart);
763            {
764              if (TEST_OPT_INTSTRATEGY)
765              {
766                if ((strat->syzComp==0)||(!strat->homog))
767                {
768                  strat->P.p = redtailBba(strat->P.p,pos-1,strat);
769                  pCleardenom(strat->P.p);
770                }
771              }
772              else
773              {
774                pNorm(strat->P.p);
775                if ((strat->syzComp==0)||(!strat->homog))
776                {
777                  strat->P.p = redtailBba(strat->P.p,pos-1,strat);
778                }
779              }
780              if (TEST_OPT_DEBUG)
781              {
782                PrintS("new s:");
783                wrp(strat->P.p);
784                PrintLn();
785              }
786              enterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat);
787              if (strat->sl==-1) pos=0;
788              else pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
789              strat->enterS(strat->P,pos,strat);
790            }
791            if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
792          }
793          if (strat->P.lcm!=NULL) pLmFree(strat->P.lcm);
794      if (strat->sl>srmax) srmax = strat->sl;
795    }
796#ifdef KDEBUG
797    strat->P.lcm=NULL;
798#endif
799    kTest(strat);
800  }
801  if (TEST_OPT_DEBUG) messageSets(strat);
802  /* complete reduction of the standard basis--------- */
803  if (TEST_OPT_REDSB) completeReduce(strat);
804  /* release temp data-------------------------------- */
805  exitBuchMora(strat);
806  if (TEST_OPT_WEIGHTM)
807  {
808    pFDeg=pFDegOld;
809    pLDeg=pLDegOld;
810    if (ecartWeights)
811    {
812      omFreeSize((ADDRESS)ecartWeights,(pVariables+1)*sizeof(short));
813      ecartWeights=NULL;
814    }
815  }
816  if (TEST_OPT_PROT) messageStat(srmax,lrmax,hilbcount,strat);
817  if (Q!=NULL) updateResult(strat->Shdl,Q,strat);
818  return (strat->Shdl);
819}
820#endif
Note: See TracBrowser for help on using the repository browser.