GiNaC
1.8.10
ginac
remember.h
Go to the documentation of this file.
1
6
/*
7
* GiNaC Copyright (C) 1999-2026 Johannes Gutenberg University Mainz, Germany
8
*
9
* This program is free software; you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation; either version 2 of the License, or
12
* (at your option) any later version.
13
*
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU General Public License for more details.
18
*
19
* You should have received a copy of the GNU General Public License
20
* along with this program. If not, see <https://www.gnu.org/licenses/>.
21
*/
22
23
#ifndef GINAC_REMEMBER_H
24
#define GINAC_REMEMBER_H
25
26
#include <iosfwd>
27
#include <list>
28
#include <vector>
29
30
namespace
GiNaC
{
31
32
class
function;
33
class
ex;
34
39
class
remember_table_entry
{
40
public
:
41
remember_table_entry
(
function
const
& f,
ex
const
&
r
);
42
bool
is_equal
(
function
const
& f)
const
;
43
ex
get_result
()
const
{
return
result
; }
44
unsigned
long
get_last_access
()
const
{
return
last_access
; }
45
unsigned
long
get_successful_hits
()
const
{
return
successful_hits
; };
46
47
protected
:
48
unsigned
hashvalue
;
49
exvector
seq
;
50
ex
result
;
51
mutable
unsigned
long
last_access
;
52
mutable
unsigned
successful_hits
;
53
static
unsigned
long
access_counter
;
54
};
55
58
class
remember_table_list
:
public
std::list<remember_table_entry> {
59
public
:
60
remember_table_list
(
unsigned
as,
unsigned
strat);
61
void
add_entry
(
function
const
& f,
ex
const
& result);
62
bool
lookup_entry
(
function
const
& f,
ex
& result)
const
;
63
protected
:
64
unsigned
max_assoc_size
;
65
unsigned
remember_strategy
;
66
};
67
82
class
remember_table
:
public
std::vector<remember_table_list> {
83
public
:
84
remember_table
();
85
remember_table
(
unsigned
s,
unsigned
as,
unsigned
strat);
86
bool
lookup_entry
(
function
const
& f,
ex
& result)
const
;
87
void
add_entry
(
function
const
& f,
ex
const
& result);
88
void
clear_all_entries
();
89
void
show_statistics
(std::ostream & os,
unsigned
level)
const
;
90
static
std::vector<remember_table> &
remember_tables
();
91
protected
:
92
void
init_table
();
93
unsigned
table_size
;
94
unsigned
max_assoc_size
;
95
unsigned
remember_strategy
;
96
};
97
98
}
// namespace GiNaC
99
100
#endif
// ndef GINAC_REMEMBER_H
GiNaC::ex
Lightweight wrapper for GiNaC's symbolic objects.
Definition
ex.h:72
GiNaC::function
The class function is used to implement builtin functions like sin, cos... and user defined functions...
Definition
function.h:673
GiNaC::remember_table_entry
A single entry in the remember table of a function.
Definition
remember.h:39
GiNaC::remember_table_entry::get_result
ex get_result() const
Definition
remember.h:43
GiNaC::remember_table_entry::seq
exvector seq
Definition
remember.h:49
GiNaC::remember_table_entry::get_last_access
unsigned long get_last_access() const
Definition
remember.h:44
GiNaC::remember_table_entry::is_equal
bool is_equal(function const &f) const
Definition
remember.cpp:42
GiNaC::remember_table_entry::hashvalue
unsigned hashvalue
Definition
remember.h:48
GiNaC::remember_table_entry::get_successful_hits
unsigned long get_successful_hits() const
Definition
remember.h:45
GiNaC::remember_table_entry::successful_hits
unsigned successful_hits
Definition
remember.h:52
GiNaC::remember_table_entry::result
ex result
Definition
remember.h:50
GiNaC::remember_table_entry::last_access
unsigned long last_access
Definition
remember.h:51
GiNaC::remember_table_entry::access_counter
static unsigned long access_counter
Definition
remember.h:53
GiNaC::remember_table_list
A list of entries in the remember table having some least significant bits of the hashvalue in common...
Definition
remember.h:58
GiNaC::remember_table_list::remember_strategy
unsigned remember_strategy
Definition
remember.h:65
GiNaC::remember_table_list::add_entry
void add_entry(function const &f, ex const &result)
Definition
remember.cpp:67
GiNaC::remember_table_list::lookup_entry
bool lookup_entry(function const &f, ex &result) const
Definition
remember.cpp:121
GiNaC::remember_table_list::max_assoc_size
unsigned max_assoc_size
Definition
remember.h:64
GiNaC::remember_table
The remember table is organized like an n-fold associative cache in a microprocessor.
Definition
remember.h:82
GiNaC::remember_table::remember_tables
static std::vector< remember_table > & remember_tables()
Definition
remember.cpp:183
GiNaC::remember_table::clear_all_entries
void clear_all_entries()
Definition
remember.cpp:170
GiNaC::remember_table::show_statistics
void show_statistics(std::ostream &os, unsigned level) const
GiNaC::remember_table::max_assoc_size
unsigned max_assoc_size
Definition
remember.h:94
GiNaC::remember_table::init_table
void init_table()
Definition
remember.cpp:176
GiNaC::remember_table::add_entry
void add_entry(function const &f, ex const &result)
Definition
remember.cpp:163
GiNaC::remember_table::remember_strategy
unsigned remember_strategy
Definition
remember.h:95
GiNaC::remember_table::table_size
unsigned table_size
Definition
remember.h:93
GiNaC::remember_table::lookup_entry
bool lookup_entry(function const &f, ex &result) const
Definition
remember.cpp:156
GiNaC::remember_table::remember_table
remember_table()
Definition
remember.cpp:138
r
size_t r
Definition
factor.cpp:756
GiNaC
Definition
add.cpp:35
GiNaC::exvector
std::vector< ex > exvector
Definition
basic.h:47
This page is part of the
GiNaC
developer's reference. It was generated automatically by
doxygen
. For an introduction, see the
tutorial
.