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)
161 return operator[](entry).lookup_entry(f,result);
168 operator[](entry).add_entry(f,result);
186 static std::vector<remember_table> rt = std::vector<remember_table>();
#define GINAC_ASSERT(X)
Assertion macro for checking invariances.
Lightweight wrapper for GiNaC's symbolic objects.
The class function is used to implement builtin functions like sin, cos... and user defined functions...
@ delete_never
Let table grow undefinitely.
@ delete_cyclic
First (oldest) one in list.
@ delete_lfu
Least frequently used.
@ delete_lru
Least recently used.
A single entry in the remember table of a function.
bool is_equal(function const &f) const
remember_table_entry(function const &f, ex const &r)
unsigned long last_access
static unsigned long access_counter
A list of entries in the remember table having some least significant bits of the hashvalue in common...
unsigned remember_strategy
remember_table_list(unsigned as, unsigned strat)
void add_entry(function const &f, ex const &result)
bool lookup_entry(function const &f, ex &result) const
static std::vector< remember_table > & remember_tables()
void add_entry(function const &f, ex const &result)
unsigned remember_strategy
bool lookup_entry(function const &f, ex &result) const
Interface to class of symbolic functions.
unsigned log2(unsigned n)
Integer binary logarithm.
Interface to helper classes for using the remember option in GiNaC functions.
Interface to several small and furry utilities needed within GiNaC but not of any interest to the use...