source: git/kernel/ncSACache.h @ 67dbdb

fieker-DuValspielwiese
Last change on this file since 67dbdb was 1367162, checked in by Motsak Oleksandr <motsak@…>, 16 years ago
*motsak: still in early development stage (Special pair NC-multiplication) git-svn-id: file:///usr/local/Singular/svn/trunk@10857 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 1.6 KB
Line 
1#ifndef GRING_SA_MULT_H
2#define GRING_SA_MULT_H
3/*****************************************
4 *  Computer Algebra System SINGULAR     *
5 *****************************************/
6/* $Id: ncSACache.h,v 1.1 2008-07-11 15:53:28 motsak Exp $ */
7
8// #include <ncSACache.h> // for CCacheHash etc classes
9
10#include <structs.h>
11
12// //////////////////////////////////////////////////////////////////////// //
13//
14
15
16
17const int iMaxCacheSize = 20;
18
19template <typename CExponent>
20class CCacheHash
21{
22  public:
23    enum EHistoryType {
24      MULT_LOOKUP
25    }
26
27    struct CCacheItem
28    {
29      union{
30        CExponent aExponent;
31        poly aMonom;
32      } a;
33
34      union{
35        CExponent bExponent;
36        poly bMonom;
37      } b;
38
39      poly pProduct;
40
41      int iPairType;
42      long lHits;
43    };
44
45   
46    // -1 means no hits!
47    int Lookup(CExponent a, CExponent b, CCacheItem*& pItems) const
48    {
49      History(a, b, MULT_LOOKUP);
50      pItems = NULL;
51      return -1;
52    }
53
54    bool Store(CExponent a, CExponent b, poly pProduct)
55    {
56      return false; // the pair was not stored!
57    };
58   
59    virtual void History(const CExponent a, const CExponent b, const EHistoryType t)
60    {
61      Print("Mult!\n");
62    }
63
64  private: // no copy constuctors!
65    CCacheHash();
66    operator =(CCacheHash&);
67};
68
69
70
71class CGlobalCacheHash: public CCacheHash<poly>
72{
73  public:
74    typedef poly CExponent;
75
76  protected:
77    virtual void History(CExponent a, CExponent b, const EHistoryType t);
78};
79
80
81
82class CSpecialPairCacheHash: public CCacheHash<int>
83{
84  public:
85    typedef int CExponent;
86   
87  protected:
88    virtual void History(const CExponent a, const CExponent b, const EHistoryType t);
89};
90
Note: See TracBrowser for help on using the repository browser.