| 2496 | */ |
| 2497 | |
| 2498 | poly redNFBound (poly h,int &max_ind,int nonorm,kStrategy strat,int bound) |
| 2499 | { |
| 2500 | h = pJet(h,bound); |
| 2501 | if (h==NULL) return NULL; |
| 2502 | int j; |
| 2503 | max_ind=strat->sl; |
| 2504 | |
| 2505 | if (0 > strat->sl) |
| 2506 | { |
| 2507 | return h; |
| 2508 | } |
| 2509 | LObject P(h); |
| 2510 | P.SetShortExpVector(); |
| 2511 | P.bucket = kBucketCreate(currRing); |
| 2512 | kBucketInit(P.bucket,P.p,pLength(P.p)); |
| 2513 | kbTest(P.bucket); |
| 2514 | BOOLEAN is_ring = rField_is_Ring(currRing); |
| 2515 | |
| 2516 | loop |
| 2517 | { |
| 2518 | j=kFindDivisibleByInS(strat,&max_ind,&P); |
| 2519 | if (j>=0) |
| 2520 | { |
| 2521 | if (!is_ring) |
| 2522 | { |
| 2523 | int sl=pSize(strat->S[j]); |
| 2524 | int jj=j; |
| 2525 | loop |
| 2526 | { |
| 2527 | int sll; |
| 2528 | jj=kFindNextDivisibleByInS(strat,jj+1,max_ind,&P); |
| 2529 | if (jj<0) break; |
| 2530 | sll=pSize(strat->S[jj]); |
| 2531 | if (sll<sl) |
| 2532 | { |
| 2533 | #ifdef KDEBUG |
| 2534 | if (TEST_OPT_DEBUG) Print("better(S%d:%d -> S%d:%d)\n",j,sl,jj,sll); |
| 2535 | #endif |
| 2536 | //else if (TEST_OPT_PROT) { PrintS("b"); mflush(); } |
| 2537 | j=jj; |
| 2538 | sl=sll; |
| 2539 | } |
| 2540 | } |
| 2541 | if ((nonorm==0) && (!nIsOne(pGetCoeff(strat->S[j])))) |
| 2542 | { |
| 2543 | pNorm(strat->S[j]); |
| 2544 | //if (TEST_OPT_PROT) { PrintS("n"); mflush(); } |
| 2545 | } |
| 2546 | } |
| 2547 | nNormalize(pGetCoeff(P.p)); |
| 2548 | #ifdef KDEBUG |
| 2549 | if (TEST_OPT_DEBUG) |
| 2550 | { |
| 2551 | PrintS("red:"); |
| 2552 | wrp(h); |
| 2553 | PrintS(" with "); |
| 2554 | wrp(strat->S[j]); |
| 2555 | } |
no test coverage detected