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 587 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 747 of file tgb_internal.h.

Constructor & Destructor Documentation

◆ NoroCache()

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

Definition at line 654 of file tgb_internal.h.

655  {
656  buffer=NULL;
657 #ifdef NORO_RED_ARRAY_RESERVER
658  reserved=0;
659  recursionPolyBuffer=(poly*)omAlloc(1000000*sizeof(poly));
660 #endif
663  temp_term=pOne();
664  tempBufferSize=3000;
666  }
number * buffer
Definition: tgb_internal.h:752
#define omAlloc(size)
Definition: omAllocDecl.h:210
void * tempBuffer
Definition: tgb_internal.h:705
#define pOne()
Definition: polys.h:297
size_t tempBufferSize
Definition: tgb_internal.h:706
poly temp_term
Definition: tgb_internal.h:590
#define NULL
Definition: omList.c:10
int nReducibleMonomials
Definition: tgb_internal.h:704
int nIrreducibleMonomials
Definition: tgb_internal.h:703
polyrec * poly
Definition: hilb.h:10

◆ ~NoroCache()

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

Definition at line 688 of file tgb_internal.h.

689  {
690  int s=ressources.size();
691  int i;
692  for(i=0;i<s;i++)
693  {
694  p_Delete(&ressources[i].impl,currRing);
695  }
697 #ifdef NORO_RED_ARRAY_RESERVER
698  omfree(recursionPolyBuffer);
699 #endif
701  }
const CanonicalForm int s
Definition: facAbsFact.cc:55
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
void * tempBuffer
Definition: tgb_internal.h:705
#define omFree(addr)
Definition: omAllocDecl.h:261
#define omfree(addr)
Definition: omAllocDecl.h:237
int i
Definition: cfEzgcd.cc:123
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
poly temp_term
Definition: tgb_internal.h:590
poly_vec ressources
Definition: tgb_internal.h:748

Member Function Documentation

◆ collectIrreducibleMonomials() [1/2]

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

Definition at line 1895 of file tgb_internal.h.

1895  {
1896  int i;
1897  for(i=0;i<root.branches_len;i++){
1899  }
1900 }
void collectIrreducibleMonomials(std::vector< DataNoroCacheNode< number_type > * > &res)
NoroCacheNode root
Definition: tgb_internal.h:751
poly res
Definition: myNF.cc:322
int i
Definition: cfEzgcd.cc:123
NoroCacheNode ** branches
Definition: tgb_internal.h:432

◆ collectIrreducibleMonomials() [2/2]

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

Definition at line 1901 of file tgb_internal.h.

1901  {
1902  assume(level>=0);
1903  if (node==NULL) return;
1904  if (level<(currRing->N))
1905  {
1906  int i;
1907  for(i=0;i<node->branches_len;i++)
1908  {
1910  }
1911  }
1912  else
1913  {
1915  if (dn->value_len==backLinkCode)
1916  {
1917  res.push_back(dn);
1918  }
1919  }
1920 }
int level(const CanonicalForm &f)
void collectIrreducibleMonomials(std::vector< DataNoroCacheNode< number_type > * > &res)
poly res
Definition: myNF.cc:322
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define assume(x)
Definition: mod2.h:394
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
static const int backLinkCode
Definition: tgb_internal.h:603
NoroCacheNode ** branches
Definition: tgb_internal.h:432

◆ ensureTempBufferSize()

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

Definition at line 667 of file tgb_internal.h.

668  {
669  if (tempBufferSize<size)
670  {
674  }
675  }
#define omAlloc(size)
Definition: omAllocDecl.h:210
void * tempBuffer
Definition: tgb_internal.h:705
#define omFree(addr)
Definition: omAllocDecl.h:261
int size(const CanonicalForm &f, const Variable &v)
int size ( const CanonicalForm & f, const Variable & v )
Definition: cf_ops.cc:600
size_t tempBufferSize
Definition: tgb_internal.h:706

◆ getCacheReference()

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

Definition at line 1922 of file tgb_internal.h.

1922  {
1923  int i;
1924  NoroCacheNode* parent=&root;
1925  for(i=1;i<(currRing->N);i++){
1926  parent=parent->getBranch(p_GetExp(term,i,currRing));
1927  if (!(parent)){
1928  return NULL;
1929  }
1930  }
1932  return res_holder;
1933 }
Definition: int_poly.h:33
NoroCacheNode root
Definition: tgb_internal.h:751
NoroCacheNode * getBranch(int branch)
Definition: tgb_internal.h:473
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10

◆ insert() [1/2]

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

Definition at line 604 of file tgb_internal.h.

605  {
606  //assume(impl.find(p_Copy(term,currRing))==impl.end());
607  //assume(len==pLength(nf));
609  if (term==nf)
610  {
612 
613  ressources.push_back(term);
615  return treeInsertBackLink(term);
616 
617  }
618  else
619  {
620  if (nf)
621  {
622  //nf=p_Copy(nf,currRing);
623  assume(p_LmCmp(nf,term,currRing)==-1);
624  ressources.push_back(nf);
625  }
626  return treeInsert(term,nf,len);
627 
628  }
629 
630  //impl[term]=std::pair<PolySimple,int> (nf,len);
631  }
DataNoroCacheNode< number_type > * treeInsert(poly term, poly nf, int len)
Definition: tgb_internal.h:708
Definition: int_poly.h:33
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
Definition: gnumpfl.cc:27
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
DataNoroCacheNode< number_type > * treeInsertBackLink(poly term)
Definition: tgb_internal.h:734
#define assume(x)
Definition: mod2.h:394
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1467
poly_vec ressources
Definition: tgb_internal.h:748
#define p_GetCoeff(p, r)
Definition: monomials.h:57
int nIrreducibleMonomials
Definition: tgb_internal.h:703
#define npIsOne
Definition: tgb_internal.h:77

◆ insert() [2/2]

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

Definition at line 633 of file tgb_internal.h.

634  {
635  //assume(impl.find(p_Copy(term,currRing))==impl.end());
636  //assume(len==pLength(nf));
637 
638  return treeInsert(term,srow);
639 
640 
641  //impl[term]=std::pair<PolySimple,int> (nf,len);
642  }
DataNoroCacheNode< number_type > * treeInsert(poly term, poly nf, int len)
Definition: tgb_internal.h:708
Definition: int_poly.h:33

◆ insertAndTransferOwnerShip()

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

Definition at line 644 of file tgb_internal.h.

645  {
646  ressources.push_back(t);
648  res->term_index=nIrreducibleMonomials;
650  return res;
651  }
poly res
Definition: myNF.cc:322
DataNoroCacheNode< number_type > * treeInsertBackLink(poly term)
Definition: tgb_internal.h:734
poly_vec ressources
Definition: tgb_internal.h:748
int nIrreducibleMonomials
Definition: tgb_internal.h:703

◆ lookup()

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

Definition at line 1934 of file tgb_internal.h.

1934  {
1935  int i;
1936  NoroCacheNode* parent=&root;
1937  for(i=1;i<(currRing->N);i++){
1938  parent=parent->getBranch(p_GetExp(term,i,currRing));
1939  if (!(parent)){
1940  succ=FALSE;
1941  return NULL;
1942  }
1943  }
1945  if (res_holder){
1946  succ=TRUE;
1947  if ( /*(*/ res_holder->value_len==backLinkCode /*)*/ ){
1948  len=1;
1949  return term;
1950  }
1951  len=res_holder->value_len;
1952  return res_holder->value_poly;
1953  } else {
1954  succ=FALSE;
1955  return NULL;
1956  }
1957 }
Definition: int_poly.h:33
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
NoroCacheNode root
Definition: tgb_internal.h:751
NoroCacheNode * getBranch(int branch)
Definition: tgb_internal.h:473
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
static const int backLinkCode
Definition: tgb_internal.h:603

◆ treeInsert() [1/2]

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

Definition at line 708 of file tgb_internal.h.

709  {
710  int i;
712  int nvars=(currRing->N);
713  NoroCacheNode* parent=&root;
714  for(i=1;i<nvars;i++)
715  {
716  parent=parent->getOrInsertBranch(p_GetExp(term,i,currRing));
717  }
719  }
NoroCacheNode * setNode(int branch, NoroCacheNode *node)
Definition: tgb_internal.h:442
Definition: int_poly.h:33
NoroCacheNode root
Definition: tgb_internal.h:751
Definition: gnumpfl.cc:27
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
int i
Definition: cfEzgcd.cc:123
NoroCacheNode * getOrInsertBranch(int branch)
Definition: tgb_internal.h:487
int nReducibleMonomials
Definition: tgb_internal.h:704

◆ treeInsert() [2/2]

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

Definition at line 721 of file tgb_internal.h.

722  {
723  int i;
725  int nvars=(currRing->N);
726  NoroCacheNode* parent=&root;
727  for(i=1;i<nvars;i++)
728  {
729  parent=parent->getOrInsertBranch(p_GetExp(term,i,currRing));
730  }
732  }
NoroCacheNode * setNode(int branch, NoroCacheNode *node)
Definition: tgb_internal.h:442
Definition: int_poly.h:33
NoroCacheNode root
Definition: tgb_internal.h:751
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
int i
Definition: cfEzgcd.cc:123
NoroCacheNode * getOrInsertBranch(int branch)
Definition: tgb_internal.h:487
int nReducibleMonomials
Definition: tgb_internal.h:704

◆ treeInsertBackLink()

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

Definition at line 734 of file tgb_internal.h.

735  {
736  int i;
737  int nvars=(currRing->N);
738  NoroCacheNode* parent=&root;
739  for(i=1;i<nvars;i++)
740  {
741  parent=parent->getOrInsertBranch(p_GetExp(term,i,currRing));
742  }
744  }
NoroCacheNode * setNode(int branch, NoroCacheNode *node)
Definition: tgb_internal.h:442
Definition: int_poly.h:33
NoroCacheNode root
Definition: tgb_internal.h:751
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
int i
Definition: cfEzgcd.cc:123
NoroCacheNode * getOrInsertBranch(int branch)
Definition: tgb_internal.h:487
static const int backLinkCode
Definition: tgb_internal.h:603

Field Documentation

◆ backLinkCode

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

Definition at line 603 of file tgb_internal.h.

◆ buffer

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

Definition at line 752 of file tgb_internal.h.

◆ nIrreducibleMonomials

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

Definition at line 703 of file tgb_internal.h.

◆ nReducibleMonomials

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

Definition at line 704 of file tgb_internal.h.

◆ ressources

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

Definition at line 748 of file tgb_internal.h.

◆ root

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

Definition at line 751 of file tgb_internal.h.

◆ temp_term

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

Definition at line 590 of file tgb_internal.h.

◆ tempBuffer

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

Definition at line 705 of file tgb_internal.h.

◆ tempBufferSize

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

Definition at line 706 of file tgb_internal.h.


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