My Project  debian-1:4.1.2-p1+ds-2
Public Member Functions | Data Fields | Static Public Attributes | Protected Types | Protected Member Functions | Protected Attributes
NoroCache< number_type > Class Template Reference

#include <tgb_internal.h>

Public Member Functions

void collectIrreducibleMonomials (std::vector< DataNoroCacheNode< number_type > * > &res)
 
void collectIrreducibleMonomials (int level, NoroCacheNode *node, std::vector< DataNoroCacheNode< number_type > * > &res)
 
DataNoroCacheNode< number_type > * insert (poly term, poly nf, int len)
 
DataNoroCacheNode< number_type > * insert (poly term, SparseRow< number_type > *srow)
 
DataNoroCacheNode< number_type > * insertAndTransferOwnerShip (poly t, ring)
 
poly lookup (poly term, BOOLEAN &succ, int &len)
 
DataNoroCacheNode< number_type > * getCacheReference (poly term)
 
 NoroCache ()
 
void ensureTempBufferSize (size_t size)
 
 ~NoroCache ()
 

Data Fields

poly temp_term
 
int nIrreducibleMonomials
 
int nReducibleMonomials
 
void * tempBuffer
 
size_t tempBufferSize
 

Static Public Attributes

static const int backLinkCode =-222
 

Protected Types

typedef std::vector< PolySimplepoly_vec
 

Protected Member Functions

DataNoroCacheNode< number_type > * treeInsert (poly term, poly nf, int len)
 
DataNoroCacheNode< number_type > * treeInsert (poly term, SparseRow< number_type > *srow)
 
DataNoroCacheNode< number_type > * treeInsertBackLink (poly term)
 

Protected Attributes

poly_vec ressources
 
NoroCacheNode root
 
number * buffer
 

Detailed Description

template<class number_type>
class NoroCache< number_type >

Definition at line 590 of file tgb_internal.h.

Member Typedef Documentation

◆ poly_vec

template<class number_type >
typedef std::vector<PolySimple> NoroCache< number_type >::poly_vec
protected

Definition at line 750 of file tgb_internal.h.

Constructor & Destructor Documentation

◆ NoroCache()

template<class number_type >
NoroCache< number_type >::NoroCache ( )
inline

Definition at line 657 of file tgb_internal.h.

658  {
659  buffer=NULL;
660 #ifdef NORO_RED_ARRAY_RESERVER
661  reserved=0;
662  recursionPolyBuffer=(poly*)omAlloc(1000000*sizeof(poly));
663 #endif
666  temp_term=pOne();
667  tempBufferSize=3000;
669  }
int nIrreducibleMonomials
Definition: tgb_internal.h:706
poly temp_term
Definition: tgb_internal.h:593
void * tempBuffer
Definition: tgb_internal.h:708
number * buffer
Definition: tgb_internal.h:755
size_t tempBufferSize
Definition: tgb_internal.h:709
int nReducibleMonomials
Definition: tgb_internal.h:707
#define omAlloc(size)
Definition: omAllocDecl.h:210
#define NULL
Definition: omList.c:12
#define pOne()
Definition: polys.h:311

◆ ~NoroCache()

template<class number_type >
NoroCache< number_type >::~NoroCache ( )
inline

Definition at line 691 of file tgb_internal.h.

692  {
693  int s=ressources.size();
694  int i;
695  for(i=0;i<s;i++)
696  {
697  p_Delete(&ressources[i].impl,currRing);
698  }
700 #ifdef NORO_RED_ARRAY_RESERVER
701  omfree(recursionPolyBuffer);
702 #endif
704  }
int i
Definition: cfEzgcd.cc:125
poly_vec ressources
Definition: tgb_internal.h:751
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define omfree(addr)
Definition: omAllocDecl.h:237
#define omFree(addr)
Definition: omAllocDecl.h:261
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:860
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13

Member Function Documentation

◆ collectIrreducibleMonomials() [1/2]

template<class number_type >
void NoroCache< number_type >::collectIrreducibleMonomials ( int  level,
NoroCacheNode node,
std::vector< DataNoroCacheNode< number_type > * > &  res 
)

Definition at line 1928 of file tgb_internal.h.

1929 {
1930  assume(level>=0);
1931  if (node==NULL) return;
1932  if (level<(currRing->N))
1933  {
1934  int i;
1935  for(i=0;i<node->branches_len;i++)
1936  {
1938  }
1939  }
1940  else
1941  {
1943  if (dn->value_len==backLinkCode)
1944  {
1945  res.push_back(dn);
1946  }
1947  }
1948 }
int level(const CanonicalForm &f)
NoroCacheNode ** branches
Definition: tgb_internal.h:435
void collectIrreducibleMonomials(std::vector< DataNoroCacheNode< number_type > * > &res)
static const int backLinkCode
Definition: tgb_internal.h:606
CanonicalForm res
Definition: facAbsFact.cc:64
#define assume(x)
Definition: mod2.h:390

◆ collectIrreducibleMonomials() [2/2]

template<class number_type >
void NoroCache< number_type >::collectIrreducibleMonomials ( std::vector< DataNoroCacheNode< number_type > * > &  res)

Definition at line 1920 of file tgb_internal.h.

1921 {
1922  int i;
1923  for(i=0;i<root.branches_len;i++)
1924  {
1926  }
1927 }
NoroCacheNode root
Definition: tgb_internal.h:754

◆ ensureTempBufferSize()

template<class number_type >
void NoroCache< number_type >::ensureTempBufferSize ( size_t  size)
inline

Definition at line 670 of file tgb_internal.h.

671  {
672  if (tempBufferSize<size)
673  {
677  }
678  }
int size(const CanonicalForm &f, const Variable &v)
int size ( const CanonicalForm & f, const Variable & v )
Definition: cf_ops.cc:600

◆ getCacheReference()

template<class number_type >
DataNoroCacheNode< number_type > * NoroCache< number_type >::getCacheReference ( poly  term)

Definition at line 1950 of file tgb_internal.h.

1951 {
1952  int i;
1953  NoroCacheNode* parent=&root;
1954  for(i=1;i<(currRing->N);i++)
1955  {
1956  parent=parent->getBranch(p_GetExp(term,i,currRing));
1957  if (!(parent))
1958  {
1959  return NULL;
1960  }
1961  }
1963  return res_holder;
1964 }
NoroCacheNode * getBranch(int branch)
Definition: tgb_internal.h:476
Definition: int_poly.h:33
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:468

◆ insert() [1/2]

template<class number_type >
DataNoroCacheNode<number_type>* NoroCache< number_type >::insert ( poly  term,
poly  nf,
int  len 
)
inline

Definition at line 607 of file tgb_internal.h.

608  {
609  //assume(impl.find(p_Copy(term,currRing))==impl.end());
610  //assume(len==pLength(nf));
612  if (term==nf)
613  {
615 
616  ressources.push_back(term);
618  return treeInsertBackLink(term);
619 
620  }
621  else
622  {
623  if (nf)
624  {
625  //nf=p_Copy(nf,currRing);
626  assume(p_LmCmp(nf,term,currRing)==-1);
627  ressources.push_back(nf);
628  }
629  return treeInsert(term,nf,len);
630 
631  }
632 
633  //impl[term]=std::pair<PolySimple,int> (nf,len);
634  }
DataNoroCacheNode< number_type > * treeInsert(poly term, poly nf, int len)
Definition: tgb_internal.h:711
DataNoroCacheNode< number_type > * treeInsertBackLink(poly term)
Definition: tgb_internal.h:737
#define p_GetCoeff(p, r)
Definition: monomials.h:50
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1500
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
#define npIsOne
Definition: tgb_internal.h:75
Definition: gnumpfl.cc:27

◆ insert() [2/2]

template<class number_type >
DataNoroCacheNode<number_type>* NoroCache< number_type >::insert ( poly  term,
SparseRow< number_type > *  srow 
)
inline

Definition at line 636 of file tgb_internal.h.

637  {
638  //assume(impl.find(p_Copy(term,currRing))==impl.end());
639  //assume(len==pLength(nf));
640 
641  return treeInsert(term,srow);
642 
643 
644  //impl[term]=std::pair<PolySimple,int> (nf,len);
645  }

◆ insertAndTransferOwnerShip()

template<class number_type >
DataNoroCacheNode<number_type>* NoroCache< number_type >::insertAndTransferOwnerShip ( poly  t,
ring   
)
inline

Definition at line 647 of file tgb_internal.h.

648  {
649  ressources.push_back(t);
651  res->term_index=nIrreducibleMonomials;
653  return res;
654  }

◆ lookup()

template<class number_type >
poly NoroCache< number_type >::lookup ( poly  term,
BOOLEAN succ,
int &  len 
)

Definition at line 1965 of file tgb_internal.h.

1966 {
1967  int i;
1968  NoroCacheNode* parent=&root;
1969  for(i=1;i<(currRing->N);i++)
1970  {
1971  parent=parent->getBranch(p_GetExp(term,i,currRing));
1972  if (!(parent))
1973  {
1974  succ=FALSE;
1975  return NULL;
1976  }
1977  }
1979  if (res_holder)
1980  {
1981  succ=TRUE;
1982  if ( /*(*/ res_holder->value_len==backLinkCode /*)*/ )
1983  {
1984  len=1;
1985  return term;
1986  }
1987  len=res_holder->value_len;
1988  return res_holder->value_poly;
1989  } else {
1990  succ=FALSE;
1991  return NULL;
1992  }
1993 }
#define TRUE
Definition: auxiliary.h:100
#define FALSE
Definition: auxiliary.h:96

◆ treeInsert() [1/2]

template<class number_type >
DataNoroCacheNode<number_type>* NoroCache< number_type >::treeInsert ( poly  term,
poly  nf,
int  len 
)
inlineprotected

Definition at line 711 of file tgb_internal.h.

712  {
713  int i;
715  int nvars=(currRing->N);
716  NoroCacheNode* parent=&root;
717  for(i=1;i<nvars;i++)
718  {
719  parent=parent->getOrInsertBranch(p_GetExp(term,i,currRing));
720  }
722  }
NoroCacheNode * getOrInsertBranch(int branch)
Definition: tgb_internal.h:490
NoroCacheNode * setNode(int branch, NoroCacheNode *node)
Definition: tgb_internal.h:445

◆ treeInsert() [2/2]

template<class number_type >
DataNoroCacheNode<number_type>* NoroCache< number_type >::treeInsert ( poly  term,
SparseRow< number_type > *  srow 
)
inlineprotected

Definition at line 724 of file tgb_internal.h.

725  {
726  int i;
728  int nvars=(currRing->N);
729  NoroCacheNode* parent=&root;
730  for(i=1;i<nvars;i++)
731  {
732  parent=parent->getOrInsertBranch(p_GetExp(term,i,currRing));
733  }
735  }

◆ treeInsertBackLink()

template<class number_type >
DataNoroCacheNode<number_type>* NoroCache< number_type >::treeInsertBackLink ( poly  term)
inlineprotected

Definition at line 737 of file tgb_internal.h.

738  {
739  int i;
740  int nvars=(currRing->N);
741  NoroCacheNode* parent=&root;
742  for(i=1;i<nvars;i++)
743  {
744  parent=parent->getOrInsertBranch(p_GetExp(term,i,currRing));
745  }
747  }

Field Documentation

◆ backLinkCode

template<class number_type >
const int NoroCache< number_type >::backLinkCode =-222
static

Definition at line 606 of file tgb_internal.h.

◆ buffer

template<class number_type >
number* NoroCache< number_type >::buffer
protected

Definition at line 755 of file tgb_internal.h.

◆ nIrreducibleMonomials

template<class number_type >
int NoroCache< number_type >::nIrreducibleMonomials

Definition at line 706 of file tgb_internal.h.

◆ nReducibleMonomials

template<class number_type >
int NoroCache< number_type >::nReducibleMonomials

Definition at line 707 of file tgb_internal.h.

◆ ressources

template<class number_type >
poly_vec NoroCache< number_type >::ressources
protected

Definition at line 751 of file tgb_internal.h.

◆ root

template<class number_type >
NoroCacheNode NoroCache< number_type >::root
protected

Definition at line 754 of file tgb_internal.h.

◆ temp_term

template<class number_type >
poly NoroCache< number_type >::temp_term

Definition at line 593 of file tgb_internal.h.

◆ tempBuffer

template<class number_type >
void* NoroCache< number_type >::tempBuffer

Definition at line 708 of file tgb_internal.h.

◆ tempBufferSize

template<class number_type >
size_t NoroCache< number_type >::tempBufferSize

Definition at line 709 of file tgb_internal.h.


The documentation for this class was generated from the following file: