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

Method addsame

factory/int_poly.cc:285–323  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

283}
284
285InternalCF*
286InternalPoly::addsame( InternalCF* aCoeff )
287{
288 InternalPoly * aPoly = (InternalPoly*)aCoeff;
289 if ( getRefCount() <= 1 )
290 {
291 firstTerm = addTermList( firstTerm, aPoly->firstTerm, lastTerm, false );
292 if ( firstTerm && firstTerm->exp != 0 )
293 return this;
294 else if ( firstTerm )
295 {
296 InternalCF * res = firstTerm->coeff.getval();
297 delete this;
298 return res;
299 }
300 else
301 {
302 delete this;
303 return CFFactory::basic( 0 );
304 }
305 }
306 else
307 {
308 decRefCount();
309 termList last, first = copyTermList( firstTerm, last );
310 first = addTermList( first, aPoly->firstTerm, last, false );
311 if ( first && first->exp != 0 )
312 return new InternalPoly( first, last, var );
313 else if ( first )
314 {
315 InternalCF * res = first->coeff.getval();
316 delete first;
317 return res;
318 }
319 else
320 return CFFactory::basic( 0 );
321
322 }
323}
324
325InternalCF*
326InternalPoly::subsame( InternalCF* aCoeff )

Callers

nothing calls this directly

Calls 2

decRefCountFunction · 0.85
getvalMethod · 0.45

Tested by

no test coverage detected