GiNaC
1.8.8
ginac
remember.h
Go to the documentation of this file.
1
6
/*
7
* GiNaC Copyright (C) 1999-2025 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, write to the Free Software
21
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22
*/
23
24
#ifndef GINAC_REMEMBER_H
25
#define GINAC_REMEMBER_H
26
27
#include <iosfwd>
28
#include <list>
29
#include <vector>
30
31
namespace
GiNaC
{
32
33
class
function;
34
class
ex;
35
40
class
remember_table_entry
{
41
public
:
42
remember_table_entry
(
function
const
& f,
ex
const
&
r
);
43
bool
is_equal
(
function
const
& f)
const
;
44
ex
get_result
()
const
{
return
result
; }
45
unsigned
long
get_last_access
()
const
{
return
last_access
; }
46
unsigned
long
get_successful_hits
()
const
{
return
successful_hits
; };
47
48
protected
:
49
unsigned
hashvalue
;
50
exvector
seq
;
51
ex
result
;
52
mutable
unsigned
long
last_access
;
53
mutable
unsigned
successful_hits
;
54
static
unsigned
long
access_counter
;
55
};
56
59
class
remember_table_list
:
public
std::list<remember_table_entry> {
60
public
:
61
remember_table_list
(
unsigned
as,
unsigned
strat);
62
void
add_entry
(
function
const
& f,
ex
const
& result);
63
bool
lookup_entry
(
function
const
& f,
ex
& result)
const
;
64
protected
:
65
unsigned
max_assoc_size
;
66
unsigned
remember_strategy
;
67
};
68
83
class
remember_table
:
public
std::vector<remember_table_list> {
84
public
:
85
remember_table
();
86
remember_table
(
unsigned
s,
unsigned
as,
unsigned
strat);
87
bool
lookup_entry
(
function
const
& f,
ex
& result)
const
;
88
void
add_entry
(
function
const
& f,
ex
const
& result);
89
void
clear_all_entries
();
90
void
show_statistics
(std::ostream & os,
unsigned
level)
const
;
91
static
std::vector<remember_table> &
remember_tables
();
92
protected
:
93
void
init_table
();
94
unsigned
table_size
;
95
unsigned
max_assoc_size
;
96
unsigned
remember_strategy
;
97
};
98
99
}
// namespace GiNaC
100
101
#endif
// ndef GINAC_REMEMBER_H
GiNaC::ex
Lightweight wrapper for GiNaC's symbolic objects.
Definition
ex.h:73
GiNaC::function
The class function is used to implement builtin functions like sin, cos... and user defined functions...
Definition
function.h:674
GiNaC::remember_table_entry
A single entry in the remember table of a function.
Definition
remember.h:40
GiNaC::remember_table_entry::get_result
ex get_result() const
Definition
remember.h:44
GiNaC::remember_table_entry::seq
exvector seq
Definition
remember.h:50
GiNaC::remember_table_entry::get_last_access
unsigned long get_last_access() const
Definition
remember.h:45
GiNaC::remember_table_entry::is_equal
bool is_equal(function const &f) const
Definition
remember.cpp:43
GiNaC::remember_table_entry::hashvalue
unsigned hashvalue
Definition
remember.h:49
GiNaC::remember_table_entry::get_successful_hits
unsigned long get_successful_hits() const
Definition
remember.h:46
GiNaC::remember_table_entry::successful_hits
unsigned successful_hits
Definition
remember.h:53
GiNaC::remember_table_entry::result
ex result
Definition
remember.h:51
GiNaC::remember_table_entry::last_access
unsigned long last_access
Definition
remember.h:52
GiNaC::remember_table_entry::access_counter
static unsigned long access_counter
Definition
remember.h:54
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:59
GiNaC::remember_table_list::remember_strategy
unsigned remember_strategy
Definition
remember.h:66
GiNaC::remember_table_list::add_entry
void add_entry(function const &f, ex const &result)
Definition
remember.cpp:68
GiNaC::remember_table_list::lookup_entry
bool lookup_entry(function const &f, ex &result) const
Definition
remember.cpp:122
GiNaC::remember_table_list::max_assoc_size
unsigned max_assoc_size
Definition
remember.h:65
GiNaC::remember_table
The remember table is organized like an n-fold associative cache in a microprocessor.
Definition
remember.h:83
GiNaC::remember_table::remember_tables
static std::vector< remember_table > & remember_tables()
Definition
remember.cpp:184
GiNaC::remember_table::clear_all_entries
void clear_all_entries()
Definition
remember.cpp:171
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:95
GiNaC::remember_table::init_table
void init_table()
Definition
remember.cpp:177
GiNaC::remember_table::add_entry
void add_entry(function const &f, ex const &result)
Definition
remember.cpp:164
GiNaC::remember_table::remember_strategy
unsigned remember_strategy
Definition
remember.h:96
GiNaC::remember_table::table_size
unsigned table_size
Definition
remember.h:94
GiNaC::remember_table::lookup_entry
bool lookup_entry(function const &f, ex &result) const
Definition
remember.cpp:157
GiNaC::remember_table::remember_table
remember_table()
Definition
remember.cpp:139
r
size_t r
Definition
factor.cpp:757
GiNaC
Definition
add.cpp:36
GiNaC::exvector
std::vector< ex > exvector
Definition
basic.h:48
This page is part of the
GiNaC
developer's reference. It was generated automatically by
doxygen
. For an introduction, see the
tutorial
.