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

◆ computeHashValue()

unsigned int PolynomialRing::computeHashValue ( const ring_elem a) const
virtual

Implements Ring.

Definition at line 214 of file polyring.cpp.

215{
216 unsigned int hash = 0;
217 unsigned int seed1 = 103;
218 unsigned int seed2 = 347654;
219 for (Nterm& t : a.poly_val)
220 {
221 unsigned int hash1 = getCoefficientRing()->computeHashValue(t.coeff);
222 unsigned int hash2 = getMonoid()->computeHashValue(t.monom);
223 hash += seed1 * hash1 + seed2 * hash2;
224 seed1 += 463633;
225 seed2 += 7858565;
226 }
227 return hash;
228}
unsigned int computeHashValue(const_monomial m) const
Definition monoid.cpp:349
unsigned int hash() const
Definition hash.hpp:106
const Ring * getCoefficientRing() const
Definition polyring.hpp:200
virtual const Monoid * getMonoid() const
Definition polyring.hpp:282
virtual unsigned int computeHashValue(const ring_elem a) const =0
ring_elem coeff
Definition ringelem.hpp:158
int monom[1]
Definition ringelem.hpp:160
Nterm * poly_val
Definition ringelem.hpp:86

References Nterm::coeff, Monoid::computeHashValue(), Ring::computeHashValue(), getCoefficientRing(), getMonoid(), MutableEngineObject::hash(), Nterm::monom, and ring_elem::poly_val.