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 <ncSACache.h> // for CCacheHash etc classes
8 
9 #include <polys/monomials/ring.h>
11 #include <reporter/reporter.h> // for Print!
12 // //////////////////////////////////////////////////////////////////////// //
13 //
14 
15 const int iMaxCacheSize = 20;
16 
17 template <typename CExponent>
19 {
20  private:
21  ring m_basering;
22  int m_NVars;
23 
24  public:
25  CCacheHash(ring r): m_basering(r), m_NVars(r->N){};
26 
27  ring GetBasering() const { return m_basering; };
28  inline int NVars() const { return m_NVars; }
29 
30  virtual ~CCacheHash(){};
31 
32 
33  enum EHistoryType {
36  };
37 
38  struct CCacheItem
39  {
40  union{
41  CExponent aExponent;
42  poly aMonom;
43  } a;
44 
45  union{
46  CExponent bExponent;
47  poly bMonom;
48  } b;
49 
51 
52  int iPairType;
53  long lHits;
54  };
55 
56 
57  // -1 means no hits!
58  int LookupEE(CExponent a, CExponent b, CCacheItem*& pItems)
59  {
60 /*
61  PrintS("//////////////////////////////////////////////////////////////////////////////////////////////");
62  PrintLn();
63  PrintS("CCacheHash::LookupEE(a, b, *results)!");
64  PrintLn();
65 */
67 
68  pItems = NULL;
69  return -1;
70  }
71 
72  bool StoreEE(CExponent a, CExponent b, poly pProduct)
73  {
74 /*
75  PrintS("CCacheHash::StoreEE(a, b, Product)!");
76  PrintLn();
77 */
78 
79  History(MULT_STORE, a, b, pProduct);
80 
81 /*
82  PrintS("\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\");
83  PrintLn();
84 */
85 
86  return false; // the pair was not stored!
87  };
88 
89  virtual void History(const EHistoryType , const CExponent /*a*/, const CExponent /*b*/, const poly = NULL)
90  {
91  PrintS("CCacheHash::History(a, b, [p])!\n");
92  }
93 
94  private: // no copy constuctors!
95  CCacheHash(const CCacheHash&);
97 };
98 
99 
100 
101 class CGlobalCacheHash: public CCacheHash<poly>
102 {
103  public:
104  typedef poly CExponent;
105 
107 
108  virtual ~CGlobalCacheHash() {};
109 
110  protected:
111  virtual void History(const EHistoryType t, const CExponent a, const CExponent b, const poly p = NULL);
112 };
113 
115 {
116  public:
117  typedef int CExponent;
118 
120 
122 
123  protected:
124  virtual void History(const EHistoryType t, const CExponent a, const CExponent b, const poly p = NULL);
125 };
126 
127 
128 
129 #endif // GRING_SA_CACHEHASH_H
130 
131 
union CCacheHash::CCacheItem::@4 b
const poly a
Definition: syzextra.cc:212
return P p
Definition: myNF.cc:203
CCacheHash & operator=(const CCacheHash &)
virtual void History(const EHistoryType t, const CExponent a, const CExponent b, const poly p=NULL)
Definition: ncSACache.cc:61
bool StoreEE(CExponent a, CExponent b, poly pProduct)
Definition: ncSACache.h:72
ring m_basering
Definition: ncSACache.h:21
CGlobalCacheHash(ring r)
Definition: ncSACache.h:106
int LookupEE(CExponent a, CExponent b, CCacheItem *&pItems)
Definition: ncSACache.h:58
virtual ~CSpecialPairCacheHash()
Definition: ncSACache.h:121
virtual ~CGlobalCacheHash()
Definition: ncSACache.h:108
CSpecialPairCacheHash(ring r)
Definition: ncSACache.h:119
ring GetBasering() const
Definition: ncSACache.h:27
const ring r
Definition: syzextra.cc:208
CCacheHash(ring r)
Definition: ncSACache.h:25
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
int NVars() const
Definition: ncSACache.h:28
void PrintS(const char *s)
Definition: reporter.cc:284
int m_NVars
Definition: ncSACache.h:22
const int iMaxCacheSize
Definition: ncSACache.h:15
#define NULL
Definition: omList.c:10
virtual void History(const EHistoryType, const CExponent, const CExponent, const poly=NULL)
Definition: ncSACache.h:89
virtual ~CCacheHash()
Definition: ncSACache.h:30
polyrec * poly
Definition: hilb.h:10
union CCacheHash::CCacheItem::@3 a
const poly b
Definition: syzextra.cc:213
virtual void History(const EHistoryType t, const CExponent a, const CExponent b, const poly p=NULL)
Definition: ncSACache.cc:46