37 : hashvalue(f.gethash()), seq(f.seq), result(
r)
47 size_t num =
seq.size();
48 for (
size_t i=0; i<num; ++i)
85 auto lowest_access_it = it;
86 unsigned long lowest_access = (*it).get_last_access();
89 if ((*it).get_last_access()<lowest_access) {
90 lowest_access = (*it).get_last_access();
91 lowest_access_it = it;
95 erase(lowest_access_it);
101 auto lowest_hits_it = it;
102 unsigned lowest_hits = (*it).get_successful_hits();
105 if ((*it).get_successful_hits()<lowest_hits) {
106 lowest_hits = (*it).get_successful_hits();
111 erase(lowest_hits_it);
115 throw(std::logic_error(
"remember_table_list::add_entry(): invalid remember_strategy"));
124 auto i = begin(), iend = end();
126 if (i->is_equal(f)) {
127 result = i->get_result();
147 : max_assoc_size(as), remember_strategy(strat)
159 unsigned entry = f.gethash() & (
table_size-1);
161 return operator[](entry).lookup_entry(f,result);
166 unsigned entry = f.gethash() & (
table_size-1);
168 operator[](entry).add_entry(f,result);
186 static std::vector<remember_table> rt = std::vector<remember_table>();
Interface to helper classes for using the remember option in GiNaC functions.
Interface to class of symbolic functions.
First (oldest) one in list.
Let table grow undefinitely.
remember_table_entry(function const &f, ex const &r)
Interface to several small and furry utilities needed within GiNaC but not of any interest to the use...
unsigned long last_access
bool lookup_entry(function const &f, ex &result) const
#define GINAC_ASSERT(X)
Assertion macro for checking invariances.
void add_entry(function const &f, ex const &result)
unsigned log2(unsigned n)
Integer binary logarithm.
A list of entries in the remember table having some least significant bits of the hashvalue in common...
A single entry in the remember table of a function.
static unsigned long access_counter
void add_entry(function const &f, ex const &result)
static std::vector< remember_table > & remember_tables()
Lightweight wrapper for GiNaC's symbolic objects.
unsigned remember_strategy
remember_table_list(unsigned as, unsigned strat)
bool lookup_entry(function const &f, ex &result) const
unsigned remember_strategy
bool is_equal(function const &f) const