| 589 | } |
| 590 | |
| 591 | int ksReducePolyBound(LObject* PR, |
| 592 | TObject* PW, |
| 593 | int /*bound*/, |
| 594 | poly spNoether, |
| 595 | number *coef, |
| 596 | kStrategy strat) |
| 597 | { |
| 598 | #ifdef KDEBUG |
| 599 | red_count++; |
| 600 | #ifdef TEST_OPT_DEBUG_RED |
| 601 | if (TEST_OPT_DEBUG) |
| 602 | { |
| 603 | Print("Red %d:", red_count); PR->wrp(); Print(" with:"); |
| 604 | PW->wrp(); |
| 605 | //printf("\necart(PR)-ecart(PW): %i\n",PR->ecart-PW->ecart); |
| 606 | //pWrite(PR->p); |
| 607 | } |
| 608 | #endif |
| 609 | #endif |
| 610 | int ret = 0; |
| 611 | ring tailRing = PR->tailRing; |
| 612 | if (strat!=NULL) |
| 613 | { |
| 614 | kTest_L(PR,strat); |
| 615 | kTest_T(PW,strat); |
| 616 | } |
| 617 | |
| 618 | poly p1 = PR->GetLmTailRing(); // p2 | p1 |
| 619 | poly p2 = PW->GetLmTailRing(); // i.e. will reduce p1 with p2; lm = LT(p1) / LM(p2) |
| 620 | poly t2 = pNext(p2), lm = p1; // t2 = p2 - LT(p2); really compute P = LC(p2)*p1 - LT(p1)/LM(p2)*p2 |
| 621 | assume(p1 != NULL && p2 != NULL);// Attention, we have rings and there LC(p2) and LC(p1) are special |
| 622 | p_CheckPolyRing(p1, tailRing); |
| 623 | p_CheckPolyRing(p2, tailRing); |
| 624 | |
| 625 | pAssume1(p2 != NULL && p1 != NULL && |
| 626 | p_DivisibleBy(p2, p1, tailRing)); |
| 627 | |
| 628 | pAssume1(p_GetComp(p1, tailRing) == p_GetComp(p2, tailRing) || |
| 629 | (p_GetComp(p2, tailRing) == 0 && |
| 630 | p_MaxComp(pNext(p2),tailRing) == 0)); |
| 631 | |
| 632 | #ifdef HAVE_PLURAL |
| 633 | if (rIsPluralRing(currRing)) |
| 634 | { |
| 635 | // for the time being: we know currRing==strat->tailRing |
| 636 | // no exp-bound checking needed |
| 637 | // (only needed if exp-bound(tailring)<exp-b(currRing)) |
| 638 | if (PR->bucket!=NULL) nc_kBucketPolyRed_Z(PR->bucket, p2,coef,FALSE); |
| 639 | else |
| 640 | { |
| 641 | poly _p = (PR->t_p != NULL ? PR->t_p : PR->p); |
| 642 | assume(_p != NULL); |
| 643 | nc_PolyPolyRed(_p, p2,coef, currRing); |
| 644 | if (PR->t_p!=NULL) PR->t_p=_p; else PR->p=_p; |
| 645 | PR->pLength=0; // usually not used, GetpLength re-computes it if needed |
| 646 | } |
| 647 | return 0; |
| 648 | } |
no test coverage detected