source: git/Singular/kstd2.cc @ 584f84d

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