MCPcopy Create free account
hub / github.com/Singular/Singular / tryDivsame

Method tryDivsame

factory/int_poly.cc:583–684  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

581}
582
583InternalCF*
584InternalPoly::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 );

Callers

nothing calls this directly

Calls 9

tryMulsameMethod · 0.95
inExtensionFunction · 0.85
getReduceFunction · 0.85
decRefCountFunction · 0.85
reduceFunction · 0.85
is_immFunction · 0.70
tryInvertMethod · 0.45
isZeroMethod · 0.45
getvalMethod · 0.45

Tested by

no test coverage detected