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

Method tryInvert

factory/int_poly.cc:263–283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

261}
262
263InternalCF*
264InternalPoly::tryInvert ( const CanonicalForm& M, bool& fail)
265{
266 if ( inExtension() && !getReduce ( var ) )
267 {
268 CanonicalForm b, inverse;
269 CanonicalForm F ( this ->copyObject() );
270 Variable a = M.mvar();
271 Variable x = Variable(1);
272 F= mod (F, M); //reduce mod M
273 CanonicalForm g= extgcd (replacevar( F, a, x ), replacevar( M, a, x ), inverse, b );
274 if(!g.isOne())
275 fail = true;
276 else
277 inverse = replacevar( inverse, x, a ); // change back to alg var
278 CanonicalForm test= mod (inverse*F, M);
279 return inverse.getval();
280 }
281 else
282 return CFFactory::basic( 0 );
283}
284
285InternalCF*
286InternalPoly::addsame( InternalCF* aCoeff )

Callers 4

tryDividecoeffMethod · 0.95
tryDivcoeffMethod · 0.95
tryDivsameMethod · 0.45
tryDivremsametMethod · 0.45

Calls 10

inExtensionFunction · 0.85
getReduceFunction · 0.85
VariableFunction · 0.85
copyObjectMethod · 0.80
mvarMethod · 0.80
modFunction · 0.70
extgcdFunction · 0.70
replacevarFunction · 0.70
isOneMethod · 0.45
getvalMethod · 0.45

Tested by

no test coverage detected