| 581 | } |
| 582 | |
| 583 | InternalCF* |
| 584 | InternalPoly::tryDivsame( InternalCF* aCoeff, const CanonicalForm& M, bool& fail ) |
| 585 | { |
| 586 | if ( inExtension() && !getReduce( var ) ) |
| 587 | { |
| 588 | InternalCF * dummy = aCoeff->tryInvert(M, fail); |
| 589 | if (fail) |
| 590 | return CFFactory::basic( 0 ); |
| 591 | if (is_imm(dummy)) dummy=this->tryMulsame(dummy, M); |
| 592 | else dummy = dummy->tryMulsame( this, M); |
| 593 | if (fail) |
| 594 | { |
| 595 | if (getRefCount() <= 1) |
| 596 | delete this; |
| 597 | else |
| 598 | decRefCount(); |
| 599 | return dummy; |
| 600 | } |
| 601 | if ( getRefCount() <= 1 ) |
| 602 | { |
| 603 | delete this; |
| 604 | return dummy; |
| 605 | } |
| 606 | else |
| 607 | { |
| 608 | decRefCount(); |
| 609 | return dummy; |
| 610 | } |
| 611 | } |
| 612 | InternalPoly *aPoly = (InternalPoly*)aCoeff; |
| 613 | termList dummy, first, last, resultfirst = 0, resultlast = 0; |
| 614 | CanonicalForm coeff, newcoeff; |
| 615 | int exp, newexp; |
| 616 | bool singleObject; |
| 617 | |
| 618 | if ( getRefCount() <= 1 ) |
| 619 | { |
| 620 | first = firstTerm; last = lastTerm; singleObject = true; |
| 621 | } |
| 622 | else |
| 623 | { |
| 624 | first = copyTermList( firstTerm, last ); singleObject = false; |
| 625 | decRefCount(); |
| 626 | } |
| 627 | coeff = aPoly->firstTerm->coeff; |
| 628 | exp = aPoly->firstTerm->exp; |
| 629 | while (first && ( first->exp >= exp ) ) |
| 630 | { |
| 631 | newcoeff= first->coeff.tryDiv (coeff, M, fail); |
| 632 | if (fail) |
| 633 | { |
| 634 | freeTermList (first); |
| 635 | return CFFactory::basic (0); |
| 636 | } |
| 637 | newcoeff= reduce (newcoeff, M); |
| 638 | newexp = first->exp - exp; |
| 639 | dummy = first; |
| 640 | first = mulAddTermList( first->next, aPoly->firstTerm->next, newcoeff, newexp, last, true ); |
nothing calls this directly
no test coverage detected