My Project  debian-1:4.1.1-p2+ds-4build2
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 586 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 746 of file tgb_internal.h.

Constructor & Destructor Documentation

◆ NoroCache()

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

Definition at line 653 of file tgb_internal.h.

654  {
655  buffer=NULL;
656 #ifdef NORO_RED_ARRAY_RESERVER
657  reserved=0;
658  recursionPolyBuffer=(poly*)omAlloc(1000000*sizeof(poly));
659 #endif
662  temp_term=pOne();
663  tempBufferSize=3000;
665  }

◆ ~NoroCache()

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

Definition at line 687 of file tgb_internal.h.

688  {
689  int s=ressources.size();
690  int i;
691  for(i=0;i<s;i++)
692  {
693  p_Delete(&ressources[i].impl,currRing);
694  }
696 #ifdef NORO_RED_ARRAY_RESERVER
697  omfree(recursionPolyBuffer);
698 #endif
700  }

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

1908  {
1909  assume(level>=0);
1910  if (node==NULL) return;
1911  if (level<(currRing->N))
1912  {
1913  int i;
1914  for(i=0;i<node->branches_len;i++)
1915  {
1917  }
1918  }
1919  else
1920  {
1922  if (dn->value_len==backLinkCode)
1923  {
1924  res.push_back(dn);
1925  }
1926  }
1927 }

◆ collectIrreducibleMonomials() [2/2]

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

Definition at line 1902 of file tgb_internal.h.

1902  {
1903  int i;
1904  for(i=0;i<root.branches_len;i++){
1906  }
1907 }

◆ ensureTempBufferSize()

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

Definition at line 666 of file tgb_internal.h.

667  {
668  if (tempBufferSize<size)
669  {
673  }
674  }

◆ getCacheReference()

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

Definition at line 1929 of file tgb_internal.h.

1929  {
1930  int i;
1931  NoroCacheNode* parent=&root;
1932  for(i=1;i<(currRing->N);i++){
1933  parent=parent->getBranch(p_GetExp(term,i,currRing));
1934  if (!(parent)){
1935  return NULL;
1936  }
1937  }
1939  return res_holder;
1940 }

◆ insert() [1/2]

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

Definition at line 603 of file tgb_internal.h.

604  {
605  //assume(impl.find(p_Copy(term,currRing))==impl.end());
606  //assume(len==pLength(nf));
608  if (term==nf)
609  {
611 
612  ressources.push_back(term);
614  return treeInsertBackLink(term);
615 
616  }
617  else
618  {
619  if (nf)
620  {
621  //nf=p_Copy(nf,currRing);
622  assume(p_LmCmp(nf,term,currRing)==-1);
623  ressources.push_back(nf);
624  }
625  return treeInsert(term,nf,len);
626 
627  }
628 
629  //impl[term]=std::pair<PolySimple,int> (nf,len);
630  }

◆ insert() [2/2]

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

Definition at line 632 of file tgb_internal.h.

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

◆ insertAndTransferOwnerShip()

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

Definition at line 643 of file tgb_internal.h.

644  {
645  ressources.push_back(t);
647  res->term_index=nIrreducibleMonomials;
649  return res;
650  }

◆ lookup()

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

Definition at line 1941 of file tgb_internal.h.

1941  {
1942  int i;
1943  NoroCacheNode* parent=&root;
1944  for(i=1;i<(currRing->N);i++){
1945  parent=parent->getBranch(p_GetExp(term,i,currRing));
1946  if (!(parent)){
1947  succ=FALSE;
1948  return NULL;
1949  }
1950  }
1952  if (res_holder){
1953  succ=TRUE;
1954  if ( /*(*/ res_holder->value_len==backLinkCode /*)*/ ){
1955  len=1;
1956  return term;
1957  }
1958  len=res_holder->value_len;
1959  return res_holder->value_poly;
1960  } else {
1961  succ=FALSE;
1962  return NULL;
1963  }
1964 }

◆ treeInsert() [1/2]

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

Definition at line 707 of file tgb_internal.h.

708  {
709  int i;
711  int nvars=(currRing->N);
712  NoroCacheNode* parent=&root;
713  for(i=1;i<nvars;i++)
714  {
715  parent=parent->getOrInsertBranch(p_GetExp(term,i,currRing));
716  }
718  }

◆ treeInsert() [2/2]

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

Definition at line 720 of file tgb_internal.h.

721  {
722  int i;
724  int nvars=(currRing->N);
725  NoroCacheNode* parent=&root;
726  for(i=1;i<nvars;i++)
727  {
728  parent=parent->getOrInsertBranch(p_GetExp(term,i,currRing));
729  }
731  }

◆ treeInsertBackLink()

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

Definition at line 733 of file tgb_internal.h.

734  {
735  int i;
736  int nvars=(currRing->N);
737  NoroCacheNode* parent=&root;
738  for(i=1;i<nvars;i++)
739  {
740  parent=parent->getOrInsertBranch(p_GetExp(term,i,currRing));
741  }
743  }

Field Documentation

◆ backLinkCode

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

Definition at line 602 of file tgb_internal.h.

◆ buffer

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

Definition at line 751 of file tgb_internal.h.

◆ nIrreducibleMonomials

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

Definition at line 702 of file tgb_internal.h.

◆ nReducibleMonomials

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

Definition at line 703 of file tgb_internal.h.

◆ ressources

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

Definition at line 747 of file tgb_internal.h.

◆ root

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

Definition at line 750 of file tgb_internal.h.

◆ temp_term

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

Definition at line 589 of file tgb_internal.h.

◆ tempBuffer

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

Definition at line 704 of file tgb_internal.h.

◆ tempBufferSize

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

Definition at line 705 of file tgb_internal.h.


The documentation for this class was generated from the following file:
FALSE
#define FALSE
Definition: auxiliary.h:94
NoroCache::treeInsert
DataNoroCacheNode< number_type > * treeInsert(poly term, poly nf, int len)
Definition: tgb_internal.h:707
p_GetCoeff
#define p_GetCoeff(p, r)
Definition: monomials.h:57
p_GetExp
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:469
omFree
#define omFree(addr)
Definition: omAllocDecl.h:261
NoroCacheNode::setNode
NoroCacheNode * setNode(int branch, NoroCacheNode *node)
Definition: tgb_internal.h:441
NoroCache::nIrreducibleMonomials
int nIrreducibleMonomials
Definition: tgb_internal.h:702
NoroCacheNode
Definition: tgb_internal.h:428
level
int level(const CanonicalForm &f)
Definition: canonicalform.h:324
NoroCache::backLinkCode
static const int backLinkCode
Definition: tgb_internal.h:602
nf
Definition: gnumpfl.cc:27
term
Definition: int_poly.h:33
NoroCache::buffer
number * buffer
Definition: tgb_internal.h:751
NoroCacheNode::branches_len
int branches_len
Definition: tgb_internal.h:432
p_Copy
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:812
currRing
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
TRUE
#define TRUE
Definition: auxiliary.h:98
i
int i
Definition: cfEzgcd.cc:125
res
CanonicalForm res
Definition: facAbsFact.cc:64
NoroCache::tempBuffer
void * tempBuffer
Definition: tgb_internal.h:704
NoroCache::tempBufferSize
size_t tempBufferSize
Definition: tgb_internal.h:705
size
int size(const CanonicalForm &f, const Variable &v)
int size ( const CanonicalForm & f, const Variable & v )
Definition: cf_ops.cc:600
pOne
#define pOne()
Definition: polys.h:301
NoroCache::root
NoroCacheNode root
Definition: tgb_internal.h:750
DataNoroCacheNode::value_poly
poly value_poly
Definition: tgb_internal.h:547
omAlloc
#define omAlloc(size)
Definition: omAllocDecl.h:210
DataNoroCacheNode
Definition: tgb_internal.h:122
p_LmCmp
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1507
NoroCacheNode::getOrInsertBranch
NoroCacheNode * getOrInsertBranch(int branch)
Definition: tgb_internal.h:486
p_Delete
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:857
DataNoroCacheNode::value_len
int value_len
Definition: tgb_internal.h:546
npIsOne
#define npIsOne
Definition: tgb_internal.h:76
NoroCacheNode::getBranch
NoroCacheNode * getBranch(int branch)
Definition: tgb_internal.h:472
NoroCache::collectIrreducibleMonomials
void collectIrreducibleMonomials(std::vector< DataNoroCacheNode< number_type > * > &res)
Definition: tgb_internal.h:1902
NoroCache::treeInsertBackLink
DataNoroCacheNode< number_type > * treeInsertBackLink(poly term)
Definition: tgb_internal.h:733
NoroCache::nReducibleMonomials
int nReducibleMonomials
Definition: tgb_internal.h:703
assume
#define assume(x)
Definition: mod2.h:390
NULL
#define NULL
Definition: omList.c:10
s
const CanonicalForm int s
Definition: facAbsFact.cc:55
NoroCache::ressources
poly_vec ressources
Definition: tgb_internal.h:747
NoroCache::temp_term
poly temp_term
Definition: tgb_internal.h:589
NoroCacheNode::branches
NoroCacheNode ** branches
Definition: tgb_internal.h:431
omfree
#define omfree(addr)
Definition: omAllocDecl.h:237