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

Method gcd

kernel/fglm/fglmvec.cc:458–503  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

456}
457
458number fglmVector::gcd () const
459{
460 int i = rep->size ();
461 BOOLEAN found = FALSE;
462 BOOLEAN gcdIsOne = FALSE;
463 number theGcd;
464 number current;
465 while(i > 0 && !found)
466 {
467 current = rep->getconstelem (i);
468 if(!nIsZero (current))
469 {
470 theGcd = nCopy (current);
471 found = TRUE;
472 if(!nGreaterZero (theGcd))
473 {
474 theGcd = nInpNeg (theGcd);
475 }
476 if(nIsOne (theGcd))
477 gcdIsOne = TRUE;
478 }
479 i--;
480 }
481 if(found)
482 {
483 if (getCoeffType(currRing->cf)!=n_Zp)
484 {
485 while(i > 0 && !gcdIsOne)
486 {
487 current = rep->getconstelem (i);
488 if(!nIsZero (current))
489 {
490 number temp = n_SubringGcd (theGcd, current, currRing->cf);
491 nDelete (&theGcd);
492 theGcd = temp;
493 if(nIsOne (theGcd))
494 gcdIsOne = TRUE;
495 }
496 i--;
497 }
498 }
499 }
500 else
501 theGcd = nInit (0);
502 return theGcd;
503}
504
505number fglmVector::clearDenom ()
506{

Callers 6

fglmNewLinearCombinationFunction · 0.45
fglmLinearCombinationFunction · 0.45
reduceMethod · 0.45
newGroebnerPolyMethod · 0.45
gaussreduceMethod · 0.45
FindUnivariatePolysFunction · 0.45

Calls 3

n_SubringGcdFunction · 0.85
sizeMethod · 0.45
getconstelemMethod · 0.45

Tested by

no test coverage detected