bool remember_table_entry::is_equal(function const & f) const { GINAC_ASSERT(f.seq.size()==seq.size()); if (f.gethash()!=hashvalue) return false; size_t num = seq.size(); for (size_t i=0; i<num; ++i) if (!seq[i].is_equal(f.seq[i])) return false; ++last_access = access_counter; ++successful_hits; return true; }
void remember_table::add_entry(function const & f, ex const & result) { long entry = f.gethash() & (table_size-1); GINAC_ASSERT(entry<size()); operator[](entry).add_entry(f,result); }
remember_table_entry::remember_table_entry(function const & f, ex r) : hashvalue(f.gethash()), seq(f.seq), result(std::move(r)) { ++last_access = access_counter; successful_hits = 0; }
bool remember_table::lookup_entry(function const & f, ex & result) const { long entry = f.gethash() & (table_size-1); GINAC_ASSERT(entry<size()); return operator[](entry).lookup_entry(f,result); }