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

◆ computeHashValue()

unsigned int Matrix::computeHashValue ( ) const
protectedvirtual

Implements EngineObject.

Definition at line 43 of file matrix.cpp.

44{
45 unsigned int hashval = 234123 + (7 * n_rows() + 157 * n_cols());
46
47 iterator i(this);
48 for (int c = 0; c < n_cols(); c++)
49 {
50 int count = 0; // only use first 2 non-zero entries in each column
51 for (i.set(c); i.valid(); i.next())
52 {
53 hashval = 34224 * hashval + get_ring()->computeHashValue(i.entry());
54 if (++count > 2) break;
55 }
56 }
57 return hashval;
58}
const Ring * get_ring() const
Definition matrix.hpp:134
int n_cols() const
Definition matrix.hpp:147
int n_rows() const
Definition matrix.hpp:146
virtual unsigned int computeHashValue(const ring_elem a) const =0

References computeHashValue(), Matrix::iterator::entry(), get_ring(), n_cols(), n_rows(), Matrix::iterator::next(), Matrix::iterator::set(), and Matrix::iterator::valid().

Referenced by computeHashValue(), and MatrixConstructor.