/usr/include/singular/singular/polys/nc/ncSACache.h is in libsingular4-dev-common 1:4.1.0-p3+ds-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | #ifndef GRING_SA_CACHEHASH_H
#define GRING_SA_CACHEHASH_H
/*****************************************
* Computer Algebra System SINGULAR *
*****************************************/
// #include <ncSACache.h> // for CCacheHash etc classes
#include <polys/monomials/ring.h>
#include <polys/monomials/p_polys.h>
#include <reporter/reporter.h> // for Print!
// //////////////////////////////////////////////////////////////////////// //
//
const int iMaxCacheSize = 20;
template <typename CExponent>
class CCacheHash
{
private:
ring m_basering;
int m_NVars;
public:
CCacheHash(ring r): m_basering(r), m_NVars(r->N){};
ring GetBasering() const { return m_basering; };
inline int NVars() const { return m_NVars; }
virtual ~CCacheHash(){};
enum EHistoryType {
MULT_LOOKUP = 0,
MULT_STORE = 1
};
struct CCacheItem
{
union{
CExponent aExponent;
poly aMonom;
} a;
union{
CExponent bExponent;
poly bMonom;
} b;
poly pProduct;
int iPairType;
long lHits;
};
// -1 means no hits!
int LookupEE(CExponent a, CExponent b, CCacheItem*& pItems)
{
/*
PrintS("//////////////////////////////////////////////////////////////////////////////////////////////");
PrintLn();
PrintS("CCacheHash::LookupEE(a, b, *results)!");
PrintLn();
*/
History(MULT_LOOKUP, a, b);
pItems = NULL;
return -1;
}
bool StoreEE(CExponent a, CExponent b, poly pProduct)
{
/*
PrintS("CCacheHash::StoreEE(a, b, Product)!");
PrintLn();
*/
History(MULT_STORE, a, b, pProduct);
/*
PrintS("\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\");
PrintLn();
*/
return false; // the pair was not stored!
};
virtual void History(const EHistoryType , const CExponent /*a*/, const CExponent /*b*/, const poly = NULL)
{
PrintS("CCacheHash::History(a, b, [p])!\n");
}
private: // no copy constuctors!
CCacheHash(const CCacheHash&);
CCacheHash& operator=(const CCacheHash&);
};
class CGlobalCacheHash: public CCacheHash<poly>
{
public:
typedef poly CExponent;
CGlobalCacheHash(ring r): CCacheHash<poly>(r) {};
virtual ~CGlobalCacheHash() {};
protected:
virtual void History(const EHistoryType t, const CExponent a, const CExponent b, const poly p = NULL);
};
class CSpecialPairCacheHash: public CCacheHash<int>
{
public:
typedef int CExponent;
CSpecialPairCacheHash(ring r): CCacheHash<int>(r) {};
virtual ~CSpecialPairCacheHash() {};
protected:
virtual void History(const EHistoryType t, const CExponent a, const CExponent b, const poly p = NULL);
};
#endif // GRING_SA_CACHEHASH_H
|