1 | /**************************************** |
---|
2 | * Computer Algebra System SINGULAR * |
---|
3 | ****************************************/ |
---|
4 | /* $Id: kstd2.cc,v 1.26 1999-05-29 11:59:16 Singular Exp $ */ |
---|
5 | /* |
---|
6 | * ABSTRACT - Kernel: alg. of Buchberger |
---|
7 | */ |
---|
8 | |
---|
9 | #include "mod2.h" |
---|
10 | #include "tok.h" |
---|
11 | #include "mmemory.h" |
---|
12 | #include "polys.h" |
---|
13 | #include "ideals.h" |
---|
14 | #include "febase.h" |
---|
15 | #include "kutil.h" |
---|
16 | #include "kstd1.h" |
---|
17 | #include "kstd2.h" |
---|
18 | #include "khstd.h" |
---|
19 | #include "spolys.h" |
---|
20 | #include "cntrlc.h" |
---|
21 | #include "weight.h" |
---|
22 | #include "ipid.h" |
---|
23 | #include "ipshell.h" |
---|
24 | #include "intvec.h" |
---|
25 | #ifdef STDTRACE |
---|
26 | #include "comm.h" |
---|
27 | #include "lists.h" |
---|
28 | #endif |
---|
29 | #include "spSpolyLoop.h" |
---|
30 | |
---|
31 | // #include "timer.h" |
---|
32 | |
---|
33 | /*2 |
---|
34 | * consider the part above syzComp: |
---|
35 | * (assume the polynomial comes from a syz computation) |
---|
36 | * - it is a constant term: return a copy of it |
---|
37 | * - else: return NULL |
---|
38 | */ |
---|
39 | static poly kFromInput(poly p,kStrategy strat) |
---|
40 | { |
---|
41 | poly q=p; |
---|
42 | |
---|
43 | if (pGetComp(q)>strat->syzComp) return NULL; |
---|
44 | while ((q!=NULL) && (pGetComp(q)<=strat->syzComp)) pIter(q); |
---|
45 | if (pIsConstantComp(q)) |
---|
46 | return pHead(q); |
---|
47 | return NULL; |
---|
48 | } |
---|
49 | |
---|
50 | /*2 |
---|
51 | * reduction procedure for the syz |
---|
52 | * and TEST_OPT_MINRES: special minimizing during computations |
---|
53 | * assumes homogeneous case and degree-ordering |
---|
54 | */ |
---|
55 | static void redSyz (LObject* h,kStrategy strat) |
---|
56 | { |
---|
57 | int j = 0,i=0,pos; |
---|
58 | BOOLEAN exchanged=pDivisibleBy((*h).p2,(*h).p1); |
---|
59 | poly p,q; |
---|
60 | |
---|
61 | if (exchanged) |
---|
62 | { |
---|
63 | q = kFromInput((*h).p1,strat); |
---|
64 | if (q==NULL) |
---|
65 | { |
---|
66 | exchanged = FALSE; |
---|
67 | } |
---|
68 | else |
---|
69 | { |
---|
70 | while (i<=strat->Ll) |
---|
71 | { |
---|
72 | if ((strat->L[i].p1==strat->P.p1) || (strat->L[i].p2==strat->P.p1)) |
---|
73 | { |
---|
74 | deleteInL(strat->L,&strat->Ll,i,strat); |
---|
75 | } |
---|
76 | else |
---|
77 | i++; |
---|
78 | } |
---|
79 | i = 0; |
---|
80 | } |
---|
81 | } |
---|
82 | if (TEST_OPT_DEBUG) |
---|
83 | { |
---|
84 | PrintS("red:"); |
---|
85 | wrp(h->p); |
---|
86 | } |
---|
87 | loop |
---|
88 | { |
---|
89 | if (pDivisibleBy(strat->S[j],(*h).p)) |
---|
90 | { |
---|
91 | if ((!exchanged) && (pEqual((*h).p,strat->S[j]))) |
---|
92 | { |
---|
93 | q = kFromInput(strat->S[j],strat); |
---|
94 | if (q!=NULL) |
---|
95 | { |
---|
96 | exchanged = TRUE; |
---|
97 | p = strat->S[j]; |
---|
98 | if (!TEST_OPT_INTSTRATEGY) |
---|
99 | pNorm((*h).p); |
---|
100 | else |
---|
101 | { |
---|
102 | //pContent((*h).p); |
---|
103 | pCleardenom((*h).p);// also does a pContent |
---|
104 | } |
---|
105 | strat->S[j] = (*h).p; |
---|
106 | (*h).p = p; |
---|
107 | while ((i<=strat->tl) && (strat->T[i].p!=p)) i++; |
---|
108 | if (i<=strat->tl) strat->T[i].p = strat->S[j]; |
---|
109 | for (i=0;i<=strat->Ll;i++) |
---|
110 | { |
---|
111 | if (strat->L[i].p1==p) strat->L[i].p1=strat->S[j]; |
---|
112 | if (strat->L[i].p2==p) strat->L[i].p2=strat->S[j]; |
---|
113 | } |
---|
114 | } |
---|
115 | } |
---|
116 | //if (strat->interpt) test_int_std(strat->kIdeal); |
---|
117 | /*- compute the s-polynomial -*/ |
---|
118 | if (TEST_OPT_DEBUG) |
---|
119 | { |
---|
120 | PrintS(" with "); |
---|
121 | wrp(strat->S[j]); |
---|
122 | } |
---|
123 | (*h).p = spSpolyRed(strat->S[j],(*h).p,strat->kNoether, |
---|
124 | strat->spSpolyLoop); |
---|
125 | if (TEST_OPT_DEBUG) |
---|
126 | { |
---|
127 | PrintS("\nto "); wrp((*h).p);PrintLn(); |
---|
128 | } |
---|
129 | if ((*h).p == NULL) |
---|
130 | { |
---|
131 | if (h->lcm!=NULL) pFree1((*h).lcm); |
---|
132 | #ifdef KDEBUG |
---|
133 | (*h).lcm=NULL; |
---|
134 | #endif |
---|
135 | return; |
---|
136 | } |
---|
137 | /*- try to reduce the s-polynomial -*/ |
---|
138 | j = 0; |
---|
139 | } |
---|
140 | else |
---|
141 | { |
---|
142 | if (j >= strat->sl) |
---|
143 | { |
---|
144 | if (exchanged) |
---|
145 | { |
---|
146 | if (pGetComp((*h).p) > strat->syzComp) |
---|
147 | { |
---|
148 | pDelete(&((*h).p)); |
---|
149 | return; |
---|
150 | } |
---|
151 | else |
---|
152 | { |
---|
153 | if (!TEST_OPT_INTSTRATEGY) |
---|
154 | { |
---|
155 | pos = posInS(strat->S,strat->sl,(*h).p); |
---|
156 | pNorm((*h).p); |
---|
157 | (*h).p = redtailSyz((*h).p,pos-1,strat); |
---|
158 | } |
---|
159 | p = (*h).p; |
---|
160 | while ((pNext(p)!=NULL) && (pGetComp(pNext(p))<=strat->syzComp)) |
---|
161 | pIter(p); |
---|
162 | pDelete(&pNext(p)); |
---|
163 | pNext(p) = q; |
---|
164 | } |
---|
165 | } |
---|
166 | else if (!TEST_OPT_INTSTRATEGY) |
---|
167 | { |
---|
168 | pos = posInS(strat->S,strat->sl,(*h).p); |
---|
169 | pNorm((*h).p); |
---|
170 | (*h).p = redtailSyz((*h).p,pos-1,strat); |
---|
171 | } |
---|
172 | enterTBba((*h),strat->tl+1,strat); |
---|
173 | return; |
---|
174 | } |
---|
175 | j++; |
---|
176 | } |
---|
177 | } |
---|
178 | } |
---|
179 | |
---|
180 | /*2 |
---|
181 | * reduction procedure for the homogeneous case |
---|
182 | * and the case of a degree-ordering |
---|
183 | */ |
---|
184 | |
---|
185 | static void redHomog (LObject* h,kStrategy strat) |
---|
186 | { |
---|
187 | if (strat->tl<0) |
---|
188 | { |
---|
189 | enterTBba((*h),0,strat); |
---|
190 | return; |
---|
191 | } |
---|
192 | |
---|
193 | int j = 0; |
---|
194 | |
---|
195 | if (strat->ak!=0) |
---|
196 | { |
---|
197 | loop |
---|
198 | { |
---|
199 | if (pDivisibleBy1(strat->S[j],(*h).p)) |
---|
200 | { |
---|
201 | //if (strat->interpt) test_int_std(strat->kIdeal); |
---|
202 | /*- compute the s-polynomial -*/ |
---|
203 | if (TEST_OPT_DEBUG) |
---|
204 | { |
---|
205 | PrintS("red:"); |
---|
206 | wrp(h->p); |
---|
207 | PrintS(" with "); |
---|
208 | wrp(strat->S[j]); |
---|
209 | } |
---|
210 | (*h).p = spSpolyRed(strat->S[j],(*h).p,strat->kNoether, |
---|
211 | strat->spSpolyLoop); |
---|
212 | if (TEST_OPT_DEBUG) |
---|
213 | { |
---|
214 | PrintS("\nto "); |
---|
215 | wrp(h->p); |
---|
216 | PrintLn(); |
---|
217 | } |
---|
218 | if ((*h).p == NULL) |
---|
219 | { |
---|
220 | if (h->lcm!=NULL) pFree1((*h).lcm); |
---|
221 | #ifdef KDEBUG |
---|
222 | (*h).lcm=NULL; |
---|
223 | #endif |
---|
224 | return; |
---|
225 | } |
---|
226 | j = 0; |
---|
227 | } |
---|
228 | else |
---|
229 | { |
---|
230 | if (j >= strat->sl) |
---|
231 | { |
---|
232 | enterTBba((*h),strat->tl+1,strat); |
---|
233 | return; |
---|
234 | } |
---|
235 | j++; |
---|
236 | } |
---|
237 | } |
---|
238 | } |
---|
239 | else |
---|
240 | { |
---|
241 | // no module component |
---|
242 | loop |
---|
243 | { |
---|
244 | if (pDivisibleBy2(strat->S[j],(*h).p)) |
---|
245 | { |
---|
246 | //if (strat->interpt) test_int_std(strat->kIdeal); |
---|
247 | /*- compute the s-polynomial -*/ |
---|
248 | if (TEST_OPT_DEBUG) |
---|
249 | { |
---|
250 | PrintS("red:"); |
---|
251 | wrp(h->p); |
---|
252 | PrintS(" with "); |
---|
253 | wrp(strat->S[j]); |
---|
254 | } |
---|
255 | (*h).p = spSpolyRed(strat->S[j],(*h).p,strat->kNoether, |
---|
256 | strat->spSpolyLoop); |
---|
257 | if (TEST_OPT_DEBUG) |
---|
258 | { |
---|
259 | PrintS("\nto "); |
---|
260 | wrp(h->p); |
---|
261 | PrintLn(); |
---|
262 | } |
---|
263 | if ((*h).p == NULL) |
---|
264 | { |
---|
265 | if (h->lcm!=NULL) pFree1((*h).lcm); |
---|
266 | #ifdef KDEBUG |
---|
267 | (*h).lcm=NULL; |
---|
268 | #endif |
---|
269 | return; |
---|
270 | } |
---|
271 | j = 0; |
---|
272 | } |
---|
273 | else |
---|
274 | { |
---|
275 | if (j >= strat->sl) |
---|
276 | { |
---|
277 | enterTBba((*h),strat->tl+1,strat); |
---|
278 | return; |
---|
279 | } |
---|
280 | j++; |
---|
281 | } |
---|
282 | } |
---|
283 | } |
---|
284 | } |
---|
285 | |
---|
286 | /*2 |
---|
287 | * reduction procedure for the homogeneous case |
---|
288 | * and the case of a degree-ordering |
---|
289 | */ |
---|
290 | static void redHomog0 (LObject* h,kStrategy strat) |
---|
291 | { |
---|
292 | if (strat->tl<0) |
---|
293 | { |
---|
294 | enterTBba((*h),0,strat); |
---|
295 | return; |
---|
296 | } |
---|
297 | |
---|
298 | int j = 0; |
---|
299 | int k = 0; |
---|
300 | |
---|
301 | if (strat->ak) |
---|
302 | { |
---|
303 | loop |
---|
304 | { |
---|
305 | if (pDivisibleBy1(strat->T[j].p,(*h).p)) |
---|
306 | { |
---|
307 | //if (strat->interpt) test_int_std(strat->kIdeal); |
---|
308 | /*- compute the s-polynomial -*/ |
---|
309 | if (TEST_OPT_DEBUG) |
---|
310 | { |
---|
311 | PrintS("red:"); |
---|
312 | wrp(h->p); |
---|
313 | PrintS(" with "); |
---|
314 | wrp(strat->T[j].p); |
---|
315 | } |
---|
316 | (*h).p = spSpolyRed(strat->T[j].p,(*h).p,strat->kNoether, |
---|
317 | strat->spSpolyLoop); |
---|
318 | if (TEST_OPT_DEBUG) |
---|
319 | { |
---|
320 | PrintS("\nto "); |
---|
321 | wrp(h->p); |
---|
322 | PrintLn(); |
---|
323 | } |
---|
324 | if ((*h).p == NULL) |
---|
325 | { |
---|
326 | if (h->lcm!=NULL) pFree1((*h).lcm); |
---|
327 | #ifdef KDEBUG |
---|
328 | (*h).lcm=NULL; |
---|
329 | #endif |
---|
330 | return; |
---|
331 | } |
---|
332 | j = 0; |
---|
333 | } |
---|
334 | else |
---|
335 | { |
---|
336 | if (j >= strat->tl) |
---|
337 | { |
---|
338 | //pContent((*h).p); |
---|
339 | pCleardenom((*h).p);// also does a pContent |
---|
340 | /* |
---|
341 | * (*h).length=pLength0((*h).p); |
---|
342 | */ |
---|
343 | k=strat->posInT(strat->T,strat->tl,(*h)); |
---|
344 | enterTBba((*h),k,strat); |
---|
345 | return; |
---|
346 | } |
---|
347 | j++; |
---|
348 | } |
---|
349 | } |
---|
350 | } |
---|
351 | else |
---|
352 | { |
---|
353 | loop |
---|
354 | { |
---|
355 | |
---|
356 | // no module component |
---|
357 | if (pDivisibleBy2(strat->T[j].p,(*h).p)) |
---|
358 | { |
---|
359 | //if (strat->interpt) test_int_std(strat->kIdeal); |
---|
360 | /*- compute the s-polynomial -*/ |
---|
361 | if (TEST_OPT_DEBUG) |
---|
362 | { |
---|
363 | PrintS("red:"); |
---|
364 | wrp(h->p); |
---|
365 | PrintS(" with "); |
---|
366 | wrp(strat->T[j].p); |
---|
367 | } |
---|
368 | (*h).p = spSpolyRed(strat->T[j].p,(*h).p,strat->kNoether, |
---|
369 | strat->spSpolyLoop); |
---|
370 | if (TEST_OPT_DEBUG) |
---|
371 | { |
---|
372 | PrintS("\nto "); |
---|
373 | wrp(h->p); |
---|
374 | PrintLn(); |
---|
375 | } |
---|
376 | if ((*h).p == NULL) |
---|
377 | { |
---|
378 | if (h->lcm!=NULL) pFree1((*h).lcm); |
---|
379 | #ifdef KDEBUG |
---|
380 | (*h).lcm=NULL; |
---|
381 | #endif |
---|
382 | return; |
---|
383 | } |
---|
384 | j = 0; |
---|
385 | } |
---|
386 | else |
---|
387 | { |
---|
388 | if (j >= strat->tl) |
---|
389 | { |
---|
390 | //pContent((*h).p); |
---|
391 | pCleardenom((*h).p);// also does a pContent |
---|
392 | /* |
---|
393 | * (*h).length=pLength0((*h).p); |
---|
394 | */ |
---|
395 | k=strat->posInT(strat->T,strat->tl,(*h)); |
---|
396 | enterTBba((*h),k,strat); |
---|
397 | return; |
---|
398 | } |
---|
399 | j++; |
---|
400 | } |
---|
401 | } |
---|
402 | } |
---|
403 | } |
---|
404 | |
---|
405 | |
---|
406 | /*2 |
---|
407 | * reduction procedure for the inhomogeneous case |
---|
408 | * and not a degree-ordering |
---|
409 | */ |
---|
410 | static void redLazy (LObject* h,kStrategy strat) |
---|
411 | { |
---|
412 | if (strat->tl<0) |
---|
413 | { |
---|
414 | enterTBba((*h),0,strat); |
---|
415 | return; |
---|
416 | } |
---|
417 | |
---|
418 | int at,d,i; |
---|
419 | int j = 0; |
---|
420 | int pass = 0; |
---|
421 | int reddeg = pFDeg((*h).p); |
---|
422 | |
---|
423 | loop |
---|
424 | { |
---|
425 | if (pDivisibleBy1(strat->S[j],(*h).p)) |
---|
426 | { |
---|
427 | //if (strat->interpt) test_int_std(strat->kIdeal); |
---|
428 | /*- compute the s-polynomial -*/ |
---|
429 | if (TEST_OPT_DEBUG) |
---|
430 | { |
---|
431 | PrintS("red:"); |
---|
432 | wrp(h->p); |
---|
433 | PrintS(" with "); |
---|
434 | wrp(strat->T[j].p); |
---|
435 | } |
---|
436 | (*h).p = spSpolyRed(strat->S[j],(*h).p,strat->kNoether |
---|
437 | , strat->spSpolyLoop); |
---|
438 | if (TEST_OPT_DEBUG) |
---|
439 | { |
---|
440 | PrintS("\nto "); |
---|
441 | wrp(h->p); |
---|
442 | PrintLn(); |
---|
443 | } |
---|
444 | if ((*h).p == NULL) |
---|
445 | { |
---|
446 | if (h->lcm!=NULL) pFree1((*h).lcm); |
---|
447 | #ifdef KDEBUG |
---|
448 | (*h).lcm=NULL; |
---|
449 | #endif |
---|
450 | return; |
---|
451 | } |
---|
452 | /*- try to reduce the s-polynomial -*/ |
---|
453 | pass++; |
---|
454 | d = pFDeg((*h).p); |
---|
455 | if ((strat->Ll >= 0) && ((d > reddeg) || (pass > strat->LazyPass))) |
---|
456 | { |
---|
457 | at = posInL11(strat->L,strat->Ll,*h,strat); |
---|
458 | if (at <= strat->Ll) |
---|
459 | { |
---|
460 | i=strat->sl+1; |
---|
461 | do |
---|
462 | { |
---|
463 | i--; |
---|
464 | if (i<0) |
---|
465 | { |
---|
466 | enterTBba((*h),strat->tl+1,strat); |
---|
467 | return; |
---|
468 | } |
---|
469 | } |
---|
470 | while (!pDivisibleBy1(strat->S[i],(*h).p)); |
---|
471 | if (TEST_OPT_DEBUG) Print(" ->L[%d]\n",at); |
---|
472 | enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at); |
---|
473 | (*h).p = NULL; |
---|
474 | return; |
---|
475 | } |
---|
476 | } |
---|
477 | else if ((TEST_OPT_PROT) && (strat->Ll < 0) && (d != reddeg)) |
---|
478 | { |
---|
479 | Print(".%d",d);mflush(); |
---|
480 | reddeg = d; |
---|
481 | } |
---|
482 | j = 0; |
---|
483 | } |
---|
484 | else |
---|
485 | { |
---|
486 | if (j >= strat->sl) |
---|
487 | { |
---|
488 | if (TEST_OPT_INTSTRATEGY) |
---|
489 | { |
---|
490 | //pContent(h->p); |
---|
491 | pCleardenom(h->p);// also does a pContent |
---|
492 | } |
---|
493 | enterTBba((*h),strat->tl+1,strat); |
---|
494 | return; |
---|
495 | } |
---|
496 | j++; |
---|
497 | } |
---|
498 | } |
---|
499 | } |
---|
500 | |
---|
501 | /*2 |
---|
502 | * reduction procedure for the sugar-strategy (honey) |
---|
503 | * reduces h with elements from T choosing first possible |
---|
504 | * element in T with respect to the given ecart |
---|
505 | */ |
---|
506 | static void redHoney (LObject* h,kStrategy strat) |
---|
507 | { |
---|
508 | if (strat->tl<0) |
---|
509 | { |
---|
510 | enterTBba((*h),0,strat); |
---|
511 | return; |
---|
512 | } |
---|
513 | |
---|
514 | poly pi; |
---|
515 | int i,j,at,reddeg,d,pass,ei; |
---|
516 | |
---|
517 | pass = j = 0; |
---|
518 | d = reddeg = pFDeg((*h).p)+(*h).ecart; |
---|
519 | loop |
---|
520 | { |
---|
521 | if (pDivisibleBy1(strat->T[j].p,(*h).p)) |
---|
522 | { |
---|
523 | pi = strat->T[j].p; |
---|
524 | ei = strat->T[j].ecart; |
---|
525 | /* |
---|
526 | * the polynomial to reduce with (up to the moment) is; |
---|
527 | * pi with ecart ei |
---|
528 | */ |
---|
529 | i = j; |
---|
530 | loop |
---|
531 | { |
---|
532 | /*- takes the first possible with respect to ecart -*/ |
---|
533 | i++; |
---|
534 | if (i > strat->tl) |
---|
535 | break; |
---|
536 | if ((!BTEST1(20)) && (ei <= (*h).ecart)) |
---|
537 | break; |
---|
538 | if ((strat->T[i].ecart < ei) && pDivisibleBy1(strat->T[i].p,(*h).p)) |
---|
539 | { |
---|
540 | /* |
---|
541 | * the polynomial to reduce with is now; |
---|
542 | */ |
---|
543 | pi = strat->T[i].p; |
---|
544 | ei = strat->T[i].ecart; |
---|
545 | } |
---|
546 | } |
---|
547 | |
---|
548 | /* |
---|
549 | * end of search: have to reduce with pi |
---|
550 | */ |
---|
551 | if ((pass!=0) && (ei > (*h).ecart)) |
---|
552 | { |
---|
553 | /* |
---|
554 | * It is not possible to reduce h with smaller ecart; |
---|
555 | * if possible h goes to the lazy-set L,i.e |
---|
556 | * if its position in L would be not the last one |
---|
557 | */ |
---|
558 | if (strat->Ll >= 0) /* L is not empty */ |
---|
559 | { |
---|
560 | at = strat->posInL(strat->L,strat->Ll,*h,strat); |
---|
561 | if(at <= strat->Ll) |
---|
562 | /*- h will not become the next element to reduce -*/ |
---|
563 | { |
---|
564 | enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at); |
---|
565 | if (TEST_OPT_DEBUG) Print(" ecart too big: -> L%d\n",at); |
---|
566 | (*h).p = NULL; |
---|
567 | return; |
---|
568 | } |
---|
569 | } |
---|
570 | if (TEST_OPT_MOREPAIRS) |
---|
571 | { |
---|
572 | /*put the polynomial also in the pair set*/ |
---|
573 | strat->fromT = TRUE; |
---|
574 | if (!TEST_OPT_INTSTRATEGY) pNorm((*h).p); |
---|
575 | enterpairs((*h).p,strat->sl,(*h).ecart,0,strat); |
---|
576 | } |
---|
577 | } |
---|
578 | if (TEST_OPT_DEBUG) |
---|
579 | { |
---|
580 | PrintS("red:"); |
---|
581 | wrp(h->p); |
---|
582 | PrintS(" with "); |
---|
583 | wrp(pi); |
---|
584 | } |
---|
585 | if (strat->fromT) |
---|
586 | { |
---|
587 | strat->fromT=FALSE; |
---|
588 | (*h).p = spSpolyRedNew(pi,(*h).p,strat->kNoether, |
---|
589 | strat->spSpolyLoop); |
---|
590 | } |
---|
591 | else |
---|
592 | (*h).p = spSpolyRed(pi,(*h).p,strat->kNoether, strat->spSpolyLoop); |
---|
593 | if (TEST_OPT_DEBUG) |
---|
594 | { |
---|
595 | PrintS("\nto "); |
---|
596 | wrp(h->p); |
---|
597 | PrintLn(); |
---|
598 | } |
---|
599 | if ((*h).p == NULL) |
---|
600 | { |
---|
601 | if (h->lcm!=NULL) pFree1((*h).lcm); |
---|
602 | #ifdef KDEBUG |
---|
603 | (*h).lcm=NULL; |
---|
604 | #endif |
---|
605 | return; |
---|
606 | } |
---|
607 | /* compute the ecart */ |
---|
608 | if (ei <= (*h).ecart) |
---|
609 | (*h).ecart = d-pFDeg((*h).p); |
---|
610 | else |
---|
611 | (*h).ecart = d-pFDeg((*h).p)+ei-(*h).ecart; |
---|
612 | // if (strat->syzComp) |
---|
613 | // { |
---|
614 | // if ((strat->syzComp>0) && (pMinComp((*h).p) > strat->syzComp)) |
---|
615 | // { |
---|
616 | #ifdef KDEBUG |
---|
617 | // if (TEST_OPT_DEBUG) |
---|
618 | #endif |
---|
619 | // PrintS(" >syzComp\n"); |
---|
620 | // if (TEST_OPT_INTSTRATEGY) pContent(h->p); |
---|
621 | // at=strat->posInT(strat->T,strat->tl,(*h)); |
---|
622 | // enterTBba((*h),at,strat); |
---|
623 | // return; |
---|
624 | // } |
---|
625 | // } |
---|
626 | /* |
---|
627 | * try to reduce the s-polynomial h |
---|
628 | *test first whether h should go to the lazyset L |
---|
629 | *-if the degree jumps |
---|
630 | *-if the number of pre-defined reductions jumps |
---|
631 | */ |
---|
632 | pass++; |
---|
633 | d = pFDeg((*h).p)+(*h).ecart; |
---|
634 | if ((strat->Ll >= 0) && ((d > reddeg) || (pass > strat->LazyPass))) |
---|
635 | { |
---|
636 | at = strat->posInL(strat->L,strat->Ll,*h,strat); |
---|
637 | if (at <= strat->Ll) |
---|
638 | { |
---|
639 | /*test if h is already standardbasis element*/ |
---|
640 | i=strat->sl+1; |
---|
641 | do |
---|
642 | { |
---|
643 | i--; |
---|
644 | if (i<0) |
---|
645 | { |
---|
646 | at=strat->posInT(strat->T,strat->tl,(*h)); |
---|
647 | enterTBba((*h),at,strat); |
---|
648 | return; |
---|
649 | } |
---|
650 | } while (!pDivisibleBy1(strat->S[i],(*h).p)); |
---|
651 | enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at); |
---|
652 | if (TEST_OPT_DEBUG) |
---|
653 | Print(" degree jumped: -> L%d\n",at); |
---|
654 | (*h).p = NULL; |
---|
655 | return; |
---|
656 | } |
---|
657 | } |
---|
658 | else if (TEST_OPT_PROT && (strat->Ll < 0) && (d > reddeg)) |
---|
659 | { |
---|
660 | reddeg = d; |
---|
661 | Print(".%d",d); mflush(); |
---|
662 | } |
---|
663 | j = 0; |
---|
664 | } |
---|
665 | else |
---|
666 | { |
---|
667 | if (j >= strat->tl) |
---|
668 | { |
---|
669 | if (TEST_OPT_INTSTRATEGY) |
---|
670 | { |
---|
671 | //pContent(h->p); |
---|
672 | pCleardenom(h->p);// also does a pContent |
---|
673 | } |
---|
674 | at=strat->posInT(strat->T,strat->tl,(*h)); |
---|
675 | enterTBba((*h),at,strat); |
---|
676 | return; |
---|
677 | } |
---|
678 | j++; |
---|
679 | } |
---|
680 | } |
---|
681 | } |
---|
682 | |
---|
683 | /*2 |
---|
684 | * reduction procedure for tests only |
---|
685 | * reduces with elements from T and chooses the best possible |
---|
686 | */ |
---|
687 | static void redBest (LObject* h,kStrategy strat) |
---|
688 | { |
---|
689 | if (strat->tl<0) |
---|
690 | { |
---|
691 | enterTBba((*h),0,strat); |
---|
692 | return; |
---|
693 | } |
---|
694 | |
---|
695 | int j,jbest,at,reddeg,d,pass; |
---|
696 | poly p,ph; |
---|
697 | pass = j = 0; |
---|
698 | |
---|
699 | if (strat->honey) |
---|
700 | reddeg = pFDeg((*h).p)+(*h).ecart; |
---|
701 | else |
---|
702 | reddeg = pFDeg((*h).p); |
---|
703 | loop |
---|
704 | { |
---|
705 | if (pDivisibleBy(strat->T[j].p,(*h).p)) |
---|
706 | { |
---|
707 | //if (strat->interpt) test_int_std(strat->kIdeal); |
---|
708 | /* compute the s-polynomial */ |
---|
709 | if (!TEST_OPT_INTSTRATEGY) pNorm((*h).p); |
---|
710 | #ifdef SDRING |
---|
711 | // spSpolyShortBba will not work in the SRING case |
---|
712 | if (pSDRING) |
---|
713 | { |
---|
714 | p=spSpolyCreate(strat->T[j].p,(*h).p,strat->kNoether,strat->spSpolyLoop); |
---|
715 | if (p!=NULL) pDelete(&pNext(p)); |
---|
716 | } |
---|
717 | else |
---|
718 | #endif |
---|
719 | p = spSpolyShortBba(strat->T[j].p,(*h).p); |
---|
720 | /* computes only the first monomial of the spoly */ |
---|
721 | if (p) |
---|
722 | { |
---|
723 | jbest = j; |
---|
724 | /* looking for the best possible reduction */ |
---|
725 | if ((strat->syzComp==0) || (pMinComp(p) <= strat->syzComp)) |
---|
726 | { |
---|
727 | loop |
---|
728 | { |
---|
729 | j++; |
---|
730 | if (j > strat->tl) |
---|
731 | break; |
---|
732 | if (pDivisibleBy(strat->T[j].p,(*h).p)) |
---|
733 | { |
---|
734 | #ifdef SDRING |
---|
735 | // spSpolyShortBba will not work in the SRING case |
---|
736 | if (pSDRING) |
---|
737 | { |
---|
738 | ph=spSpolyCreate(strat->T[j].p,(*h).p,strat->kNoether,strat->spSpolyLoop); |
---|
739 | if (ph!=NULL) pDelete(&pNext(ph)); |
---|
740 | } |
---|
741 | else |
---|
742 | #endif |
---|
743 | ph = spSpolyShortBba(strat->T[j].p,(*h).p); |
---|
744 | if (ph==NULL) |
---|
745 | { |
---|
746 | pFree1(p); |
---|
747 | pDelete(&((*h).p)); |
---|
748 | if (h->lcm!=NULL) pFree1((*h).lcm); |
---|
749 | #ifdef KDEBUG |
---|
750 | (*h).lcm=NULL; |
---|
751 | #endif |
---|
752 | return; |
---|
753 | } |
---|
754 | else if (pComp0(ph,p) == -1) |
---|
755 | { |
---|
756 | pFree1(p); |
---|
757 | p = ph; |
---|
758 | jbest = j; |
---|
759 | } |
---|
760 | else |
---|
761 | { |
---|
762 | pFree1(ph); |
---|
763 | } |
---|
764 | } |
---|
765 | } |
---|
766 | } |
---|
767 | pFree1(p); |
---|
768 | (*h).p = spSpolyRed(strat->T[jbest].p,(*h).p,strat->kNoether, |
---|
769 | strat->spSpolyLoop); |
---|
770 | } |
---|
771 | else |
---|
772 | { |
---|
773 | if (h->lcm!=NULL) pFree1((*h).lcm); |
---|
774 | #ifdef KDEBUG |
---|
775 | (*h).lcm=NULL; |
---|
776 | #endif |
---|
777 | (*h).p = NULL; |
---|
778 | return; |
---|
779 | } |
---|
780 | if (strat->honey && pLexOrder) |
---|
781 | strat->initEcart(h); |
---|
782 | /* h.length:=l; */ |
---|
783 | /* try to reduce the s-polynomial */ |
---|
784 | // if (strat->syzComp) |
---|
785 | // { |
---|
786 | // if ((strat->syzComp>0) && (pMinComp((*h).p) > strat->syzComp)) |
---|
787 | // { |
---|
788 | #ifdef KDEBUG |
---|
789 | // if (TEST_OPT_DEBUG) |
---|
790 | #endif |
---|
791 | // PrintS(" >syzComp\n"); |
---|
792 | // if (TEST_OPT_INTSTRATEGY) pContent(h->p); |
---|
793 | // at=strat->posInT(strat->T,strat->tl,(*h)); |
---|
794 | // enterTBba((*h),at,strat); |
---|
795 | // return; |
---|
796 | // } |
---|
797 | // } |
---|
798 | if (strat->honey || pLexOrder) |
---|
799 | { |
---|
800 | pass++; |
---|
801 | d = pFDeg((*h).p); |
---|
802 | if (strat->honey) |
---|
803 | d += (*h).ecart; |
---|
804 | if ((strat->Ll >= 0) && ((pass > strat->LazyPass) || (d > reddeg))) |
---|
805 | { |
---|
806 | at = strat->posInL(strat->L,strat->Ll,*h,strat); |
---|
807 | if (at <= strat->Ll) |
---|
808 | { |
---|
809 | enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at); |
---|
810 | (*h).p = NULL; |
---|
811 | return; |
---|
812 | } |
---|
813 | } |
---|
814 | else if (TEST_OPT_PROT && (strat->Ll < 0) && (d != reddeg)) |
---|
815 | { |
---|
816 | reddeg = d; |
---|
817 | Print("%d."); |
---|
818 | mflush(); |
---|
819 | } |
---|
820 | } |
---|
821 | j = 0; |
---|
822 | } |
---|
823 | else |
---|
824 | { |
---|
825 | if (j >= strat->tl) |
---|
826 | { |
---|
827 | if (TEST_OPT_INTSTRATEGY) |
---|
828 | { |
---|
829 | //pContent(h->p); |
---|
830 | pCleardenom(h->p);// also does a pContent |
---|
831 | } |
---|
832 | at=strat->posInT(strat->T,strat->tl,(*h)); |
---|
833 | enterTBba((*h),at,strat); |
---|
834 | return; |
---|
835 | } |
---|
836 | j++; |
---|
837 | } |
---|
838 | } |
---|
839 | } |
---|
840 | |
---|
841 | /*2 |
---|
842 | * reduction procedure for the normal form |
---|
843 | */ |
---|
844 | |
---|
845 | static poly redNF (poly h,kStrategy strat) |
---|
846 | { |
---|
847 | int j = 0; |
---|
848 | int z = 3; |
---|
849 | |
---|
850 | if (0 > strat->sl) |
---|
851 | { |
---|
852 | return h; |
---|
853 | } |
---|
854 | loop |
---|
855 | { |
---|
856 | if (pDivisibleBy1(strat->S[j],h)) |
---|
857 | { |
---|
858 | //if (strat->interpt) test_int_std(strat->kIdeal); |
---|
859 | /*- compute the s-polynomial -*/ |
---|
860 | if (TEST_OPT_DEBUG) |
---|
861 | { |
---|
862 | PrintS("red:"); |
---|
863 | wrp(h); |
---|
864 | PrintS(" with "); |
---|
865 | wrp(strat->S[j]); |
---|
866 | } |
---|
867 | h = spSpolyRed(strat->S[j],h,strat->kNoether, strat->spSpolyLoop); |
---|
868 | if (TEST_OPT_DEBUG) |
---|
869 | { |
---|
870 | PrintS("\nto:"); |
---|
871 | wrp(h); |
---|
872 | PrintLn(); |
---|
873 | } |
---|
874 | if (h == NULL) return NULL; |
---|
875 | z++; |
---|
876 | if (z>=10) |
---|
877 | { |
---|
878 | z=0; |
---|
879 | pNormalize(h); |
---|
880 | } |
---|
881 | /*- try to reduce the s-polynomial -*/ |
---|
882 | j = 0; |
---|
883 | } |
---|
884 | else |
---|
885 | { |
---|
886 | if (j >= strat->sl) return h; |
---|
887 | j++; |
---|
888 | } |
---|
889 | } |
---|
890 | } |
---|
891 | |
---|
892 | void initBba(ideal F,kStrategy strat) |
---|
893 | { |
---|
894 | int i; |
---|
895 | idhdl h; |
---|
896 | /* setting global variables ------------------- */ |
---|
897 | strat->enterS = enterSBba; |
---|
898 | if ((BTEST1(20)) && (!strat->honey)) |
---|
899 | strat->red = redBest; |
---|
900 | else if (strat->honey) |
---|
901 | strat->red = redHoney; |
---|
902 | else if (pLexOrder && !strat->homog) |
---|
903 | strat->red = redLazy; |
---|
904 | else if (TEST_OPT_INTSTRATEGY && strat->homog) |
---|
905 | strat->red = redHomog0; |
---|
906 | else |
---|
907 | strat->red = redHomog; |
---|
908 | if (TEST_OPT_MINRES && strat->homog && (strat->syzComp >0)) |
---|
909 | strat->red = redSyz; |
---|
910 | |
---|
911 | if (pLexOrder && strat->honey) |
---|
912 | strat->initEcart = initEcartNormal; |
---|
913 | else |
---|
914 | strat->initEcart = initEcartBBA; |
---|
915 | if (strat->honey) |
---|
916 | strat->initEcartPair = initEcartPairMora; |
---|
917 | else |
---|
918 | strat->initEcartPair = initEcartPairBba; |
---|
919 | strat->kIdeal = NULL; |
---|
920 | //if (strat->ak==0) strat->kIdeal->rtyp=IDEAL_CMD; |
---|
921 | //else strat->kIdeal->rtyp=MODUL_CMD; |
---|
922 | //strat->kIdeal->data=(void *)strat->Shdl; |
---|
923 | if ((TEST_OPT_WEIGHTM)&&(F!=NULL)) |
---|
924 | { |
---|
925 | //interred machen Aenderung |
---|
926 | pFDegOld=pFDeg; |
---|
927 | pLDegOld=pLDeg; |
---|
928 | h=ggetid("ecart"); |
---|
929 | if ((h!=NULL) && (IDTYP(h)==INTVEC_CMD)) |
---|
930 | { |
---|
931 | ecartWeights=iv2array(IDINTVEC(h)); |
---|
932 | } |
---|
933 | else |
---|
934 | { |
---|
935 | ecartWeights=(short *)Alloc((pVariables+1)*sizeof(short)); |
---|
936 | /*uses automatic computation of the ecartWeights to set them*/ |
---|
937 | kEcartWeights(F->m,IDELEMS(F)-1,ecartWeights); |
---|
938 | } |
---|
939 | pFDeg=totaldegreeWecart; |
---|
940 | pLDeg=maxdegreeWecart; |
---|
941 | for(i=1; i<=pVariables; i++) |
---|
942 | Print(" %d",ecartWeights[i]); |
---|
943 | PrintLn(); |
---|
944 | mflush(); |
---|
945 | } |
---|
946 | } |
---|
947 | |
---|
948 | #ifdef STDTRACE |
---|
949 | lists bbaLink (ideal F, ideal Q,intvec *w,intvec *hilb,kStrategy strat, stdLink stdTrace) |
---|
950 | { |
---|
951 | int oldLl; |
---|
952 | int srmax,lrmax; |
---|
953 | int olddeg,reduc; |
---|
954 | int anzTupel=0, anzNew = 0, anzSkipped=0; |
---|
955 | #ifdef SDRING |
---|
956 | polyset aug=(polyset)Alloc(setmax*sizeof(poly)); |
---|
957 | int augmax=setmax, augl=-1; |
---|
958 | poly oldLcm=NULL; |
---|
959 | #endif |
---|
960 | int hilbeledeg=1,hilbcount=0,minimcnt=0; |
---|
961 | |
---|
962 | if(stdTrace!=NULL) stdTrace->Start(strat); |
---|
963 | |
---|
964 | initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit*/ |
---|
965 | initHilbCrit(F,Q,&hilb,strat); |
---|
966 | initBba(F,strat); |
---|
967 | initBuchMoraPos(strat); |
---|
968 | /*set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair*/ |
---|
969 | /*Shdl=*/initBuchMora(F, Q,strat); |
---|
970 | if (strat->minim>0) |
---|
971 | { |
---|
972 | strat->M=idInit(IDELEMS(F),F->rank); |
---|
973 | } |
---|
974 | srmax = strat->sl; |
---|
975 | reduc = olddeg = lrmax = 0; |
---|
976 | /* compute------------------------------------------------------- */ |
---|
977 | while ((stdTrace!=NULL && !stdTrace->CheckEnd(strat)) || (stdTrace == NULL && strat->Ll>=0)) |
---|
978 | { |
---|
979 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
980 | if(stdTrace!=NULL && stdTrace->Receive) |
---|
981 | { |
---|
982 | stdTrace->ReceiveMsg(); |
---|
983 | stdTrace->ParseMessage(strat); |
---|
984 | } |
---|
985 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
986 | if((stdTrace!=NULL && stdTrace->Verwaltung) || (stdTrace == NULL)) |
---|
987 | { |
---|
988 | if (strat->Ll > lrmax) lrmax =strat->Ll;/*stat.*/ |
---|
989 | if (TEST_OPT_DEBUG) messageSets(strat); |
---|
990 | //test_int_std(strat->kIdeal); |
---|
991 | if (strat->Ll== 0) strat->interpt=TRUE; |
---|
992 | if (TEST_OPT_DEGBOUND |
---|
993 | && ((strat->honey |
---|
994 | && (strat->L[strat->Ll].ecart+pFDeg(strat->L[strat->Ll].p)>Kstd1_deg)) |
---|
995 | || ((!strat->honey) && (pFDeg(strat->L[strat->Ll].p)>Kstd1_deg)))) |
---|
996 | { |
---|
997 | /* |
---|
998 | *stops computation if |
---|
999 | * 24 IN test and the degree +ecart of L[strat->Ll] is bigger then |
---|
1000 | *a predefined number Kstd1_deg |
---|
1001 | */ |
---|
1002 | while (strat->Ll >= 0) deleteInL(strat->L,&strat->Ll,strat->Ll,strat); |
---|
1003 | break; |
---|
1004 | } |
---|
1005 | } |
---|
1006 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
1007 | if((stdTrace!=NULL && stdTrace->TupelL) || (stdTrace == NULL )) |
---|
1008 | { |
---|
1009 | /* picks the last element from the lazyset L */ |
---|
1010 | strat->P = strat->L[strat->Ll]; |
---|
1011 | anzTupel++; |
---|
1012 | strat->Ll--; |
---|
1013 | if(stdTrace!=NULL && stdTrace->TupelStore) |
---|
1014 | { |
---|
1015 | if (TEST_OPT_PROT) PrintS(":"); |
---|
1016 | stdTrace->Store(strat->P); |
---|
1017 | strat->P.p=NULL; |
---|
1018 | anzSkipped++; |
---|
1019 | } |
---|
1020 | } |
---|
1021 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
1022 | if((stdTrace!=NULL && stdTrace->SPoly) || (stdTrace == NULL)) |
---|
1023 | { |
---|
1024 | kTest(strat); |
---|
1025 | if (pNext(strat->P.p) == strat->tail) |
---|
1026 | { |
---|
1027 | /* deletes the short spoly and computes */ |
---|
1028 | pFree1(strat->P.p); |
---|
1029 | /* the real one */ |
---|
1030 | strat->P.p = spSpolyCreate(strat->P.p1,strat->P.p2,strat->kNoether); |
---|
1031 | } |
---|
1032 | if((strat->P.p1==NULL) && (strat->minim>0)) |
---|
1033 | strat->P.p2=pCopy(strat->P.p); |
---|
1034 | } |
---|
1035 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
1036 | if((stdTrace!=NULL && stdTrace->Reduzieren) || (stdTrace == NULL)) |
---|
1037 | { |
---|
1038 | #ifdef SDRING |
---|
1039 | if (strat->P.p != NULL) |
---|
1040 | #endif |
---|
1041 | { |
---|
1042 | if (strat->honey) |
---|
1043 | { |
---|
1044 | if (TEST_OPT_PROT) |
---|
1045 | message(strat->P.ecart+pFDeg(strat->P.p),&olddeg,&reduc,strat); |
---|
1046 | } |
---|
1047 | else |
---|
1048 | { |
---|
1049 | if (TEST_OPT_PROT) |
---|
1050 | message(pFDeg(strat->P.p),&olddeg,&reduc,strat); |
---|
1051 | } |
---|
1052 | /* reduction of the element choosen from L */ |
---|
1053 | oldLl=strat->Ll; |
---|
1054 | strat->red(&strat->P,strat); |
---|
1055 | if(stdTrace!=NULL && stdTrace->TupelPosition) |
---|
1056 | stdTrace->CheckPosition(strat,oldLl); |
---|
1057 | if((stdTrace!=NULL && stdTrace->TupelMelden)) |
---|
1058 | stdTrace->SendTupel(strat); |
---|
1059 | if(stdTrace!=NULL && strat->P.p!=NULL && stdTrace->Modus==ModCheck) |
---|
1060 | anzNew++; |
---|
1061 | } |
---|
1062 | if (strat->P.p != NULL) |
---|
1063 | { |
---|
1064 | #ifdef SDRING |
---|
1065 | aug[0]=strat->P.p; |
---|
1066 | augl=0; |
---|
1067 | if (pSDRING) |
---|
1068 | { |
---|
1069 | oldLcm=strat->P.lcm; |
---|
1070 | #ifdef SRING |
---|
1071 | if (pSRING) psAug(pCopy(strat->P.p),pOne(),&aug,&augl,&augmax); |
---|
1072 | #endif |
---|
1073 | #ifdef DRING |
---|
1074 | if (pDRING) pdAug(pCopy(strat->P.p),&aug,&augl,&augmax); |
---|
1075 | #endif |
---|
1076 | #ifdef KDEBUG |
---|
1077 | if (TEST_OPT_DEBUG) |
---|
1078 | { |
---|
1079 | PrintS(" aug of "); |
---|
1080 | wrp(aug[0]); |
---|
1081 | PrintLn(); |
---|
1082 | int iiaug=augl; |
---|
1083 | while (iiaug>=0) |
---|
1084 | { |
---|
1085 | Print(" to %d:",iiaug); |
---|
1086 | wrp(aug[iiaug]); |
---|
1087 | PrintLn(); |
---|
1088 | iiaug--; |
---|
1089 | } |
---|
1090 | } |
---|
1091 | #endif |
---|
1092 | } |
---|
1093 | for (augl++;augl != 0;) |
---|
1094 | { |
---|
1095 | strat->P.p=aug[--augl]; |
---|
1096 | aug[augl]=NULL; |
---|
1097 | if (pSDRING) |
---|
1098 | { |
---|
1099 | if (oldLcm==NULL) strat->P.lcm=NULL; |
---|
1100 | else strat->P.lcm=pCopy1(oldLcm); |
---|
1101 | } |
---|
1102 | if ((augl!=0)&&(strat->P.p!=NULL)) |
---|
1103 | strat->red(&strat->P,strat); |
---|
1104 | if (strat->P.p != NULL) |
---|
1105 | { |
---|
1106 | #endif |
---|
1107 | /* statistic */ |
---|
1108 | if (TEST_OPT_PROT) PrintS("s"); |
---|
1109 | /* enter P.p into s and L */ |
---|
1110 | { |
---|
1111 | int pos=posInS(strat->S,strat->sl,strat->P.p); |
---|
1112 | #ifdef SDRING |
---|
1113 | if ((pSDRING) |
---|
1114 | && (pos<=strat->sl) |
---|
1115 | && (pComparePolys(strat->P.p,strat->S[pos]))) |
---|
1116 | { |
---|
1117 | if (TEST_OPT_PROT) |
---|
1118 | PrintS("d"); |
---|
1119 | } |
---|
1120 | else |
---|
1121 | #endif |
---|
1122 | { |
---|
1123 | if (TEST_OPT_INTSTRATEGY) |
---|
1124 | { |
---|
1125 | if ((!TEST_OPT_MINRES)||(strat->syzComp==0)||(!strat->homog)) |
---|
1126 | { |
---|
1127 | strat->P.p = redtailBba(strat->P.p,pos-1,strat); |
---|
1128 | //if (strat->redTailChange) |
---|
1129 | pCleardenom(strat->P.p); |
---|
1130 | } |
---|
1131 | } |
---|
1132 | else |
---|
1133 | { |
---|
1134 | pNorm(strat->P.p); |
---|
1135 | if ((!TEST_OPT_MINRES)||(strat->syzComp==0)||(!strat->homog)) |
---|
1136 | { |
---|
1137 | strat->P.p = redtailBba(strat->P.p,pos-1,strat); |
---|
1138 | } |
---|
1139 | } |
---|
1140 | if (TEST_OPT_DEBUG) |
---|
1141 | { |
---|
1142 | PrintS("new s:"); |
---|
1143 | wrp(strat->P.p); |
---|
1144 | PrintLn(); |
---|
1145 | } |
---|
1146 | if((strat->P.p1==NULL) && (strat->minim>0)) |
---|
1147 | { |
---|
1148 | if (strat->minim==1) |
---|
1149 | { |
---|
1150 | strat->M->m[minimcnt]=pCopy(strat->P.p); |
---|
1151 | pDelete(&strat->P.p2); |
---|
1152 | } |
---|
1153 | else |
---|
1154 | { |
---|
1155 | strat->M->m[minimcnt]=strat->P.p2; |
---|
1156 | strat->P.p2=NULL; |
---|
1157 | } |
---|
1158 | minimcnt++; |
---|
1159 | } |
---|
1160 | enterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat); |
---|
1161 | if (strat->sl==-1) pos=0; |
---|
1162 | else pos=posInS(strat->S,strat->sl,strat->P.p); |
---|
1163 | strat->enterS(strat->P,pos,strat); |
---|
1164 | } |
---|
1165 | if (hilb!=NULL) |
---|
1166 | { // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
---|
1167 | oldLl=strat->Ll; |
---|
1168 | khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat); |
---|
1169 | if(stdTrace!=NULL) |
---|
1170 | stdTrace->CheckHilb(strat,oldLl); |
---|
1171 | } |
---|
1172 | } |
---|
1173 | if (strat->P.lcm!=NULL) pFree1(strat->P.lcm); |
---|
1174 | #ifdef SDRING |
---|
1175 | } |
---|
1176 | } |
---|
1177 | /* delete the old pair */ |
---|
1178 | if (pSDRING &&(oldLcm!=NULL)) pFree1(oldLcm); |
---|
1179 | #endif |
---|
1180 | if (strat->sl>srmax) srmax = strat->sl; |
---|
1181 | } |
---|
1182 | if(stdTrace!=NULL && stdTrace->TupelTesten) |
---|
1183 | stdTrace->TupelDifferent(strat); |
---|
1184 | } |
---|
1185 | #ifdef KDEBUG |
---|
1186 | strat->P.lcm=NULL; |
---|
1187 | #endif |
---|
1188 | kTest(strat); |
---|
1189 | } |
---|
1190 | if(stdTrace !=NULL) |
---|
1191 | { |
---|
1192 | if(TEST_OPT_PROT) |
---|
1193 | { |
---|
1194 | Print("\n(Tupel Skipped New) = (%i %i %i)\n",anzTupel, anzSkipped, anzNew); |
---|
1195 | } |
---|
1196 | } |
---|
1197 | if((stdTrace!=NULL && stdTrace->ResultSend) || (stdTrace == NULL)) |
---|
1198 | { |
---|
1199 | if (TEST_OPT_DEBUG) messageSets(strat); |
---|
1200 | /* complete reduction of the standard basis--------- */ |
---|
1201 | if (TEST_OPT_REDSB) completeReduce(strat); |
---|
1202 | /* release temp data-------------------------------- */ |
---|
1203 | exitBuchMora(strat); |
---|
1204 | if (TEST_OPT_WEIGHTM) |
---|
1205 | { |
---|
1206 | pFDeg=pFDegOld; |
---|
1207 | pLDeg=pLDegOld; |
---|
1208 | if (ecartWeights) |
---|
1209 | { |
---|
1210 | Free((ADDRESS)ecartWeights,(pVariables+1)*sizeof(short)); |
---|
1211 | ecartWeights=NULL; |
---|
1212 | } |
---|
1213 | } |
---|
1214 | #ifdef SDRING |
---|
1215 | Free((ADDRESS)aug,augmax*sizeof(poly)); |
---|
1216 | #endif |
---|
1217 | if (TEST_OPT_PROT) messageStat(srmax,lrmax,hilbcount,strat); |
---|
1218 | if (Q!=NULL) updateResult(strat->Shdl,Q,strat); |
---|
1219 | } |
---|
1220 | if(stdTrace!=NULL) |
---|
1221 | stdTrace->End(strat); |
---|
1222 | lists l=(lists)Alloc(sizeof(slists)); |
---|
1223 | l->Init(2); |
---|
1224 | l->m[0].rtyp = IDEAL_CMD; |
---|
1225 | l->m[0].data = (void *) strat->Shdl; |
---|
1226 | if(stdTrace!=NULL) |
---|
1227 | { |
---|
1228 | l->m[1].rtyp = LIST_CMD; |
---|
1229 | l->m[1].data = (void *)stdTrace->RestTupel(); |
---|
1230 | } |
---|
1231 | return (l); |
---|
1232 | } |
---|
1233 | |
---|
1234 | #else |
---|
1235 | |
---|
1236 | ideal bba (ideal F, ideal Q,intvec *w,intvec *hilb,kStrategy strat) |
---|
1237 | { |
---|
1238 | int srmax,lrmax; |
---|
1239 | int olddeg,reduc; |
---|
1240 | #ifdef SDRING |
---|
1241 | polyset aug=(polyset)Alloc(setmax*sizeof(poly)); |
---|
1242 | int augmax=setmax, augl=-1; |
---|
1243 | poly oldLcm=NULL; |
---|
1244 | #endif |
---|
1245 | int hilbeledeg=1,hilbcount=0,minimcnt=0; |
---|
1246 | |
---|
1247 | initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit*/ |
---|
1248 | initHilbCrit(F,Q,&hilb,strat); |
---|
1249 | initBba(F,strat); |
---|
1250 | initBuchMoraPos(strat); |
---|
1251 | /*set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair*/ |
---|
1252 | /*Shdl=*/initBuchMora(F, Q,strat); |
---|
1253 | if (strat->minim>0) |
---|
1254 | { |
---|
1255 | strat->M=idInit(IDELEMS(F),F->rank); |
---|
1256 | } |
---|
1257 | srmax = strat->sl; |
---|
1258 | reduc = olddeg = lrmax = 0; |
---|
1259 | /* compute------------------------------------------------------- */ |
---|
1260 | while (strat->Ll >= 0) |
---|
1261 | { |
---|
1262 | if (strat->Ll > lrmax) lrmax =strat->Ll;/*stat.*/ |
---|
1263 | if (TEST_OPT_DEBUG) messageSets(strat); |
---|
1264 | //test_int_std(strat->kIdeal); |
---|
1265 | if (strat->Ll== 0) strat->interpt=TRUE; |
---|
1266 | if (TEST_OPT_DEGBOUND |
---|
1267 | && ((strat->honey && (strat->L[strat->Ll].ecart+pFDeg(strat->L[strat->Ll].p)>Kstd1_deg)) |
---|
1268 | || ((!strat->honey) && (pFDeg(strat->L[strat->Ll].p)>Kstd1_deg)))) |
---|
1269 | { |
---|
1270 | /* |
---|
1271 | *stops computation if |
---|
1272 | * 24 IN test and the degree +ecart of L[strat->Ll] is bigger then |
---|
1273 | *a predefined number Kstd1_deg |
---|
1274 | */ |
---|
1275 | while (strat->Ll >= 0) deleteInL(strat->L,&strat->Ll,strat->Ll,strat); |
---|
1276 | break; |
---|
1277 | } |
---|
1278 | /* picks the last element from the lazyset L */ |
---|
1279 | strat->P = strat->L[strat->Ll]; |
---|
1280 | strat->Ll--; |
---|
1281 | kTest(strat); |
---|
1282 | if (pNext(strat->P.p) == strat->tail) |
---|
1283 | { |
---|
1284 | /* deletes the short spoly and computes */ |
---|
1285 | pFree1(strat->P.p); |
---|
1286 | /* the real one */ |
---|
1287 | strat->P.p = spSpolyCreate(strat->P.p1, |
---|
1288 | strat->P.p2, |
---|
1289 | strat->kNoether, |
---|
1290 | strat->spSpolyLoop); |
---|
1291 | } |
---|
1292 | kTest(strat); |
---|
1293 | if((strat->P.p1==NULL) && (strat->minim>0)) |
---|
1294 | strat->P.p2=pCopy(strat->P.p); |
---|
1295 | #ifdef SDRING |
---|
1296 | if (strat->P.p != NULL) |
---|
1297 | #endif |
---|
1298 | { |
---|
1299 | if (strat->honey) |
---|
1300 | { |
---|
1301 | if (TEST_OPT_PROT) message(strat->P.ecart+pFDeg(strat->P.p),&olddeg,&reduc,strat); |
---|
1302 | } |
---|
1303 | else |
---|
1304 | { |
---|
1305 | if (TEST_OPT_PROT) message(pFDeg(strat->P.p),&olddeg,&reduc,strat); |
---|
1306 | } |
---|
1307 | kTest(strat); |
---|
1308 | /* reduction of the element choosen from L */ |
---|
1309 | strat->red(&strat->P,strat); |
---|
1310 | pTest(strat->P.p); |
---|
1311 | } |
---|
1312 | kTest(strat); |
---|
1313 | if (strat->P.p != NULL) |
---|
1314 | { |
---|
1315 | #ifdef SDRING |
---|
1316 | aug[0]=strat->P.p; |
---|
1317 | augl=0; |
---|
1318 | if (pSDRING) |
---|
1319 | { |
---|
1320 | oldLcm=strat->P.lcm; |
---|
1321 | #ifdef SRING |
---|
1322 | if (pSRING) psAug(pCopy(strat->P.p),pOne(),&aug,&augl,&augmax); |
---|
1323 | #endif |
---|
1324 | #ifdef DRING |
---|
1325 | if (pDRING) pdAug(pCopy(strat->P.p),&aug,&augl,&augmax); |
---|
1326 | #endif |
---|
1327 | #ifdef KDEBUG |
---|
1328 | if (TEST_OPT_DEBUG) |
---|
1329 | { |
---|
1330 | PrintS(" aug of "); |
---|
1331 | wrp(aug[0]); |
---|
1332 | PrintLn(); |
---|
1333 | int iiaug=augl; |
---|
1334 | while (iiaug>=0) |
---|
1335 | { |
---|
1336 | Print(" to %d:",iiaug); |
---|
1337 | wrp(aug[iiaug]); |
---|
1338 | PrintLn(); |
---|
1339 | iiaug--; |
---|
1340 | } |
---|
1341 | } |
---|
1342 | #endif |
---|
1343 | } |
---|
1344 | for (augl++;augl != 0;) |
---|
1345 | { |
---|
1346 | strat->P.p=aug[--augl]; |
---|
1347 | aug[augl]=NULL; |
---|
1348 | if (pSDRING) |
---|
1349 | { |
---|
1350 | if (oldLcm==NULL) strat->P.lcm=NULL; |
---|
1351 | else strat->P.lcm=pCopy1(oldLcm); |
---|
1352 | } |
---|
1353 | if ((augl!=0)&&(strat->P.p!=NULL)) |
---|
1354 | strat->red(&strat->P,strat); |
---|
1355 | if (strat->P.p != NULL) |
---|
1356 | { |
---|
1357 | #endif |
---|
1358 | /* statistic */ |
---|
1359 | if (TEST_OPT_PROT) PrintS("s"); |
---|
1360 | /* enter P.p into s and L */ |
---|
1361 | { |
---|
1362 | int pos=posInS(strat->S,strat->sl,strat->P.p); |
---|
1363 | #ifdef SDRING |
---|
1364 | if ((pSDRING) && (pos<=strat->sl)&& (pComparePolys(strat->P.p,strat->S[pos]))) |
---|
1365 | { |
---|
1366 | if (TEST_OPT_PROT) |
---|
1367 | PrintS("d"); |
---|
1368 | } |
---|
1369 | else |
---|
1370 | #endif |
---|
1371 | { |
---|
1372 | if (TEST_OPT_INTSTRATEGY) |
---|
1373 | { |
---|
1374 | if ((!TEST_OPT_MINRES)||(strat->syzComp==0)||(!strat->homog)) |
---|
1375 | { |
---|
1376 | strat->P.p = redtailBba(strat->P.p,pos-1,strat); |
---|
1377 | //if (strat->redTailChange) |
---|
1378 | pCleardenom(strat->P.p); |
---|
1379 | } |
---|
1380 | } |
---|
1381 | else |
---|
1382 | { |
---|
1383 | pNorm(strat->P.p); |
---|
1384 | if ((!TEST_OPT_MINRES)||(strat->syzComp==0)||(!strat->homog)) |
---|
1385 | { |
---|
1386 | strat->P.p = redtailBba(strat->P.p,pos-1,strat); |
---|
1387 | } |
---|
1388 | } |
---|
1389 | if (TEST_OPT_DEBUG) |
---|
1390 | { |
---|
1391 | PrintS("new s:"); |
---|
1392 | wrp(strat->P.p); |
---|
1393 | PrintLn(); |
---|
1394 | } |
---|
1395 | if((strat->P.p1==NULL) && (strat->minim>0)) |
---|
1396 | { |
---|
1397 | if (strat->minim==1) |
---|
1398 | { |
---|
1399 | strat->M->m[minimcnt]=pCopy(strat->P.p); |
---|
1400 | pDelete(&strat->P.p2); |
---|
1401 | } |
---|
1402 | else |
---|
1403 | { |
---|
1404 | strat->M->m[minimcnt]=strat->P.p2; |
---|
1405 | strat->P.p2=NULL; |
---|
1406 | } |
---|
1407 | minimcnt++; |
---|
1408 | } |
---|
1409 | enterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat); |
---|
1410 | if (strat->sl==-1) pos=0; |
---|
1411 | else pos=posInS(strat->S,strat->sl,strat->P.p); |
---|
1412 | strat->enterS(strat->P,pos,strat); |
---|
1413 | } |
---|
1414 | if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat); |
---|
1415 | } |
---|
1416 | if (strat->P.lcm!=NULL) pFree1(strat->P.lcm); |
---|
1417 | #ifdef SDRING |
---|
1418 | } |
---|
1419 | } |
---|
1420 | /* delete the old pair */ |
---|
1421 | if (pSDRING &&(oldLcm!=NULL)) pFree1(oldLcm); |
---|
1422 | #endif |
---|
1423 | if (strat->sl>srmax) srmax = strat->sl; |
---|
1424 | } |
---|
1425 | #ifdef KDEBUG |
---|
1426 | strat->P.lcm=NULL; |
---|
1427 | #endif |
---|
1428 | kTest(strat); |
---|
1429 | } |
---|
1430 | if (TEST_OPT_DEBUG) messageSets(strat); |
---|
1431 | /* complete reduction of the standard basis--------- */ |
---|
1432 | if (TEST_OPT_REDSB) completeReduce(strat); |
---|
1433 | /* release temp data-------------------------------- */ |
---|
1434 | exitBuchMora(strat); |
---|
1435 | if (TEST_OPT_WEIGHTM) |
---|
1436 | { |
---|
1437 | pFDeg=pFDegOld; |
---|
1438 | pLDeg=pLDegOld; |
---|
1439 | if (ecartWeights) |
---|
1440 | { |
---|
1441 | Free((ADDRESS)ecartWeights,(pVariables+1)*sizeof(short)); |
---|
1442 | ecartWeights=NULL; |
---|
1443 | } |
---|
1444 | } |
---|
1445 | #ifdef SDRING |
---|
1446 | Free((ADDRESS)aug,augmax*sizeof(poly)); |
---|
1447 | #endif |
---|
1448 | if (TEST_OPT_PROT) messageStat(srmax,lrmax,hilbcount,strat); |
---|
1449 | if (Q!=NULL) updateResult(strat->Shdl,Q,strat); |
---|
1450 | return (strat->Shdl); |
---|
1451 | } |
---|
1452 | #endif |
---|
1453 | |
---|
1454 | poly kNF2 (ideal F,ideal Q,poly q,kStrategy strat, int lazyReduce) |
---|
1455 | { |
---|
1456 | poly p; |
---|
1457 | int i; |
---|
1458 | |
---|
1459 | if ((idIs0(F))&&(Q==NULL)) |
---|
1460 | return pCopy(q); /*F=0*/ |
---|
1461 | strat->ak = idRankFreeModule(F); |
---|
1462 | /*- creating temp data structures------------------- -*/ |
---|
1463 | BITSET save_test=test; |
---|
1464 | test|=Sy_bit(OPT_REDTAIL); |
---|
1465 | initBuchMoraCrit(strat); |
---|
1466 | strat->initEcart = initEcartBBA; |
---|
1467 | strat->enterS = enterSBba; |
---|
1468 | /*- set S -*/ |
---|
1469 | strat->sl = -1; |
---|
1470 | strat->spSpolyLoop = spGetSpolyLoop(currRing, max(strat->ak, pMaxComp(q)), |
---|
1471 | strat->syzComp, FALSE); |
---|
1472 | /*- init local data struct.---------------------------------------- -*/ |
---|
1473 | /*Shdl=*/initS(F,Q,strat); |
---|
1474 | /*- compute------------------------------------------------------- -*/ |
---|
1475 | if ((TEST_OPT_INTSTRATEGY)&&(lazyReduce==0)) |
---|
1476 | { |
---|
1477 | for (i=strat->sl;i>=0;i--) |
---|
1478 | pNorm(strat->S[i]); |
---|
1479 | } |
---|
1480 | kTest(strat); |
---|
1481 | p = redNF(pCopy(q),strat); |
---|
1482 | kTest(strat); |
---|
1483 | if ((p!=NULL)&&(lazyReduce==0)) |
---|
1484 | { |
---|
1485 | p = redtailBba(p,strat->sl,strat); |
---|
1486 | } |
---|
1487 | kTest(strat); |
---|
1488 | /*- release temp data------------------------------- -*/ |
---|
1489 | Free((ADDRESS)strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int)); |
---|
1490 | idDelete(&strat->Shdl); |
---|
1491 | test=save_test; |
---|
1492 | return p; |
---|
1493 | } |
---|
1494 | |
---|
1495 | ideal kNF2 (ideal F,ideal Q,ideal q,kStrategy strat, int lazyReduce) |
---|
1496 | { |
---|
1497 | poly p; |
---|
1498 | int i; |
---|
1499 | ideal res; |
---|
1500 | |
---|
1501 | if (idIs0(q)) |
---|
1502 | return idInit(1,q->rank); |
---|
1503 | if ((idIs0(F))&&(Q==NULL)) |
---|
1504 | return idCopy(q); /*F=0*/ |
---|
1505 | strat->ak = idRankFreeModule(F); |
---|
1506 | /*- creating temp data structures------------------- -*/ |
---|
1507 | BITSET save_test=test; |
---|
1508 | test|=Sy_bit(OPT_REDTAIL); |
---|
1509 | initBuchMoraCrit(strat); |
---|
1510 | strat->initEcart = initEcartBBA; |
---|
1511 | strat->enterS = enterSBba; |
---|
1512 | /*- set S -*/ |
---|
1513 | strat->sl = -1; |
---|
1514 | strat->spSpolyLoop = spGetSpolyLoop(currRing, |
---|
1515 | max(strat->ak, idRankFreeModule(q)), |
---|
1516 | strat->syzComp, FALSE); |
---|
1517 | /*- init local data struct.---------------------------------------- -*/ |
---|
1518 | /*Shdl=*/initS(F,Q,strat); |
---|
1519 | /*- compute------------------------------------------------------- -*/ |
---|
1520 | res=idInit(IDELEMS(q),q->rank); |
---|
1521 | if ((TEST_OPT_INTSTRATEGY)&&(lazyReduce==0)) |
---|
1522 | { |
---|
1523 | for (i=strat->sl;i>=0;i--) |
---|
1524 | pNorm(strat->S[i]); |
---|
1525 | } |
---|
1526 | for (i=IDELEMS(q)-1; i>=0; i--) |
---|
1527 | { |
---|
1528 | if (q->m[i]!=NULL) |
---|
1529 | { |
---|
1530 | p = redNF(pCopy(q->m[i]),strat); |
---|
1531 | if ((p!=NULL)&&(lazyReduce==0)) |
---|
1532 | { |
---|
1533 | p = redtailBba(p,strat->sl,strat); |
---|
1534 | } |
---|
1535 | res->m[i]=p; |
---|
1536 | } |
---|
1537 | //else |
---|
1538 | // res->m[i]=NULL; |
---|
1539 | if (TEST_OPT_PROT) |
---|
1540 | { |
---|
1541 | PrintS("-");mflush(); |
---|
1542 | } |
---|
1543 | } |
---|
1544 | /*- release temp data------------------------------- -*/ |
---|
1545 | Free((ADDRESS)strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int)); |
---|
1546 | idDelete(&strat->Shdl); |
---|
1547 | test=save_test; |
---|
1548 | return res; |
---|
1549 | } |
---|
1550 | |
---|
1551 | static ideal bbared (ideal F, ideal Q,kStrategy strat) |
---|
1552 | { |
---|
1553 | |
---|
1554 | /* complete reduction of the standard basis--------- */ |
---|
1555 | completeReduce(strat); |
---|
1556 | /* release temp data-------------------------------- */ |
---|
1557 | exitBuchMora(strat); |
---|
1558 | if (TEST_OPT_WEIGHTM) |
---|
1559 | { |
---|
1560 | pFDeg=pFDegOld; |
---|
1561 | pLDeg=pLDegOld; |
---|
1562 | if (ecartWeights) |
---|
1563 | { |
---|
1564 | Free((ADDRESS)ecartWeights,(pVariables+1)*sizeof(short)); |
---|
1565 | ecartWeights=NULL; |
---|
1566 | } |
---|
1567 | } |
---|
1568 | if (Q!=NULL) updateResult(strat->Shdl,Q,strat); |
---|
1569 | return (strat->Shdl); |
---|
1570 | } |
---|
1571 | |
---|
1572 | ideal stdred(ideal F, ideal Q, tHomog h,intvec ** w) |
---|
1573 | { |
---|
1574 | ideal r; |
---|
1575 | BOOLEAN b=pLexOrder,toReset=FALSE; |
---|
1576 | BOOLEAN delete_w=(w==NULL); |
---|
1577 | kStrategy strat=(kStrategy)Alloc0(sizeof(skStrategy)); |
---|
1578 | |
---|
1579 | if (rField_has_simple_inverse()) |
---|
1580 | strat->LazyPass=20; |
---|
1581 | else |
---|
1582 | strat->LazyPass=2; |
---|
1583 | strat->LazyDegree = 1; |
---|
1584 | strat->ak = idRankFreeModule(F); |
---|
1585 | if ((h==testHomog)) |
---|
1586 | { |
---|
1587 | if (strat->ak==0) |
---|
1588 | { |
---|
1589 | h = (tHomog)idHomIdeal(F,Q); |
---|
1590 | w=NULL; |
---|
1591 | } |
---|
1592 | else |
---|
1593 | h = (tHomog)idHomModule(F,Q,w); |
---|
1594 | } |
---|
1595 | if (h==isHomog) |
---|
1596 | { |
---|
1597 | if ((w!=NULL) && (*w!=NULL)) |
---|
1598 | { |
---|
1599 | kModW = *w; |
---|
1600 | strat->kModW = *w; |
---|
1601 | pOldFDeg = pFDeg; |
---|
1602 | pFDeg = kModDeg; |
---|
1603 | toReset = TRUE; |
---|
1604 | } |
---|
1605 | pLexOrder = TRUE; |
---|
1606 | strat->LazyPass*=2; |
---|
1607 | } |
---|
1608 | strat->homog=h; |
---|
1609 | spSet(currRing); |
---|
1610 | strat->spSpolyLoop = spGetSpolyLoop(currRing, strat); |
---|
1611 | initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit*/ |
---|
1612 | initBuchMoraPos(strat); |
---|
1613 | if (pOrdSgn==1) |
---|
1614 | initBba(F,strat); |
---|
1615 | else |
---|
1616 | initMora(F,strat); |
---|
1617 | initBuchMora(F, Q,strat); |
---|
1618 | //initS(F,Q,strat); |
---|
1619 | // Ende der Initalisierung |
---|
1620 | r=bbared(F,Q,strat); |
---|
1621 | #ifdef KDEBUG |
---|
1622 | int i; |
---|
1623 | for (i=0; i<IDELEMS(r); i++) pTest(r->m[i]); |
---|
1624 | #endif |
---|
1625 | // Ende: aufraeumen |
---|
1626 | if (toReset) |
---|
1627 | { |
---|
1628 | kModW = NULL; |
---|
1629 | pFDeg = pOldFDeg; |
---|
1630 | } |
---|
1631 | pLexOrder = b; |
---|
1632 | Free((ADDRESS)strat,sizeof(skStrategy)); |
---|
1633 | if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w; |
---|
1634 | idSkipZeroes(r); |
---|
1635 | return r; |
---|
1636 | } |
---|