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

Function tryInvert

factory/cfGcdAlgExt.cc:221–241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

219}
220
221void tryInvert( const CanonicalForm & F, const CanonicalForm & M, CanonicalForm & inv, bool & fail )
222{ // F, M are required to be "univariate" polynomials in an algebraic variable
223 // we try to invert F modulo M
224 if(F.inBaseDomain())
225 {
226 if(F.isZero())
227 {
228 fail = true;
229 return;
230 }
231 inv = 1/F;
232 return;
233 }
234 CanonicalForm b;
235 Variable a = M.mvar();
236 Variable x = Variable(1);
237 if(!extgcd( replacevar( F, a, x ), replacevar( M, a, x ), inv, b ).isOne())
238 fail = true;
239 else
240 inv = replacevar( inv, x, a ); // change back to alg var
241}
242
243#ifndef HAVE_NTL
244void tryDivrem (const CanonicalForm& F, const CanonicalForm& G, CanonicalForm& Q,

Callers 8

tryFdividesFunction · 0.85
tryDivremFunction · 0.85
tryEuclidFunction · 0.85
tryNewtonInterpFunction · 0.85
tryBrownGCDFunction · 0.85
QGCDFunction · 0.85
tryExtgcdFunction · 0.85
tryDiophantineFunction · 0.85

Calls 7

VariableFunction · 0.85
mvarMethod · 0.80
extgcdFunction · 0.70
replacevarFunction · 0.70
inBaseDomainMethod · 0.45
isZeroMethod · 0.45
isOneMethod · 0.45

Tested by

no test coverage detected