My Project
Toggle main menu visibility
Loading...
Searching...
No Matches
libpolys
polys
nc
ncSACache.h
Go to the documentation of this file.
1
#ifndef GRING_SA_CACHEHASH_H
2
#define GRING_SA_CACHEHASH_H
3
/*****************************************
4
* Computer Algebra System SINGULAR *
5
*****************************************/
6
7
#include "
polys/monomials/ring.h
"
8
#include "
polys/monomials/p_polys.h
"
9
#include "
reporter/reporter.h
"
// for Print!
10
// //////////////////////////////////////////////////////////////////////// //
11
//
12
13
const
int
iMaxCacheSize
= 20;
14
15
template
<
typename
CExponent>
16
class
CCacheHash
17
{
18
private
:
19
ring
m_basering
;
20
int
m_NVars
;
21
22
public
:
23
CCacheHash
(ring r):
m_basering
(r),
m_NVars
(r->
N
){};
24
25
ring
GetBasering
()
const
{
return
m_basering
; };
26
inline
int
NVars
()
const
{
return
m_NVars
; }
27
28
virtual
~CCacheHash
(){};
29
30
31
enum
EHistoryType
{
32
MULT_LOOKUP
= 0,
33
MULT_STORE
= 1
34
};
35
36
struct
CCacheItem
37
{
38
union
{
39
CExponent
aExponent
;
40
poly
aMonom
;
41
}
a
;
42
43
union
{
44
CExponent
bExponent
;
45
poly
bMonom
;
46
}
b
;
47
48
poly
pProduct
;
49
50
int
iPairType
;
51
long
lHits
;
52
};
53
54
55
// -1 means no hits!
56
int
LookupEE
(CExponent a, CExponent
b
,
CCacheItem
*& pItems)
57
{
58
/*
59
PrintS("//////////////////////////////////////////////////////////////////////////////////////////////");
60
PrintLn();
61
PrintS("CCacheHash::LookupEE(a, b, *results)!");
62
PrintLn();
63
*/
64
History
(
MULT_LOOKUP
, a,
b
);
65
66
pItems =
NULL
;
67
return
-1;
68
}
69
70
bool
StoreEE
(CExponent a, CExponent
b
, poly pProduct)
71
{
72
/*
73
PrintS("CCacheHash::StoreEE(a, b, Product)!");
74
PrintLn();
75
*/
76
77
History
(
MULT_STORE
, a,
b
, pProduct);
78
79
/*
80
PrintS("\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\");
81
PrintLn();
82
*/
83
84
return
false
;
// the pair was not stored!
85
};
86
87
virtual
void
History
(
const
EHistoryType
,
const
CExponent
/*a*/
,
const
CExponent
/*b*/
,
const
poly =
NULL
)
88
{
89
PrintS
(
"CCacheHash::History(a, b, [p])!\n"
);
90
}
91
92
private
:
// no copy constructors!
93
CCacheHash
(
const
CCacheHash
&);
94
CCacheHash
&
operator=
(
const
CCacheHash
&);
95
};
96
97
98
99
class
CGlobalCacheHash
:
public
CCacheHash
<poly>
100
{
101
public
:
102
typedef
poly
CExponent
;
103
104
CGlobalCacheHash
(ring r):
CCacheHash
<poly>(r) {};
105
106
virtual
~CGlobalCacheHash
() {};
107
108
protected
:
109
virtual
void
History
(
const
EHistoryType
t,
const
CExponent
a,
const
CExponent
b
,
const
poly
p
=
NULL
);
110
};
111
112
class
CSpecialPairCacheHash
:
public
CCacheHash
<int>
113
{
114
public
:
115
typedef
int
CExponent
;
116
117
CSpecialPairCacheHash
(ring r):
CCacheHash
<int>(r) {};
118
119
virtual
~CSpecialPairCacheHash
() {};
120
121
protected
:
122
virtual
void
History
(
const
EHistoryType
t,
const
CExponent
a,
const
CExponent
b
,
const
poly
p
=
NULL
);
123
};
124
125
126
127
#endif
// GRING_SA_CACHEHASH_H
128
129
N
const CanonicalForm CFMap CFMap & N
Definition
cfEzgcd.cc:56
p
int p
Definition
cfModGcd.cc:4086
b
CanonicalForm b
Definition
cfModGcd.cc:4111
CCacheHash::NVars
int NVars() const
Definition
ncSACache.h:26
CCacheHash::LookupEE
int LookupEE(CExponent a, CExponent b, CCacheItem *&pItems)
Definition
ncSACache.h:56
CCacheHash::m_basering
ring m_basering
Definition
ncSACache.h:19
CCacheHash::~CCacheHash
virtual ~CCacheHash()
Definition
ncSACache.h:28
CCacheHash::CCacheItem.b::bExponent
CExponent bExponent
CCacheHash::m_NVars
int m_NVars
Definition
ncSACache.h:20
CCacheHash::CCacheItem.b::bMonom
poly bMonom
CCacheHash::EHistoryType
EHistoryType
Definition
ncSACache.h:31
CCacheHash::MULT_STORE
@ MULT_STORE
Definition
ncSACache.h:33
CCacheHash::MULT_LOOKUP
@ MULT_LOOKUP
Definition
ncSACache.h:32
CCacheHash::operator=
CCacheHash & operator=(const CCacheHash &)
CCacheHash::StoreEE
bool StoreEE(CExponent a, CExponent b, poly pProduct)
Definition
ncSACache.h:70
CCacheHash::CCacheHash
CCacheHash(const CCacheHash &)
CCacheHash::CCacheHash
CCacheHash(ring r)
Definition
ncSACache.h:23
CCacheHash::History
virtual void History(const EHistoryType, const CExponent, const CExponent, const poly=NULL)
Definition
ncSACache.h:87
CCacheHash::GetBasering
ring GetBasering() const
Definition
ncSACache.h:25
CCacheHash::CCacheItem.a::aExponent
CExponent aExponent
CCacheHash::CCacheItem.a::aMonom
poly aMonom
CGlobalCacheHash::History
virtual void History(const EHistoryType t, const CExponent a, const CExponent b, const poly p=NULL)
Definition
ncSACache.cc:46
CGlobalCacheHash::CExponent
poly CExponent
Definition
ncSACache.h:102
CGlobalCacheHash::~CGlobalCacheHash
virtual ~CGlobalCacheHash()
Definition
ncSACache.h:106
CGlobalCacheHash::CGlobalCacheHash
CGlobalCacheHash(ring r)
Definition
ncSACache.h:104
CSpecialPairCacheHash::CSpecialPairCacheHash
CSpecialPairCacheHash(ring r)
Definition
ncSACache.h:117
CSpecialPairCacheHash::~CSpecialPairCacheHash
virtual ~CSpecialPairCacheHash()
Definition
ncSACache.h:119
CSpecialPairCacheHash::History
virtual void History(const EHistoryType t, const CExponent a, const CExponent b, const poly p=NULL)
Definition
ncSACache.cc:61
CSpecialPairCacheHash::CExponent
int CExponent
Definition
ncSACache.h:115
iMaxCacheSize
const int iMaxCacheSize
Definition
ncSACache.h:13
NULL
#define NULL
Definition
omList.c:12
p_polys.h
PrintS
void PrintS(const char *s)
Definition
reporter.cc:288
reporter.h
ring.h
CCacheHash::CCacheItem
Definition
ncSACache.h:37
CCacheHash::CCacheItem::lHits
long lHits
Definition
ncSACache.h:51
CCacheHash::CCacheItem::a
union CCacheHash::CCacheItem::@362055051370213063064106300073341224300167350106 a
CCacheHash::CCacheItem::iPairType
int iPairType
Definition
ncSACache.h:50
CCacheHash::CCacheItem::pProduct
poly pProduct
Definition
ncSACache.h:48
Generated on
for My Project by
doxygen 1.17.0
for
Singular