source: git/Singular/kstd1.cc @ 4a81ec

fieker-DuValspielwiese
Last change on this file since 4a81ec was 64ced6, checked in by Hans Schönemann <hannes@…>, 27 years ago
* hannes/brunko: integrated stdtrace (activate by #define STDTRACE) into main source tree (Makefile.in extra.cc kstd1.cc kstd1.h kstd2.cc kstd2.h) git-svn-id: file:///usr/local/Singular/svn/trunk@601 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 50.8 KB
Line 
1/****************************************
2*  Computer Algebra System SINGULAR     *
3****************************************/
4/* $Id: kstd1.cc,v 1.9 1997-08-05 13:04:03 Singular Exp $ */
5/*
6* ABSTRACT:
7*/
8
9#include "mod2.h"
10#include "mmemory.h"
11#include "polys.h"
12#include "febase.h"
13#include "kutil.h"
14#include "kstd1.h"
15#include "kstd2.h"
16#include "khstd.h"
17#include "spolys.h"
18#include "stairc.h"
19#include "weight.h"
20#include "cntrlc.h"
21#include "intvec.h"
22#include "ideals.h"
23#include "ipshell.h"
24#include "ipid.h"
25#include "timer.h"
26#include "tok.h"
27#include "lists.h"
28#ifdef STDTRACE
29#include "comm.h"
30#endif
31//#include "ipprint.h"
32
33/* the list of all options which give a warning by test */
34BITSET kOptions=Sy_bit(0)|Sy_bit(1)|Sy_bit(3)|Sy_bit(4)|Sy_bit(5)
35                |Sy_bit(8)|Sy_bit(10)|Sy_bit(21)
36                |Sy_bit(OPT_INTSTRATEGY)
37                |Sy_bit(30)|Sy_bit(31);
38
39/* the list of all options which may be used by option and test */
40BITSET validOpts=Sy_bit(0)|Sy_bit(1)|Sy_bit(2)|Sy_bit(3)
41             |Sy_bit(4)|Sy_bit(5)|Sy_bit(6)|Sy_bit(7)
42             |Sy_bit(8)|Sy_bit(9)|Sy_bit(10)
43             |Sy_bit(11)|Sy_bit(12)|Sy_bit(13)|Sy_bit(14)|Sy_bit(15)
44             |Sy_bit(16)|Sy_bit(17)|Sy_bit(18)|Sy_bit(19)|Sy_bit(20)
45             |Sy_bit(21)
46             |Sy_bit(22)
47             /*|Sy_bit(23)*/
48             /*|Sy_bit(24)*/
49             |Sy_bit(OPT_REDTAIL)
50             |Sy_bit(OPT_INTSTRATEGY)|Sy_bit(27)|Sy_bit(28)
51             |Sy_bit(29)
52             |Sy_bit(30)|Sy_bit(31);
53
54//static int (*posInLOld)(LSet L,int Ll, LObject l,kStrategy strat);
55//static int  lastAxis=0;
56//static BOOLEAN update=TRUE;
57//static BOOLEAN posInLOldFlag;
58           /*FALSE, if posInL == posInL10*/
59
60/*0 implementation*/
61
62/*2
63*p is a polynomial in the set s;
64*recompute p and its ecart e with respect to the new noether
65*(cut every monomial of pNext(p) above noether)
66*/
67void deleteHCs (TObject* p,kStrategy strat)
68{
69  poly p1;
70  int o;
71
72  if (strat->kHEdgeFound)
73  {
74    p1 = (*p).p;
75    o = pFDeg(p1);
76    while (pNext(p1) != NULL)
77    {
78      if (pComp0(pNext(p1),strat->kNoether) == -1)
79      {
80        pDelete(&(pNext(p1)));
81        (*p).ecart = pLDeg((*p).p,&((*p).length))-o;
82      }
83      else
84      {
85        pIter(p1);
86      }
87    }
88  }
89}
90
91
92void doRed (LObject* h,poly* with,BOOLEAN intoT,kStrategy strat)
93{
94  poly hp;
95#ifdef KDEBUG
96  pTest((*h).p);
97  pTest(*with);
98#endif
99
100  if (!TEST_OPT_INTSTRATEGY)
101    pNorm(*with);
102  if (intoT)
103  {
104    hp = spSpolyRedNew(*with,(*h).p,strat->kNoether);
105    enterT(*h,strat);
106    (*h).p = hp;
107  }
108  else
109  {
110    (*h).p = spSpolyRed(*with,(*h).p,strat->kNoether);
111  }
112}
113
114/*2
115* reduces h with elements from T choosing first possible
116* element in T with respect to the given ecart
117* requires thar T is sorted by ecart
118*/
119void redEcart19 (LObject* h,kStrategy strat)
120{
121  int i,at,reddeg,d;
122  int j = 0;
123  int pass = 0;
124
125  if (TEST_OPT_CANCELUNIT) cancelunit(h);
126  d = pFDeg((*h).p)+(*h).ecart;
127  reddeg = strat->LazyDegree+d;
128  loop
129  {
130    if (j > strat->tl)
131    {
132      if (TEST_OPT_DEBUG) PrintLn();
133      return;
134    }
135    if (TEST_OPT_DEBUG) Print("%d",j);
136    if (pDivisibleBy(strat->T[j].p,(*h).p))
137    {
138      //if (strat->interpt) test_int_std(strat->kIdeal);
139      if (TEST_OPT_DEBUG) PrintS("+");
140      /*- compute the s-polynomial -*/
141      if (strat->T[j].ecart > (*h).ecart)
142      {
143        /*
144        * It is not possible to reduce h with smaller ecart;
145        * if possible h goes to the lazy-set L,i.e
146        * if its position in L would be not the last one
147        */
148        strat->fromT = TRUE;
149        if (strat->Ll >= 0) /*- L is not empty -*/
150        {
151          at = strat->posInL(strat->L,strat->Ll,(*h),strat);
152          if (at <= strat->Ll)
153          {
154            /*- h will not become the next element to reduce -*/
155            enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
156            if (TEST_OPT_DEBUG) Print(" ecart too big; -> L%d\n",at);
157            (*h).p = NULL;
158            strat->fromT = FALSE;
159            return;
160          }
161        }
162        /*put the polynomial also in the pair set*/
163        if (TEST_OPT_MOREPAIRS)
164        {
165          if (!TEST_OPT_INTSTRATEGY)
166            pNorm((*h).p);
167          enterpairs((*h).p,strat->sl,(*h).ecart,0,strat);
168        }
169      }
170      doRed(h,&strat->T[j].p,strat->fromT,strat);
171      strat->fromT=FALSE;
172      if ((*h).p == NULL)
173      {
174        if (TEST_OPT_DEBUG) PrintS(" to 0\n");
175        if (h->lcm!=NULL) pFree1((*h).lcm);
176        return;
177      }
178      /*computes the ecart*/
179
180      if (strat->honey)
181      {
182        if (strat->T[j].ecart <= (*h).ecart)
183          (*h).ecart = d-pFDeg((*h).p);
184        else
185          (*h).ecart = d-pFDeg((*h).p)+strat->T[j].ecart-(*h).ecart;
186        (*h).length = pLength((*h).p);
187      }
188      else
189        (*h).ecart = pLDeg((*h).p,&((*h).length))-pFDeg((*h).p);
190      if (TEST_OPT_CANCELUNIT) cancelunit(h);
191      if ((strat->syzComp!=0) && !strat->honey)
192      {
193        if ((strat->syzComp>0) && (pMinComp((*h).p) > strat->syzComp))
194        {
195          if (TEST_OPT_DEBUG) PrintS(" > sysComp\n");
196          return;
197        }
198      }
199      /*- try to reduce the s-polynomial -*/
200      pass++;
201      d = pFDeg((*h).p)+(*h).ecart;
202      /*
203      *test whether the polynomial should go to the lazyset L
204      *-if the degree jumps
205      *-if the number of pre-defined reductions jumps
206      */
207      if ((strat->Ll >= 0) &&  ((d >= reddeg) || (pass > strat->LazyPass)))
208      {
209        at = strat->posInL(strat->L,strat->Ll,*h,strat);
210        if (at <= strat->Ll)
211        {
212          i=strat->sl+1;
213          do
214          {
215            i--;
216            if (i<0) return;
217          } while (!pDivisibleBy(strat->S[i],(*h).p));
218          enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
219          if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at);
220          (*h).p = NULL;
221          return;
222        }
223      }
224      else if ((TEST_OPT_PROT) && (strat->Ll < 0) && (d >= reddeg))
225      {
226        reddeg = d+1;
227        Print(".%d",d);mflush();
228      }
229      j = 0;
230      if TEST_OPT_DEBUG PrintLn();
231    }
232    else
233    {
234      if (TEST_OPT_DEBUG) PrintS("-");
235      j++;
236    }
237  }
238}
239
240/*2
241* reduces h with elements from T choosing first possible
242* element in T with respect to the given ecart
243*/
244void redEcart (LObject* h,kStrategy strat)
245{
246  poly pi;
247  int i,at,reddeg,d,ei,li;
248  int j = 0;
249  int pass = 0;
250
251  if (TEST_OPT_CANCELUNIT) cancelunit(h);
252  d = pFDeg((*h).p)+(*h).ecart;
253  reddeg = strat->LazyDegree+d;
254  loop
255  {
256    if (j > strat->tl)
257    {
258      if (TEST_OPT_DEBUG) PrintLn();
259      return;
260    }
261    if (TEST_OPT_DEBUG) Print("%d",j);
262    if (pDivisibleBy(strat->T[j].p,(*h).p))
263    {
264      //if (strat->interpt) test_int_std(strat->kIdeal);
265      if (TEST_OPT_DEBUG) PrintS("+");
266      /*- compute the s-polynomial -*/
267      pi = strat->T[j].p;
268      ei = strat->T[j].ecart;
269      li = strat->T[j].length;
270      /*
271      * the polynomial to reduce with (up to the moment) is;
272      * pi with ecart ei and length li
273      */
274      i = j;
275      loop
276      {
277      /*- takes the first possible with respect to ecart -*/
278        if (ei <= (*h).ecart) break;
279        i++;
280        if (i > strat->tl) break;
281        if (TEST_OPT_DEBUG) Print("%d",i);
282        if ((((strat->T[i]).ecart < ei)
283          || (((strat->T[i]).ecart == ei)
284          && ((strat->T[i]).length < li)))
285          && pDivisibleBy((strat->T[i]).p,(*h).p))
286        {
287          if (TEST_OPT_DEBUG) PrintS("+");
288          /*
289           * the polynomial to reduce with is now;
290           */
291          pi = strat->T[i].p;
292          ei = strat->T[i].ecart;
293          li = strat->T[i].length;
294        }
295        else if (TEST_OPT_DEBUG) PrintS("-");
296      }
297      /*
298      * end of search: have to reduce with pi
299      */
300      if (ei > (*h).ecart)
301      {
302        /*
303        * It is not possible to reduce h with smaller ecart;
304        * if possible h goes to the lazy-set L,i.e
305        * if its position in L would be not the last one
306        */
307        strat->fromT = TRUE;
308        if (strat->Ll >= 0) /*- L is not empty -*/
309        {
310          at = strat->posInL(strat->L,strat->Ll,(*h),strat);
311          if (at <= strat->Ll)
312          {
313            /*- h will not become the next element to reduce -*/
314            enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
315            if (TEST_OPT_DEBUG) Print(" ecart too big; -> L%d\n",at);
316            (*h).p = NULL;
317            strat->fromT = FALSE;
318            return;
319          }
320        }
321        /*put the polynomial also in the pair set*/
322        if (TEST_OPT_MOREPAIRS)
323        {
324          if (!TEST_OPT_INTSTRATEGY)
325            pNorm((*h).p);
326          enterpairs((*h).p,strat->sl,(*h).ecart,0,strat);
327        }
328      }
329      if (TEST_OPT_DEBUG)
330      {
331        wrp(h->p);
332        PrintS(" with ");
333        wrp(pi);
334      }
335      doRed(h,&pi,strat->fromT,strat);
336      strat->fromT=FALSE;
337      if (TEST_OPT_DEBUG)
338      {
339        PrintS(" to ");
340        wrp(h->p);
341        PrintLn();
342      }
343      if ((*h).p == NULL)
344      {
345        if (h->lcm!=NULL) pFree1((*h).lcm);
346        return;
347      }
348      /*computes the ecart*/
349      if (strat->honey)
350      {
351        if (ei <= (*h).ecart)
352          (*h).ecart = d-pFDeg((*h).p);
353        else
354          (*h).ecart = d-pFDeg((*h).p)+ei-(*h).ecart;
355        pLDeg((*h).p,&((*h).length));
356        //(*h).length = pLength((*h).p);
357      }
358      else
359        (*h).ecart = pLDeg((*h).p,&((*h).length))-pFDeg((*h).p);
360      if (TEST_OPT_CANCELUNIT) cancelunit(h);
361      if (strat->syzComp!=0)
362      {
363        if ((strat->syzComp>0) && (pMinComp((*h).p) > strat->syzComp))
364        {
365          if (TEST_OPT_DEBUG) PrintS(" > sysComp\n");
366          return;
367        }
368      }
369      /*- try to reduce the s-polynomial -*/
370      pass++;
371      d = pFDeg((*h).p)+(*h).ecart;
372      /*
373      *test whether the polynomial should go to the lazyset L
374      *-if the degree jumps
375      *-if the number of pre-defined reductions jumps
376      */
377      if ((strat->Ll >= 0)
378      && ((d >= reddeg) || (pass > strat->LazyPass)))
379      {
380        at = strat->posInL(strat->L,strat->Ll,*h,strat);
381        if (at <= strat->Ll)
382        {
383          i=strat->sl+1;
384          do
385          {
386            i--;
387            if (i<0) return;
388          } while (!pDivisibleBy(strat->S[i],(*h).p));
389          enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
390          if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at);
391          (*h).p = NULL;
392          return;
393        }
394      }
395      else if ((TEST_OPT_PROT) && (strat->Ll < 0) && (d >= reddeg))
396      {
397        Print(".%d",d);mflush();
398        reddeg = d+1;
399      }
400      j = 0;
401    }
402    else
403    {
404      if (TEST_OPT_DEBUG) PrintS("-");
405      j++;
406    }
407  }
408}
409
410/*2
411*reduces h with elements from T choosing  the first possible
412* element in t with respect to the given pDivisibleBy
413*/
414void redFirst (LObject* h,kStrategy strat)
415{
416  int at,reddeg,d,i;
417  int pass = 0;
418  int j = 0;
419
420  if (TEST_OPT_CANCELUNIT) cancelunit(h);
421  d = pFDeg((*h).p)+(*h).ecart;
422  reddeg = strat->LazyDegree+d;
423  loop
424  {
425    if (j > strat->tl)
426    {
427      if (TEST_OPT_DEBUG) PrintLn();
428      return;
429    }
430    if (TEST_OPT_DEBUG) Print("%d",j);
431    if (pDivisibleBy(strat->T[j].p,(*h).p))
432    {
433      //if (strat->interpt) test_int_std(strat->kIdeal);
434      if (TEST_OPT_DEBUG) PrintS("+\n");
435      /*
436      * the polynomial to reduce with is;
437      * T[j].p
438      */
439      if (!TEST_OPT_INTSTRATEGY)
440        pNorm(strat->T[j].p);
441      if (TEST_OPT_DEBUG)
442      {
443        wrp(h->p);
444        PrintS(" with ");
445        wrp(strat->T[j].p);
446      }
447      (*h).p = spSpolyRed(strat->T[j].p,(*h).p,strat->kNoether);
448      if (TEST_OPT_DEBUG)
449      {
450        PrintS(" to ");
451        wrp(h->p);
452      }
453      if ((*h).p == NULL)
454      {
455        if (h->lcm!=NULL) pFree1((*h).lcm);
456        return;
457      }
458      if (TEST_OPT_CANCELUNIT) cancelunit(h);
459      /*computes the ecart*/
460      d = pLDeg((*h).p,&((*h).length));
461      (*h).ecart = d-pFDeg((*h).p);
462      if ((strat->syzComp!=0) && !strat->honey)
463      {
464        if ((strat->syzComp>0) && (pMinComp((*h).p) > strat->syzComp))
465        {
466          if (TEST_OPT_DEBUG) PrintS(" > sysComp\n");
467          return;
468        }
469      }
470      /*- try to reduce the s-polynomial -*/
471      pass++;
472      /*
473      *test whether the polynomial should go to the lazyset L
474      *-if the degree jumps
475      *-if the number of pre-defined reductions jumps
476      */
477      if ((strat->Ll >= 0)
478      && ((d >= reddeg) || (pass > strat->LazyPass))
479      && !strat->homog)
480      {
481        at = strat->posInL(strat->L,strat->Ll,*h,strat);
482        if (at <= strat->Ll)
483        {
484          i=strat->sl+1;
485          do
486          {
487            i--;
488            if (i<0) return;
489          } while (!pDivisibleBy(strat->S[i],(*h).p));
490          enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
491          if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at);
492          (*h).p = NULL;
493          return;
494        }
495      }
496      if ((TEST_OPT_PROT) && (strat->Ll < 0) && (d >= reddeg))
497      {
498        reddeg = d+1;
499        Print(".%d",d);mflush();
500      }
501      j = 0;
502      if TEST_OPT_DEBUG PrintLn();
503    }
504    else
505    {
506      if (TEST_OPT_DEBUG) PrintS("-");
507      j++;
508    }
509  }
510}
511
512/*2
513* reduces h with elements from T choosing the best possible
514* element in t with respect to the ecart and length
515*/
516void redMoraBest (LObject* h,kStrategy strat)
517{
518  poly pi;
519  int reddeg,d,ei,li,i,at;
520  int j = 0;
521  int pass = 0;
522
523  if (TEST_OPT_CANCELUNIT) cancelunit(h);
524  d = pFDeg((*h).p)+(*h).ecart;
525  reddeg = strat->LazyDegree+d;
526  loop
527  {
528    if (j > strat->tl)
529    {
530      if (TEST_OPT_DEBUG) PrintLn();
531      return;
532    }
533    if (TEST_OPT_DEBUG) Print("%d",j);
534    if (pDivisibleBy(strat->T[j].p,(*h).p))
535    {
536      //if (strat->interpt) test_int_std(strat->kIdeal);
537      if (TEST_OPT_DEBUG) PrintS("+");
538      /*- compute the s-polynomial -*/
539      pi = strat->T[j].p;
540      ei = strat->T[j].ecart;
541      li = strat->T[j].length;
542      /*
543      * the polynomial to reduce with (up to the moment) is;
544      * pi with ecart ei and length li
545      */
546      i = j;
547      loop
548      {
549        /*- takes the best possible with respect to ecart and length -*/
550        i++;
551        if (i > strat->tl) break;
552        if (TEST_OPT_DEBUG) Print("%d",i);
553        if (((strat->T[i].ecart < ei)
554          || ((strat->T[i].ecart == ei)
555        && (strat->T[i].length < li)))
556        && pDivisibleBy(strat->T[i].p,(*h).p))
557        {
558          if (TEST_OPT_DEBUG) PrintS("+");
559          /*
560          * the polynomial to reduce with is now:
561          */
562          pi = strat->T[i].p;
563          ei = strat->T[i].ecart;
564          li = strat->T[i].length;
565        }
566        else
567        {
568          if (TEST_OPT_DEBUG) PrintS("-");
569        }
570      }
571      /*
572      * end of search: best is pi
573      */
574      if ((ei > (*h).ecart) && (!strat->kHEdgeFound))
575      {
576        /*
577        * It is not possible to reduce h with smaller ecart;
578        * if possible h goes to the lazy-set L,i.e
579        * if its position in L would be not the last one
580        */
581        strat->fromT = TRUE;
582        if (strat->Ll >= 0) /*- L is not empty -*/
583        {
584          at = strat->posInL(strat->L,strat->Ll,(*h),strat);
585          if (at <= strat->Ll)
586          {
587            /*- h will not become the next element to reduce -*/
588            enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
589            if (TEST_OPT_DEBUG) Print(" ecart too big; -> L%d\n",at);
590            (*h).p = NULL;
591            strat->fromT = FALSE;
592            return;
593          }
594        }
595        /*put the polynomial also in the pair set*/
596        if (TEST_OPT_MOREPAIRS)
597        {
598          if (!TEST_OPT_INTSTRATEGY)
599            pNorm((*h).p);
600          enterpairs((*h).p,strat->sl,(*h).ecart,0,strat);
601        }
602      }
603      if (TEST_OPT_DEBUG)
604      {
605        wrp(h->p);
606        PrintS(" with ");
607        wrp(pi);
608      }
609      doRed(h,&pi,strat->fromT,strat);
610      strat->fromT=FALSE;
611      if (TEST_OPT_DEBUG)
612      {
613        PrintS(" to ");
614        wrp(h->p);
615      }
616      if ((*h).p == NULL)
617      {
618        if (h->lcm!=NULL) pFree1((*h).lcm);
619        return;
620      }
621      /*computes the ecart*/
622      if (strat->honey)
623      {
624        if (ei <= (*h).ecart)
625          (*h).ecart = d-pFDeg((*h).p);
626        else
627          (*h).ecart = d-pFDeg((*h).p)+ei-(*h).ecart;
628        (*h).length = pLength((*h).p);
629      }
630      else
631        (*h).ecart = pLDeg((*h).p,&((*h).length))-pFDeg((*h).p);
632      if (TEST_OPT_CANCELUNIT) cancelunit(h);
633      if ((strat->syzComp!=0) && !strat->honey)
634      {
635        if ((strat->syzComp>0) && (pMinComp((*h).p) > strat->syzComp))
636        {
637          if (TEST_OPT_DEBUG) PrintS(" > sysComp\n");
638          return;
639        }
640      }
641      /*- try to reduce the s-polynomial -*/
642      pass++;
643      d = pFDeg((*h).p)+(*h).ecart;
644      /*
645      *test whether the polynomial should go to the lazyset L
646      *-if the degree jumps
647      *-if the number of pre-defined reductions jumps
648      */
649      if ((strat->Ll >= 0)
650      && ((d >= reddeg) || (pass > strat->LazyPass)))
651      {
652        at = strat->posInL(strat->L,strat->Ll,*h,strat);
653        if (at <= strat->Ll)
654        {
655          i=strat->sl+1;
656          do
657          {
658            i--;
659            if (i<0) return;
660          } while (!pDivisibleBy(strat->S[i],(*h).p));
661          enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
662          if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at);
663          (*h).p = NULL;
664          return;
665        }
666      }
667      else if ((TEST_OPT_PROT) && (strat->Ll < 0) && (d >= reddeg))
668      {
669        reddeg = d+1;
670        Print(".%d",d);mflush();
671      }
672      j = 0;
673      if TEST_OPT_DEBUG PrintLn();
674    }
675    else
676    {
677      if (TEST_OPT_DEBUG) PrintS("-");
678      j++;
679    }
680  }
681}
682
683/*2
684* reduces h with elements from T choosing first possible
685* element in T with respect to the given ecart
686* used for computing normal forms outside std
687*/
688static poly redMoraNF (poly h,kStrategy strat)
689{
690  poly pi;
691  LObject H;
692  int o,ei,li;
693  int j = 0;
694  int z = 10;
695
696  H.p = h;
697  o = pFDeg(h);
698  H.ecart = pLDeg(H.p,&H.length)-o;
699  cancelunit(&H);
700  loop
701  {
702    if (j > strat->tl)
703    {
704      if (TEST_OPT_DEBUG) PrintLn();
705      return H.p;
706    }
707    if (TEST_OPT_DEBUG) Print("%d",j);
708    if (pDivisibleBy(strat->T[j].p,H.p))
709    {
710      //if (strat->interpt) test_int_std(strat->kIdeal);
711      if (TEST_OPT_DEBUG) PrintS("+");
712      /*- remember the found T-poly -*/
713      pi = strat->T[j].p;
714      ei = strat->T[j].ecart;
715      li = strat->T[j].length;
716      /*
717      * the polynomial to reduce with (up to the moment) is;
718      * pi with ecart ei and length li
719      */
720      loop
721      {
722        /*- look for a better one with respect to ecart -*/
723        /*- stop, if the ecart is small enough (<=ecart(H)) -*/
724        j++;
725        if (j > strat->tl) break;
726        if (ei <= H.ecart) break;
727        if (TEST_OPT_DEBUG) Print("%d",j);
728        if (((strat->T[j].ecart < ei)
729          || ((strat->T[j].ecart == ei)
730        && (strat->T[j].length < li)))
731        && pDivisibleBy(strat->T[j].p,H.p))
732        {
733          if (TEST_OPT_DEBUG) PrintS("+");
734          /*
735          * the polynomial to reduce with is now;
736          */
737          pi = strat->T[j].p;
738          ei = strat->T[j].ecart;
739          li = strat->T[j].length;
740        }
741        else
742        {
743          if (TEST_OPT_DEBUG) PrintS("-");
744        }
745      }
746      /*
747      * end of search: have to reduce with pi
748      */
749      z++;
750      if (z>10)
751      {
752        pNormalize(H.p);
753        z=0;
754      }
755      if ((ei > H.ecart) && (!strat->kHEdgeFound))
756      {
757        /*
758        * It is not possible to reduce h with smaller ecart;
759        * we have to reduce with bad ecart: H has t enter in T
760        */
761        doRed(&H,&pi,TRUE,strat);
762        if (H.p == NULL)
763        {
764          if (TEST_OPT_DEBUG) PrintS(" to 0\n");
765          return NULL;
766        }
767      }
768      else
769      {
770        /*
771        * we reduce with good ecart, h need not to be put to T
772        */
773        doRed(&H,&pi,FALSE,strat);
774        if (H.p == NULL)
775        {
776          if (TEST_OPT_DEBUG) PrintS(" to 0\n");
777          return NULL;
778        }
779      }
780      /*- try to reduce the s-polynomial -*/
781      o = pFDeg(H.p);
782      cancelunit(&H);
783      H.ecart = pLDeg(H.p,&(H.length))-o;
784      j = 0;
785    }
786    else
787    {
788      if (TEST_OPT_DEBUG) PrintS("-");
789      j++;
790    }
791  }
792}
793
794/*2
795*reorders  L with respect to posInL
796*/
797void reorderL(kStrategy strat)
798{
799  int i,j,at;
800  LObject p;
801
802  for (i=1; i<=strat->Ll; i++)
803  {
804    at = strat->posInL(strat->L,i-1,strat->L[i],strat);
805    if (at != i)
806    {
807      p = strat->L[i];
808      for (j=i-1; j>=at; j--) strat->L[j+1] = strat->L[j];
809      strat->L[at] = p;
810    }
811  }
812}
813
814/*2
815*reorders  T with respect to length
816*/
817void reorderT(kStrategy strat)
818{
819  int i,j,at;
820  TObject p;
821
822  for (i=1; i<=strat->tl; i++)
823  {
824    if (strat->T[i-1].length > strat->T[i].length)
825    {
826      p = strat->T[i];
827      at = i-1;
828      loop
829      {
830        at--;
831        if (at < 0) break;
832        if (strat->T[i].length > strat->T[at].length) break;
833      }
834      for (j = i-1; j>at; j--)
835      {
836        strat->T[j+1]=strat->T[j];
837      }
838      strat->T[at+1]=p;
839    }
840  }
841}
842
843/*2
844*looks whether exactly pVariables-1 axis are used
845*returns last != 0 in this case
846*last is the (first) unused axis
847*/
848void missingAxis (int* last,kStrategy strat)
849{
850  int   i = 0;
851  int   k = 0;
852
853  *last = 0;
854  loop
855  {
856    i++;
857    if (i > pVariables) break;
858    if (strat->NotUsedAxis[i])
859    {
860      *last = i;
861      k++;
862    }
863    if (k>1)
864    {
865      *last = 0;
866      break;
867    }
868  }
869}
870
871/*2
872*last is the only non used axis, it looks
873*for a monomial in p being a pure power of this
874*variable and returns TRUE in this case
875*(*length) gives the length between the pure power and the leading term
876*(should be minimal)
877*/
878BOOLEAN hasPurePower (poly p,int last, int *length,kStrategy strat)
879{
880  poly h;
881  int i;
882
883  if (pNext(p) == strat->tail)
884    return FALSE;
885  if (pMinComp(p) == strat->ak)
886  {
887    *length = 0;
888    h = p;
889    while (h != NULL)
890    {
891      i = pIsPurePower(h);
892      if (i==last) return TRUE;
893      (*length)++;
894      pIter(h);
895    }
896  }
897  return FALSE;
898}
899
900/*2
901* looks up the position of polynomial p in L
902* in the case of looking for the pure powers
903*/
904int posInL10 (LSet set, int length, LObject p,kStrategy strat)
905{
906  int j,dp,dL;
907
908  if (length<0) return 0;
909  if (hasPurePower(p.p,strat->lastAxis,&dp,strat))
910  {
911    for (j=length; j>=0; j--)
912    {
913      if (!hasPurePower(set[j].p,strat->lastAxis,&dL,strat))
914        return j+1;
915      if (dp < dL)
916        return j+1;
917      if ((dp == dL)
918      && (pFDeg(set[j].p)+set[j].ecart >= pFDeg(p.p)+p.ecart))
919        return j+1;
920    }
921  }
922  j=length;
923  loop
924  {
925    if (j<0) break;
926    if (!hasPurePower(set[j].p,strat->lastAxis,&dL,strat)) break;
927    j--;
928  }
929  return strat->posInLOld(set,j,p,strat);
930}
931
932/*2
933* computes the s-polynomials L[ ].p in L
934*/
935void updateL(kStrategy strat)
936{
937  LObject p;
938  int dL;
939  int j=strat->Ll;
940  loop
941  {
942    if (j<0) break;
943    if (hasPurePower(strat->L[j].p,strat->lastAxis,&dL,strat))
944    {
945      p=strat->L[strat->Ll];
946      strat->L[strat->Ll]=strat->L[j];
947      strat->L[j]=p;
948      break;
949    }
950    j--;
951  }
952  if (j<0)
953  {
954    j=strat->Ll;
955    loop
956    {
957      if (j<0) break;
958      if (pNext(strat->L[j].p) == strat->tail)
959      {
960        pFree1(strat->L[j].p);    /*deletes the short spoly and computes*/
961        strat->L[j].p=spSpolyCreate(strat->L[j].p1,strat->L[j].p2,strat->kNoether);   /*the real one*/
962        if (!strat->honey)
963          strat->initEcart(&strat->L[j]);
964        else
965          strat->L[j].length = pLength(strat->L[j].p);
966        if (hasPurePower(strat->L[j].p,strat->lastAxis,&dL,strat))
967        {
968          p=strat->L[strat->Ll];
969          strat->L[strat->Ll]=strat->L[j];
970          strat->L[j]=p;
971          break;
972        }
973      }
974      j--;
975    }
976  }
977}
978
979/*2
980* computes the s-polynomials L[ ].p in L and
981* cuts elements in L above noether
982*/
983void updateLHC(kStrategy strat)
984{
985  int i = 0;
986  while (i <= strat->Ll)
987  {
988    if (pNext(strat->L[i].p) == strat->tail)
989    {
990       /*- deletes the int spoly and computes -*/
991      if (pComp0(strat->L[i].p,strat->kNoether) == -1)
992      {
993        pFree1(strat->L[i].p);
994        strat->L[i].p = NULL;
995      }
996      else
997      {
998        pFree1(strat->L[i].p);
999        strat->L[i].p = spSpolyCreate(strat->L[i].p1,strat->L[i].p2,strat->kNoether);
1000        strat->L[i].ecart = pLDeg(strat->L[i].p,&strat->L[i].length)-pFDeg(strat->L[i].p);
1001      }
1002    }
1003    else
1004      deleteHC(&strat->L[i].p,&strat->L[i].ecart,&strat->L[i].length,strat);
1005   if (strat->L[i].p == NULL)
1006      deleteInL(strat->L,&strat->Ll,i,strat);
1007    else
1008      i++;
1009  }
1010}
1011
1012/*2
1013* cuts in T above strat->kNoether and tries to cancel a unit
1014*/
1015void updateT(kStrategy strat)
1016{
1017  int i = 0;
1018  LObject p;
1019
1020  while (i <= strat->tl)
1021  {
1022    deleteHCs(&strat->T[i],strat);
1023    /*- tries to cancel a unit: -*/
1024    p.p = strat->T[i].p;
1025    p.ecart = strat->T[i].ecart;
1026    p.length = strat->T[i].length;
1027    cancelunit(&p);
1028    strat->T[i].p = p.p;
1029    strat->T[i].ecart = p.ecart;
1030    strat->T[i].length = p.length;
1031    i++;
1032  }
1033}
1034
1035/*2
1036* arranges red, pos and T if strat->kHEdgeFound (first time)
1037*/
1038void firstUpdate(kStrategy strat)
1039{
1040  if (strat->update)
1041  {
1042    strat->update = (strat->tl == -1);
1043    if (TEST_OPT_WEIGHTM)
1044    {
1045      pFDeg=pFDegOld;
1046      pLDeg=pLDegOld;
1047      if (ecartWeights)
1048      {
1049        Free((ADDRESS)ecartWeights,(pVariables+1)*sizeof(short));
1050        ecartWeights=NULL;
1051      }
1052    }
1053    if (TEST_OPT_FASTHC)
1054    {
1055      strat->posInL = strat->posInLOld;
1056      strat->lastAxis = 0;
1057    }
1058    if (BTEST1(27))
1059      return;
1060    if (!BTEST1(20))        /*- take the first possible -*/
1061      strat->red = redFirst;
1062    updateT(strat);
1063    strat->posInT = posInT2;
1064    reorderT(strat);
1065  }
1066}
1067
1068/*2
1069*-puts p to the standardbasis s at position at
1070*-reduces the tail of p if TEST_OPT_REDTAIL
1071*-tries to cancel a unit
1072*-HEckeTest
1073*  if TRUE
1074*  - decides about reduction-strategies
1075*  - computes noether
1076*  - stops computation if BTEST1(27)
1077*  - cuts the tails of the polynomials
1078*    in s,t and the elements in L above noether
1079*    and cancels units if possible
1080*  - reorders s,L
1081*/
1082void enterSMora (LObject p,int atS,kStrategy strat)
1083{
1084  int i;
1085
1086#ifdef SDRING
1087  if (pSDRING
1088  && (atS<=strat->sl)
1089  && pComparePolys(p.p,strat->S[atS]))
1090  {
1091    if (TEST_OPT_PROT)
1092      PrintS("m");
1093    p.p=NULL;
1094    return;
1095  }
1096  if (pSDRING
1097  && (atS<strat->sl)
1098  && pComparePolys(p.p,strat->S[atS+1]))
1099  {
1100    if (TEST_OPT_PROT)
1101      PrintS("m");
1102    p.p=NULL;
1103    return;
1104  }
1105  if (pSDRING
1106  && (atS>0)
1107  && pComparePolys(p.p,strat->S[atS-1]))
1108  {
1109    if (TEST_OPT_PROT)
1110      PrintS("m");
1111    p.p=NULL;
1112    return;
1113  }
1114#endif
1115  strat->news = TRUE;
1116  /*- puts p to the standardbasis s at position atS -*/
1117  if (strat->sl == IDELEMS(strat->Shdl)-1)
1118  {
1119    pEnlargeSet(&strat->S,IDELEMS(strat->Shdl),setmax);
1120    strat->ecartS = (intset) ReAlloc(strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int),
1121                                     (IDELEMS(strat->Shdl)+setmax)*sizeof(int));
1122    if (strat->fromQ)
1123    {
1124      strat->fromQ = (intset)ReAlloc(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int),
1125                                    (IDELEMS(strat->Shdl)+setmax)*sizeof(int));
1126    }
1127    IDELEMS(strat->Shdl) += setmax;
1128    strat->Shdl->m=strat->S;
1129  }
1130  for (i=strat->sl+1; i>atS; i--)
1131  {
1132    strat->S[i] = strat->S[i-1];
1133    strat->ecartS[i] = strat->ecartS[i-1];
1134  }
1135  if (strat->fromQ)
1136  {
1137    for (i=strat->sl+1; i>=atS+1; i--)
1138    {
1139      strat->fromQ[i] = strat->fromQ[i-1];
1140    }
1141    strat->fromQ[atS]=0;
1142  }
1143  /*- save result -*/
1144  strat->S[atS] = p.p;
1145  strat->ecartS[atS] = p.ecart;
1146  strat->sl++;
1147  if (TEST_OPT_DEBUG)
1148  {
1149    Print("new s%d:",atS);
1150    wrp(p.p);
1151    PrintLn();
1152  }
1153  if ((!strat->kHEdgeFound) || (strat->kNoether!=NULL)) HEckeTest(p.p,strat);
1154  if (strat->kHEdgeFound)
1155  {
1156    if (newHEdge(strat->S,strat->ak,strat))
1157    {
1158      firstUpdate(strat);
1159      if (BTEST1(27))
1160        return;
1161      /*- cuts elements in L above noether and reorders L -*/
1162      updateLHC(strat);
1163      /*- reorders L with respect to posInL -*/
1164      reorderL(strat);
1165    }
1166  }
1167  else if (strat->kNoether!=NULL)
1168    strat->kHEdgeFound = TRUE;
1169  else if (TEST_OPT_FASTHC)
1170  {
1171    if (strat->posInLOldFlag)
1172    {
1173      missingAxis(&strat->lastAxis,strat);
1174      if (strat->lastAxis)
1175      {
1176        strat->posInLOld = strat->posInL;
1177        strat->posInLOldFlag = FALSE;
1178        strat->posInL = posInL10;
1179        updateL(strat);
1180        reorderL(strat);
1181      }
1182    }
1183    else if (strat->lastAxis)
1184      updateL(strat);
1185  }
1186}
1187
1188/*2
1189*-puts p to the standardbasis s at position at
1190*-HEckeTest
1191*  if TRUE
1192*  - computes noether
1193*/
1194void enterSMoraNF (LObject p, int atS,kStrategy strat)
1195{
1196  int i;
1197
1198  /*- puts p to the standardbasis s at position at -*/
1199  if (strat->sl == IDELEMS(strat->Shdl)-1)
1200  {
1201    pEnlargeSet(&strat->S,IDELEMS(strat->Shdl),setmax);
1202    strat->ecartS = (intset) ReAlloc(strat->ecartS,IDELEMS(strat->Shdl)*sizeof(intset),
1203                                     (IDELEMS(strat->Shdl)+setmax)*sizeof(intset));
1204    IDELEMS(strat->Shdl) += setmax;
1205    strat->Shdl->m=strat->S;
1206  }
1207  for (i=strat->sl+1; i>atS; i--)
1208  {
1209    strat->S[i] = strat->S[i-1];
1210    strat->ecartS[i] = strat->ecartS[i-1];
1211  }
1212  strat->S[atS] = p.p;/*- save result -*/
1213  strat->ecartS[atS] = p.ecart;
1214  strat->sl++;
1215  if ((!strat->kHEdgeFound) || (strat->kNoether!=NULL)) HEckeTest(p.p,strat);
1216  if (strat->kHEdgeFound)
1217    newHEdge(strat->S,strat->ak,strat);
1218  else if (strat->kNoether!=NULL)
1219    strat->kHEdgeFound = TRUE;
1220}
1221
1222void initMora(ideal F,kStrategy strat)
1223{
1224  int i,j;
1225  idhdl h;
1226
1227  strat->NotUsedAxis = (BOOLEAN *)Alloc((pVariables+1)*sizeof(BOOLEAN));
1228  for (j=1; j<=pVariables; j++) strat->NotUsedAxis[j] = TRUE;
1229  strat->enterS = enterSMora;
1230  strat->initEcartPair = initEcartPairMora; /*- ecart approximation -*/
1231  strat->posInLOld = strat->posInL;
1232  strat->posInLOldFlag = TRUE;
1233  strat->initEcart = initEcartNormal;
1234  strat->kHEdgeFound = ppNoether != NULL;
1235  if ( strat->kHEdgeFound )
1236     strat->kNoether = pCopy(ppNoether);
1237  if (BTEST1(20))
1238    strat->red = redMoraBest;/*- look for the best in T -*/
1239  else if (strat->kHEdgeFound || strat->homog)
1240    strat->red = redFirst;  /*take the first possible in T*/
1241  else if (BTEST1(19))
1242    strat->red = redEcart19;/*take the first possible in T, rquires T sorted by ecart*/
1243  else
1244    strat->red = redEcart;/*take the first possible in under ecart-restriction*/
1245  if (strat->kHEdgeFound)
1246  {
1247    strat->HCord = pFDeg(ppNoether)+1;
1248    strat->posInT = posInT2;
1249  }
1250  else
1251  {
1252    strat->HCord = 32000;/*- very large -*/
1253  }
1254  /*reads the ecartWeights used for Graebes method from the
1255   *intvec ecart and set ecartWeights
1256   */
1257  if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
1258  {
1259    //interred  machen   Aenderung
1260    pFDegOld=pFDeg;
1261    pLDegOld=pLDeg;
1262    h=ggetid("ecart");
1263    if ((h!=NULL) && (IDTYP(h)==INTVEC_CMD))
1264    {
1265      ecartWeights=iv2array(IDINTVEC(h));
1266    }
1267    else
1268    {
1269      ecartWeights=(short *)Alloc((pVariables+1)*sizeof(short));
1270      /*uses automatic computation of the ecartWeights to set them*/
1271      kEcartWeights(F->m,IDELEMS(F)-1,ecartWeights);
1272    }
1273    pFDeg=totaldegreeWecart;
1274    pLDeg=maxdegreeWecart;
1275    for(i=1; i<=pVariables; i++)
1276      Print(" %d",ecartWeights[i]);
1277    PrintLn();
1278    mflush();
1279  }
1280}
1281
1282ideal mora (ideal F, ideal Q,intvec *w,intvec *hilb,kStrategy strat)
1283{
1284  int srmax;
1285  int lrmax = 0;
1286  int olddeg = 0;
1287  int reduc = 0;
1288  int hilbeledeg=1,hilbcount=0;
1289
1290#ifdef SDRING
1291  polyset aug=(polyset)Alloc(setmax*sizeof(poly));
1292  int augmax=setmax, augl=-1;
1293  poly oldLcm;
1294#endif
1295
1296  strat->update = TRUE;
1297  /*- setting global variables ------------------- -*/
1298  initBuchMoraCrit(strat);
1299  initHilbCrit(F,Q,&hilb,strat);
1300  initMora(F,strat);
1301  initBuchMoraPos(strat);
1302  /*Shdl=*/initBuchMora(F,Q,strat);
1303  if (TEST_OPT_FASTHC) missingAxis(&strat->lastAxis,strat);
1304  /*updateS in initBuchMora has Hecketest
1305  * and could have put strat->kHEdgdeFound FALSE*/
1306  if (ppNoether!=NULL)
1307  {
1308    strat->kHEdgeFound = TRUE;
1309  }
1310  if (strat->kHEdgeFound && strat->update)
1311  {
1312    firstUpdate(strat);
1313    updateLHC(strat);
1314    reorderL(strat);
1315  }
1316  if (TEST_OPT_FASTHC && (strat->lastAxis) && strat->posInLOldFlag)
1317  {
1318    strat->posInLOld = strat->posInL;
1319    strat->posInLOldFlag = FALSE;
1320    strat->posInL = posInL10;
1321    updateL(strat);
1322    reorderL(strat);
1323  }
1324  srmax = strat->sl;
1325  /*- compute-------------------------------------------*/
1326  while (strat->Ll >= 0)
1327  {
1328    if (lrmax< strat->Ll) lrmax=strat->Ll; /*stat*/
1329    //test_int_std(strat->kIdeal);
1330    if (TEST_OPT_DEBUG) messageSets(strat);
1331    if (TEST_OPT_DEGBOUND
1332    && (strat->L[strat->Ll].ecart+pFDeg(strat->L[strat->Ll].p)> Kstd1_deg))
1333    {
1334      /*
1335      * stops computation if
1336      * - 24 (degBound)
1337      *   && upper degree is bigger than Kstd1_deg
1338      */
1339      while (strat->Ll >= 0) deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
1340      break;
1341    }
1342    strat->P = strat->L[strat->Ll];/*- picks the last element from the lazyset L -*/
1343    if (strat->Ll==0) strat->interpt=TRUE;
1344    strat->Ll--;
1345    if (pNext(strat->P.p) == strat->tail)
1346    {
1347      pFree1(strat->P.p);/*- deletes the short spoly and computes -*/
1348      strat->P.p = spSpolyCreate(strat->P.p1,strat->P.p2,strat->kNoether);/*- the real one -*/
1349      if (!strat->honey)
1350        strat->initEcart(&strat->P);
1351      else
1352        strat->P.length = pLength(strat->P.p);
1353    }
1354#ifdef SDRING
1355    if (strat->P.p != NULL)
1356#endif
1357    {
1358      if (TEST_OPT_PROT) message(strat->P.ecart+pFDeg(strat->P.p),&olddeg,&reduc,strat);
1359      strat->red(&strat->P,strat);/*- reduction of the element choosen from L -*/
1360    }
1361    if (strat->P.p != NULL)
1362    {
1363#ifdef SDRING
1364      aug[0]=strat->P.p;
1365      augl=0;
1366      if (pSDRING)
1367      {
1368        oldLcm=strat->P.lcm;
1369#ifdef SRING
1370        if (pSRING) psAug(pCopy(strat->P.p),pOne(),&aug,&augl,&augmax);
1371#endif
1372#ifdef DRING
1373        if (pDRING) pdAug(pCopy(strat->P.p),&aug,&augl,&augmax);
1374#endif
1375      }
1376      for (augl++;augl != 0;)
1377      {
1378        strat->P.p=aug[--augl];
1379        if (pSDRING)
1380        {
1381          if (oldLcm==NULL) strat->P.lcm=NULL;
1382          else  strat->P.lcm=pCopy1(oldLcm);
1383        }
1384        if ((augl!=0) && (strat->P.p!=NULL)) strat->red(&strat->P,strat);
1385        if (strat->P.p != NULL)
1386        {
1387#endif
1388          if (TEST_OPT_PROT) PrintS("s");/*- statistic -*/
1389          /*- enter P.p into s and b: -*/
1390          if (!TEST_OPT_INTSTRATEGY)
1391          {
1392            pNorm(strat->P.p);
1393          }
1394          strat->P.p = redtail(strat->P.p,strat->sl,strat);
1395          if ((!strat->noTailReduction) && (!strat->honey))
1396          {
1397            strat->initEcart(&strat->P);
1398          }
1399          if TEST_OPT_INTSTRATEGY
1400          {
1401            //pContent(strat->P.p);
1402            pCleardenom(strat->P.p);// also does a pContent
1403          }
1404          cancelunit(&strat->P);/*- tries to cancel a unit -*/
1405          enterT(strat->P,strat);
1406          {
1407            int pos;
1408#ifdef SDRING
1409            pos = posInS(strat->S,strat->sl,strat->P.p);
1410            if (pSDRING && (pos<=strat->sl)
1411            && (pComparePolys(strat->P.p,strat->S[pos])))
1412            {
1413              if (TEST_OPT_PROT)
1414                PrintS("d");
1415            }
1416            else
1417#endif
1418            {
1419              enterpairs(strat->P.p,strat->sl,strat->P.ecart,0,strat);
1420              if (strat->sl==-1)
1421              {
1422                pos=0;
1423              }
1424              else
1425              {
1426                pos = posInS(strat->S,strat->sl,strat->P.p);
1427              }
1428              strat->enterS(strat->P,pos,strat);
1429            }
1430            if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
1431          }
1432          if (strat->P.lcm!=NULL) pFree1(strat->P.lcm);
1433#ifdef KDEBUG
1434          strat->P.lcm=NULL;
1435#endif
1436#ifdef SDRING
1437        }
1438      }
1439      /* delete the old pair */
1440      if (pSDRING &&(oldLcm!=NULL)) pFree1(oldLcm);
1441#endif
1442#ifdef KDEBUG
1443      memset(&strat->P,0,sizeof(strat->P));
1444#endif
1445      if (strat->sl>srmax) srmax = strat->sl; /*stat.*/
1446      if (strat->Ll>lrmax) lrmax = strat->Ll;
1447    }
1448    if (strat->kHEdgeFound)
1449    {
1450      if ((BTEST1(27))
1451      || ((TEST_OPT_MULTBOUND) && (scMult0Int((strat->Shdl)) < mu)))
1452      {
1453        /*
1454        * stops computation if strat->kHEdgeFound and
1455        * - 27 (finiteDeterminacyTest)
1456        * or
1457        * - 23
1458        *   (multBound)
1459        *   && multiplicity of the ideal is smaller then a predefined number mu
1460        */
1461        while (strat->Ll >= 0) deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
1462      }
1463    }
1464  }
1465  /*- complete reduction of the standard basis------------------------ -*/
1466  if (TEST_OPT_REDSB) completeReduce(strat);
1467  /*- release temp data------------------------------- -*/
1468  exitBuchMora(strat);
1469  /*- polynomials used for HECKE: HC, noether -*/
1470  if (BTEST1(27))
1471  {
1472    if (strat->kHEdge)
1473      Kstd1_mu=pFDeg(strat->kHEdge);
1474    else
1475      Kstd1_mu=-1;
1476  }
1477  pDelete(&strat->kHEdge);
1478  strat->update = TRUE; //???
1479  strat->lastAxis = 0; //???
1480  pDelete(&strat->kNoether);
1481  Free((ADDRESS)strat->NotUsedAxis,(pVariables+1)*sizeof(BOOLEAN));
1482#ifdef SDRING
1483  Free((ADDRESS)aug,augmax*sizeof(poly));
1484#endif
1485  if (TEST_OPT_PROT) messageStat(srmax,lrmax,hilbcount,strat);
1486  if (TEST_OPT_WEIGHTM)
1487  {
1488    pFDeg=pFDegOld;
1489    pLDeg=pLDegOld;
1490    if (ecartWeights)
1491    {
1492      Free((ADDRESS)ecartWeights,(pVariables+1)*sizeof(short));
1493      ecartWeights=NULL;
1494    }
1495  }
1496  if (Q!=NULL) updateResult(strat->Shdl,Q,strat);
1497  return (strat->Shdl);
1498}
1499
1500poly kNF1 (ideal F,ideal Q,poly q, kStrategy strat, int lazyReduce)
1501{
1502  poly   p;
1503  int   i;
1504  int   j;
1505  int   o;
1506  LObject   h;
1507  BITSET save_test=test;
1508
1509  if ((idIs0(F))&&(Q==NULL))
1510    return pCopy(q); /*F=0*/
1511  strat->ak = idRankFreeModule(F);
1512  /*- creating temp data structures------------------- -*/
1513  strat->kHEdgeFound = ppNoether != NULL;
1514  strat->kNoether    = pCopy(ppNoether);
1515  test|=Sy_bit(OPT_REDTAIL);
1516  test&=~Sy_bit(OPT_INTSTRATEGY);
1517  if (TEST_OPT_STAIRCASEBOUND
1518  && (0<Kstd1_deg)
1519  && ((!strat->kHEdgeFound)
1520    ||(TEST_OPT_DEGBOUND && (pWTotaldegree(strat->kNoether)<Kstd1_deg))))
1521  {
1522    pDelete(&strat->kNoether);
1523    strat->kNoether=pOne();
1524    pGetExp(strat->kNoether,1)=Kstd1_deg+1;
1525    pSetm(strat->kNoether);
1526    strat->kHEdgeFound=TRUE;
1527  }
1528  initBuchMoraCrit(strat);
1529  initBuchMoraPos(strat);
1530  initMora(F,strat);
1531  strat->enterS = enterSMoraNF;
1532  /*- set T -*/
1533  strat->tl = -1;
1534  strat->tmax = setmax;
1535  strat->T = initT();
1536  /*- set S -*/
1537  strat->sl = -1;
1538  /*- init local data struct.-------------------------- -*/
1539  /*Shdl=*/initS(F,Q,strat);
1540  if (lazyReduce==0)
1541  {
1542    for (i=strat->sl; i>=0; i--)
1543      pNorm(strat->S[i]);
1544  }
1545  /*- puts the elements of S also to T -*/
1546  for (i=0; i<=strat->sl; i++)
1547  {
1548    h.p = strat->S[i];
1549    h.ecart = strat->ecartS[i];
1550    h.length = pLength(h.p);
1551    enterT(h,strat);
1552  }
1553  /*- compute------------------------------------------- -*/
1554  p = pCopy(q);
1555  deleteHC(&p,&o,&j,strat);
1556  if (p!=NULL) p = redMoraNF(p,strat);
1557  if ((p!=NULL)&&(lazyReduce==0))
1558  {
1559    p = redtail(p,strat->sl,strat);
1560  }
1561  /*- release temp data------------------------------- -*/
1562  cleanT(strat);
1563  Free((ADDRESS)strat->T,strat->tmax*sizeof(TObject));
1564  Free((ADDRESS)strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
1565  Free((ADDRESS)strat->NotUsedAxis,(pVariables+1)*sizeof(BOOLEAN));
1566  if ((Q!=NULL)&&(strat->fromQ!=NULL))
1567  {
1568    i=((IDELEMS(Q)+IDELEMS(F)+15)/16)*16;
1569    Free((ADDRESS)strat->fromQ,i*sizeof(int));
1570    strat->fromQ=NULL;
1571  }
1572  pDelete(&strat->kHEdge);
1573  pDelete(&strat->kNoether);
1574  if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
1575  {
1576    pFDeg=pFDegOld;
1577    pLDeg=pLDegOld;
1578    if (ecartWeights)
1579    {
1580      Free((ADDRESS *)&ecartWeights,(pVariables+1)*sizeof(short));
1581      ecartWeights=NULL;
1582    }
1583  }
1584  idDelete(&strat->Shdl);
1585  test=save_test;
1586  return p;
1587}
1588
1589ideal kNF1 (ideal F,ideal Q,ideal q, kStrategy strat, int lazyReduce)
1590{
1591  poly   p;
1592  int   i;
1593  int   j;
1594  int   o;
1595  LObject   h;
1596  ideal res;
1597  BITSET save_test=test;
1598
1599  if (idIs0(q)) return idInit(1,q->rank);
1600  if ((idIs0(F))&&(Q==NULL))
1601    return idCopy(q); /*F=0*/
1602  strat->ak = idRankFreeModule(F);
1603  /*- creating temp data structures------------------- -*/
1604  strat->kHEdgeFound = ppNoether != NULL;
1605  strat->kNoether=pCopy(ppNoether);
1606  test|=Sy_bit(OPT_REDTAIL);
1607  if (TEST_OPT_STAIRCASEBOUND
1608  && (0<Kstd1_deg)
1609  && ((!strat->kHEdgeFound)
1610    ||(TEST_OPT_DEGBOUND && (pWTotaldegree(strat->kNoether)<Kstd1_deg))))
1611  {
1612    pDelete(&strat->kNoether);
1613    strat->kNoether=pOne();
1614    pGetExp(strat->kNoether,1)=Kstd1_deg+1;
1615    pSetm(strat->kNoether);
1616    strat->kHEdgeFound=TRUE;
1617  }
1618  initBuchMoraCrit(strat);
1619  initBuchMoraPos(strat);
1620  initMora(F,strat);
1621  strat->enterS = enterSMoraNF;
1622  /*- set T -*/
1623  strat->tl = -1;
1624  strat->tmax = setmax;
1625  strat->T = initT();
1626  /*- set S -*/
1627  strat->sl = -1;
1628  /*- init local data struct.-------------------------- -*/
1629  /*Shdl=*/initS(F,Q,strat);
1630  if (TEST_OPT_INTSTRATEGY&&(lazyReduce==0))
1631  {
1632    for (i=strat->sl; i>=0; i--)
1633      pNorm(strat->S[i]);
1634  }
1635  /*- compute------------------------------------------- -*/
1636  res=idInit(IDELEMS(q),q->rank);
1637  for (i=0; i<IDELEMS(q); i++)
1638  {
1639    if (q->m[i]!=NULL)
1640    {
1641      p = pCopy(q->m[i]);
1642      deleteHC(&p,&o,&j,strat);
1643      if (p!=NULL)
1644      {
1645        /*- puts the elements of S also to T -*/
1646        for (j=0; j<=strat->sl; j++)
1647        {
1648          h.p = strat->S[j];
1649          h.ecart = strat->ecartS[j];
1650          h.length = pLength(h.p);
1651          enterT(h,strat);
1652        }
1653        p = redMoraNF(p,strat);
1654        if ((p!=NULL)&&(lazyReduce==0))
1655        {
1656          p = redtail(p,strat->sl,strat);
1657        }
1658        cleanT(strat);
1659      }
1660      res->m[i]=p;
1661    }
1662    //else
1663    //  res->m[i]=NULL;
1664    if (TEST_OPT_PROT)
1665    {
1666      PrintS("-");mflush();
1667    }
1668  }
1669  /*- release temp data------------------------------- -*/
1670  Free((ADDRESS)strat->T,strat->tmax*sizeof(TObject));
1671  Free((ADDRESS)strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
1672  if ((Q!=NULL)&&(strat->fromQ!=NULL))
1673  {
1674    i=((IDELEMS(Q)+IDELEMS(F)+15)/16)*16;
1675    Free((ADDRESS)strat->fromQ,i*sizeof(int));
1676    strat->fromQ=NULL;
1677  }
1678  pDelete(&strat->kHEdge);
1679  pDelete(&strat->kNoether);
1680  if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
1681  {
1682    pFDeg=pFDegOld;
1683    pLDeg=pLDegOld;
1684    if (ecartWeights)
1685    {
1686      Free((ADDRESS *)&ecartWeights,(pVariables+1)*sizeof(short));
1687      ecartWeights=NULL;
1688    }
1689  }
1690  idDelete(&strat->Shdl);
1691  test=save_test;
1692  return res;
1693}
1694
1695pFDegProc pOldFDeg;
1696intvec * kModW;
1697
1698int kModDeg(poly p)
1699{
1700  int o=pOldFDeg(p);
1701  int i=pGetComp(p);
1702  if (i==0) return o;
1703  return o+(*kModW)[i-1];
1704}
1705ideal std(ideal F, ideal Q, tHomog h,intvec ** w, intvec *hilb,int syzComp,
1706          int newIdeal)
1707{
1708  ideal r;
1709  BOOLEAN b=pLexOrder,toReset=FALSE;
1710  BOOLEAN delete_w=(w==NULL);
1711  kStrategy strat=(kStrategy)Alloc0(sizeof(skStrategy));
1712
1713  if(!TEST_OPT_RETURN_SB)
1714    strat->syzComp = syzComp;
1715  if (TEST_OPT_SB_1)
1716    strat->newIdeal = newIdeal;
1717  if (currRing->ch==0) strat->LazyPass=2;
1718  else                 strat->LazyPass=20;
1719  strat->LazyDegree = 1;
1720  if ((h==testHomog)
1721#ifdef DRING
1722  && (!pDRING)
1723#endif
1724  )
1725  {
1726    if (idRankFreeModule(F)==0)       
1727    {
1728      h = (tHomog)idHomIdeal(F,Q);   
1729      w=NULL;
1730    }
1731    else
1732      h = (tHomog)idHomModule(F,Q,w); 
1733    //Print("test homog:%d\n",h);     
1734    //if ((h==isHomog)&&(w!=NULL)&&(*w!=NULL))
1735    //{
1736    //  (*w)->show();
1737    //  PrintLn();
1738    //  if (F!=NULL) jjPRINT_MA0(idModule2Matrix(idCopy(F)),sNoName);   
1739    //}
1740  }
1741#ifdef DRING
1742  if (pDRING) h=isNotHomog;
1743#endif
1744  if (h==isHomog)
1745  {
1746    if ((w!=NULL) && (*w!=NULL))     
1747    {
1748      kModW = *w;
1749      pOldFDeg = pFDeg;
1750      pFDeg = kModDeg;
1751      toReset = TRUE;
1752    }
1753    pLexOrder = TRUE;
1754    if (hilb==NULL) strat->LazyPass*=2;
1755  }
1756  strat->homog=h;
1757  spSet(currRing);
1758  if (pOrdSgn==-1)
1759  {
1760    if (w!=NULL)
1761      r=mora(F,Q,*w,hilb,strat);     
1762    else
1763      r=mora(F,Q,NULL,hilb,strat);
1764  }
1765  else
1766  {
1767    #ifdef STDTRACE
1768    lists l;
1769    if (w!=NULL)
1770      l=bbaLink(F,Q,*w,hilb,strat);
1771    else
1772      l=bbaLink(F,Q,NULL,hilb,strat);
1773    r=(ideal)(l->m[0].data);
1774    l->m[0].data=NULL;
1775    l->Clean();
1776    #else
1777    if (w!=NULL)
1778      r=bba(F,Q,*w,hilb,strat);
1779    else
1780      r=bba(F,Q,NULL,hilb,strat);
1781    #endif
1782  }
1783#ifdef KDEBUG
1784  int i;
1785  for (i=0; i<IDELEMS(r); i++) pTest(r->m[i]);
1786#endif
1787  if (toReset)
1788  {
1789    kModW = NULL;
1790    pFDeg = pOldFDeg;
1791  }
1792  pLexOrder = b;
1793//Print("%d reductions canceled \n",strat->cel);
1794  HCord=strat->HCord;
1795  Free((ADDRESS)strat,sizeof(skStrategy));
1796  if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;
1797  return r;
1798}
1799
1800//##############################################################
1801//##############################################################
1802//##############################################################
1803//##############################################################
1804//##############################################################
1805
1806#ifdef STDTRACE
1807lists TraceStd(leftv lv,int rw, ideal F, ideal Q, tHomog h,intvec ** w, intvec *hilb,int syzComp,
1808          int newIdeal)
1809{
1810  lists l;
1811  ideal r;
1812  stdLink stdTrace=(stdLink) Alloc0(sizeof(skstdLink));
1813  BOOLEAN b=pLexOrder,toReset=FALSE;
1814  BOOLEAN delete_w=(w==NULL);
1815  kStrategy strat=(kStrategy)Alloc0(sizeof(skStrategy));
1816
1817  if(!TEST_OPT_RETURN_SB)
1818    strat->syzComp = syzComp;
1819  if (TEST_OPT_SB_1)
1820    strat->newIdeal = newIdeal;
1821  strat->LazyPass=32000;
1822  strat->LazyDegree = 10;
1823//   if(stdTrace!=NULL)
1824//     stdTrace->GetPrimes(F,primes);  // Array mit Primzahlen muß geordnet sein !
1825
1826  if ((h==testHomog)
1827#ifdef DRING
1828  && (!pDRING)
1829#endif
1830  )
1831  {
1832    if (idRankFreeModule(F)==0)
1833    {
1834      h = (tHomog)idHomIdeal(F,Q);
1835      w=NULL;
1836    }
1837    else
1838      h = (tHomog)idHomModule(F,Q,w);
1839  }
1840#ifdef DRING
1841  if (pDRING) h=isNotHomog;
1842#endif
1843  if (h==isHomog)
1844  {
1845    if ((w!=NULL) && (*w!=NULL))
1846    {
1847      kModW = *w;
1848      pOldFDeg = pFDeg;
1849      pFDeg = kModDeg;
1850      toReset = TRUE;
1851    }
1852    pLexOrder = TRUE;
1853    if (hilb==NULL) strat->LazyPass*=2;
1854  }
1855  strat->homog=h;
1856  spSet(currRing);
1857//   if (pOrdSgn==-1)
1858//   {
1859//     if (w!=NULL)
1860//       r=mora(F,Q,*w,hilb,strat);
1861//     else
1862//       r=mora(F,Q,NULL,hilb,strat);
1863//   }
1864//   else
1865  {
1866    stdTrace->Init(lv,rw);
1867    if(w==NULL)
1868      l=bbaLink(F,Q,NULL,hilb,strat,stdTrace);
1869    else
1870      l=bbaLink(F,Q,*w,hilb,strat,stdTrace);
1871    r=(ideal) (l->m[0].Data());
1872  }
1873#ifdef KDEBUG
1874  int i;
1875  for (i=0; i<IDELEMS(r); i++) pTest(r->m[i]);
1876#endif
1877  if (toReset)
1878  {
1879    kModW = NULL;
1880    pFDeg = pOldFDeg;
1881  }
1882  pLexOrder = b;
1883//Print("%d reductions canceled \n",strat->cel);
1884  HCord=strat->HCord;
1885  Free((ADDRESS)strat,sizeof(skStrategy));
1886  if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;
1887  if(stdTrace!=NULL)
1888  {
1889    stdTrace->Kill();
1890    Free(stdTrace, sizeof(skstdLink));
1891  }
1892
1893  return l;
1894}
1895#endif
1896
1897lists min_std(ideal F, ideal Q, tHomog h,intvec ** w, intvec *hilb,int syzComp,
1898              int reduced)
1899{
1900  ideal r=NULL;
1901  int Kstd1_OldDeg,i;
1902  BOOLEAN b=pLexOrder,toReset=FALSE;
1903  BOOLEAN delete_w=(w==NULL);
1904  BOOLEAN oldDegBound=TEST_OPT_DEGBOUND;
1905  kStrategy strat=(kStrategy)Alloc0(sizeof(skStrategy));
1906
1907  if(!TEST_OPT_RETURN_SB)
1908     strat->syzComp = syzComp;
1909  if (currRing->ch==0) strat->LazyPass=2;
1910  else                 strat->LazyPass=20;
1911  strat->LazyDegree = 1;
1912  strat->minim=(reduced % 2)+1;
1913  if ((h==testHomog)
1914#ifdef DRING
1915  && (!pDRING)
1916#endif
1917  )
1918  {
1919    if (idRankFreeModule(F)==0)
1920    {
1921      h = (tHomog)idHomIdeal(F,Q);
1922      w=NULL;
1923    }
1924    else
1925    {
1926      h = (tHomog)idHomModule(F,Q,w);
1927    }
1928  }
1929#ifdef DRING
1930  if (pDRING) h=isNotHomog;
1931#endif
1932  if (h==isHomog)
1933  {
1934    if ((w!=NULL) && (*w!=NULL))
1935    {
1936      kModW = *w;
1937      pOldFDeg = pFDeg;
1938      pFDeg = kModDeg;
1939      toReset = TRUE;
1940      if (reduced>1)
1941      {
1942        Kstd1_OldDeg=Kstd1_deg;
1943        Kstd1_deg = -1;
1944        for (i=IDELEMS(F)-1;i>=0;i--)
1945        {
1946          if ((F->m[i]!=NULL) && (pFDeg(F->m[i])>=Kstd1_deg))
1947            Kstd1_deg = pFDeg(F->m[i])+1;
1948        }
1949      }
1950    }
1951    pLexOrder = TRUE;
1952    strat->LazyPass*=2;
1953  }
1954  strat->homog=h;
1955  spSet(currRing);
1956  if (pOrdSgn==-1)
1957  {
1958    if (w!=NULL)
1959      r=mora(F,Q,*w,hilb,strat);
1960    else
1961      r=mora(F,Q,NULL,hilb,strat);
1962  }
1963  else
1964  {
1965  #ifdef STDTRACE
1966    lists rl;
1967    if (w!=NULL)
1968      rl=bbaLink(F, Q, *w, hilb, strat, NULL);
1969    else
1970      rl=bbaLink(F, Q, NULL, hilb, strat, NULL);
1971    r=(ideal)(rl->m[0].data);
1972    rl->m[0].data=NULL;
1973    rl->Clean();
1974  #else
1975    if (w!=NULL)
1976      r=bba(F,Q,*w,hilb,strat);
1977    else
1978      r=bba(F,Q,NULL,hilb,strat);
1979  #endif
1980  }
1981#ifdef KDEBUG
1982  {
1983    int i;
1984    for (i=0; i<IDELEMS(r); i++) pTest(r->m[i]);
1985  }
1986#endif
1987  idSkipZeroes(r);
1988  if (toReset)
1989  {
1990    kModW = NULL;
1991    pFDeg = pOldFDeg;
1992  }
1993  pLexOrder = b;
1994  HCord=strat->HCord;
1995  if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;
1996  lists l=(lists)Alloc(sizeof(slists));
1997  l->Init(2);
1998  l->m[0].rtyp=IDEAL_CMD;
1999  l->m[0].data=(void *)r;
2000  setFlag(&(l->m[0]),FLAG_STD);
2001  l->m[1].rtyp=IDEAL_CMD;
2002  if (strat->M==NULL)
2003  {
2004    l->m[1].data=(void *)idInit(1,F->rank);
2005    Warn("no minimal generating set computed");
2006  } 
2007  else
2008  {
2009    idSkipZeroes(strat->M);
2010    l->m[1].data=(void *)strat->M;
2011  }
2012  Free((ADDRESS)strat,sizeof(skStrategy));
2013  if (reduced>2)
2014  { 
2015    Kstd1_deg=Kstd1_OldDeg;
2016    if (!oldDegBound)
2017      test &= ~Sy_bit(OPT_DEGBOUND);
2018  }
2019  return l;
2020}
2021
2022poly kNF(ideal F, ideal Q, poly p,int syzComp, int lazyReduce)
2023{
2024  if (p==NULL)
2025     return NULL;
2026  kStrategy strat=(kStrategy)Alloc0(sizeof(skStrategy));
2027  strat->syzComp = syzComp;
2028  spSet(currRing);
2029  if (pOrdSgn==-1)
2030    p=kNF1(F,Q,p,strat,lazyReduce);
2031  else
2032    p=kNF2(F,Q,p,strat,lazyReduce);
2033  Free((ADDRESS)strat,sizeof(skStrategy));
2034  return p;
2035}
2036
2037ideal kNF(ideal F, ideal Q, ideal p,int syzComp,int lazyReduce)
2038{
2039  ideal res;
2040  spSet(currRing);
2041  if (TEST_OPT_PROT)
2042  {
2043    Print("(S:%d)",IDELEMS(p));mflush();
2044  }
2045  kStrategy strat=(kStrategy)Alloc0(sizeof(skStrategy));
2046  strat->syzComp = syzComp;
2047  if (pOrdSgn==-1)
2048    res=kNF1(F,Q,p,strat,lazyReduce);
2049  else
2050    res=kNF2(F,Q,p,strat,lazyReduce);
2051  if (TEST_OPT_PROT)
2052  {
2053    PrintLn();
2054  }
2055  Free((ADDRESS)strat,sizeof(skStrategy));
2056  return res;
2057}
2058
2059/*2
2060*interreduces F
2061*/
2062ideal kInterRed (ideal F, ideal Q)
2063{
2064  int j;
2065  kStrategy strat = (kStrategy)Alloc0(sizeof(skStrategy));
2066
2067//  if (TEST_OPT_PROT)
2068//  {
2069//    writeTime("start InterRed:");
2070//    mflush();
2071//  }
2072  //strat->syzComp     = 0;
2073  strat->kHEdgeFound = ppNoether != NULL;
2074  strat->kNoether=pCopy(ppNoether);
2075  strat->ak = idRankFreeModule(F);
2076  spSet(currRing);
2077  initBuchMoraCrit(strat);
2078  strat->NotUsedAxis = (BOOLEAN *)Alloc((pVariables+1)*sizeof(BOOLEAN));
2079  for (j=1; j<=pVariables; j++) strat->NotUsedAxis[j] = TRUE;
2080  strat->enterS      = enterSBba;
2081  strat->posInT      = posInT0;
2082  strat->initEcart   = initEcartNormal;
2083  strat->sl   = -1;
2084  strat->tl          = -1;
2085  strat->tmax        = setmax;
2086  strat->T           = initT();
2087  if (pOrdSgn == -1)   strat->honey = TRUE;
2088  initS(F,Q,strat);
2089  updateS(TRUE,strat);
2090  if (TEST_OPT_REDSB && TEST_OPT_INTSTRATEGY)
2091    completeReduce(strat);
2092  pDelete(&strat->kHEdge);
2093  Free((ADDRESS)strat->T,strat->tmax*sizeof(TObject));
2094  Free((ADDRESS)strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
2095  Free((ADDRESS)strat->NotUsedAxis,(pVariables+1)*sizeof(BOOLEAN));
2096  if (strat->fromQ)
2097  {
2098    for (j=0;j<IDELEMS(strat->Shdl);j++)
2099    {
2100      if(strat->fromQ[j]) pDelete(&strat->Shdl->m[j]);
2101    }
2102    Free((ADDRESS)strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
2103    strat->fromQ=NULL;
2104    idSkipZeroes(strat->Shdl);
2105  }
2106//  if (TEST_OPT_PROT)
2107//  {
2108//    writeTime("end Interred:");
2109//    mflush();
2110//  }
2111  ideal shdl=strat->Shdl;
2112  Free((ADDRESS)strat,sizeof(skStrategy));
2113  return shdl;
2114}
Note: See TracBrowser for help on using the repository browser.