Macaulay2 Engine
Loading...
Searching...
No Matches

◆ isZero()

template<template< typename > class Queue>
bool NaivePolynomialHeap< Queue >::isZero ( )
inlineoverridevirtual

Implements PolynomialHeap.

Definition at line 421 of file NCReduction.cpp.

422 {
423 if (mLeadTermSet) return false;
424 if (mQueue.empty()) return true;
425 Entry lt = mQueue.pop();
426 while (not mQueue.empty())
427 {
428 Entry e = mQueue.top();
429 // this is bad - compare should not be used to check equality
430 if (mRing.monoid().compare(e.first, lt.first) == EQ)
431 {
432 lt.second = mRing.coefficientRing()->add(lt.second, e.second);
433 mQueue.pop();
434 }
435 else
436 {
437 if (not mRing.coefficientRing()->is_zero(lt.second))
438 {
439 mLeadTermSet = true;
440 mLeadTerm = lt;
441 return false;
442 }
443 else
444 lt = mQueue.pop();
445 }
446 }
447 if (not mRing.coefficientRing()->is_zero(lt.second))
448 {
449 mLeadTermSet = true;
450 mLeadTerm = lt;
451 return false;
452 }
453 return true;
454 }
NaiveQueueConfiguration::Entry Entry
Queue< NaiveQueueConfiguration > mQueue
std::pair< Monom, ring_elem > mLeadTerm

References EQ, mLeadTerm, mLeadTermSet, mQueue, and mRing.

Referenced by removeLeadTerm(), value(), and viewLeadTerm().