My Project
Loading...
Searching...
No Matches
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
9#include "reporter/reporter.h" // for Print!
10// //////////////////////////////////////////////////////////////////////// //
11//
12
13const int iMaxCacheSize = 20;
14
15template <typename CExponent>
17{
18 private:
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
33 MULT_STORE = 1
34 };
35
37 {
38 union{
39 CExponent aExponent;
40 poly aMonom;
41 } a;
42
43 union{
44 CExponent bExponent;
45 poly bMonom;
46 } b;
47
49
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*/
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 constuctors!
95};
96
97
98
99class 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
113{
114 public:
115 typedef int CExponent;
116
118
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
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:56
int p
Definition: cfModGcd.cc:4078
CanonicalForm b
Definition: cfModGcd.cc:4103
int NVars() const
Definition: ncSACache.h:26
int LookupEE(CExponent a, CExponent b, CCacheItem *&pItems)
Definition: ncSACache.h:56
ring m_basering
Definition: ncSACache.h:19
virtual ~CCacheHash()
Definition: ncSACache.h:28
int m_NVars
Definition: ncSACache.h:20
@ MULT_STORE
Definition: ncSACache.h:33
@ MULT_LOOKUP
Definition: ncSACache.h:32
CCacheHash & operator=(const CCacheHash &)
union CCacheHash::CCacheItem::@4 a
bool StoreEE(CExponent a, CExponent b, poly pProduct)
Definition: ncSACache.h:70
CCacheHash(const CCacheHash &)
CCacheHash(ring r)
Definition: ncSACache.h:23
virtual void History(const EHistoryType, const CExponent, const CExponent, const poly=NULL)
Definition: ncSACache.h:87
ring GetBasering() const
Definition: ncSACache.h:25
union CCacheHash::CCacheItem::@5 b
virtual void History(const EHistoryType t, const CExponent a, const CExponent b, const poly p=NULL)
Definition: ncSACache.cc:46
virtual ~CGlobalCacheHash()
Definition: ncSACache.h:106
CGlobalCacheHash(ring r)
Definition: ncSACache.h:104
CSpecialPairCacheHash(ring r)
Definition: ncSACache.h:117
virtual ~CSpecialPairCacheHash()
Definition: ncSACache.h:119
virtual void History(const EHistoryType t, const CExponent a, const CExponent b, const poly p=NULL)
Definition: ncSACache.cc:61
const int iMaxCacheSize
Definition: ncSACache.h:13
#define NULL
Definition: omList.c:12
void PrintS(const char *s)
Definition: reporter.cc:284