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

◆ addTerm()

void MapPolynomialHeap::addTerm ( Entry tm)
inline

Definition at line 649 of file NCReduction.cpp.

650 {
651 auto result = mMap.find(tm.first);
652 bool found = (result != mMap.end());
653 if (found)
654 {
655 result->second = mRing.coefficientRing()->add(tm.second, result->second);
656 }
657 else
658 {
659 // need to allocate new term, and insert into hash table and the queue.
660 auto rg = mMonomialSpace.allocateArray<int>(tm.first.size());
661 std::copy(tm.first.begin(), tm.first.end(), rg.first);
662 mMap.insert({Monom(rg.first), tm.second});
663 }
664 }
MemoryBlock mMonomialSpace
std::map< Monom, ring_elem, MonomEq, gc_allocator< ConstEntry > > mMap
VALGRIND_MAKE_MEM_DEFINED & result(result)

References mMap, mMonomialSpace, mRing, and result().

Referenced by addPolynomial().