My Project
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 576 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 736 of file tgb_internal.h.

Constructor & Destructor Documentation

◆ NoroCache()

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

Definition at line 643 of file tgb_internal.h.

644  {
645  buffer=NULL;
646 #ifdef NORO_RED_ARRAY_RESERVER
647  reserved=0;
648  recursionPolyBuffer=(poly*)omAlloc(1000000*sizeof(poly));
649 #endif
652  temp_term=pOne();
653  tempBufferSize=3000;
655  }
int nIrreducibleMonomials
Definition: tgb_internal.h:692
poly temp_term
Definition: tgb_internal.h:579
void * tempBuffer
Definition: tgb_internal.h:694
number * buffer
Definition: tgb_internal.h:741
size_t tempBufferSize
Definition: tgb_internal.h:695
int nReducibleMonomials
Definition: tgb_internal.h:693
#define omAlloc(size)
Definition: omAllocDecl.h:210
#define NULL
Definition: omList.c:12
#define pOne()
Definition: polys.h:315

◆ ~NoroCache()

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

Definition at line 677 of file tgb_internal.h.

678  {
679  int s=ressources.size();
680  int i;
681  for(i=0;i<s;i++)
682  {
683  p_Delete(&ressources[i].impl,currRing);
684  }
686 #ifdef NORO_RED_ARRAY_RESERVER
687  omfree(recursionPolyBuffer);
688 #endif
690  }
int i
Definition: cfEzgcd.cc:132
poly_vec ressources
Definition: tgb_internal.h:737
const CanonicalForm int s
Definition: facAbsFact.cc:51
#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:873
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 1991 of file tgb_internal.h.

1992 {
1993  assume(level>=0);
1994  if (node==NULL) return;
1995  if (level<(currRing->N))
1996  {
1997  int i;
1998  for(i=0;i<node->branches_len;i++)
1999  {
2001  }
2002  }
2003  else
2004  {
2006  if (dn->value_len==backLinkCode)
2007  {
2008  res.push_back(dn);
2009  }
2010  }
2011 }
int level(const CanonicalForm &f)
NoroCacheNode ** branches
Definition: tgb_internal.h:421
void collectIrreducibleMonomials(std::vector< DataNoroCacheNode< number_type > * > &res)
static const int backLinkCode
Definition: tgb_internal.h:592
CanonicalForm res
Definition: facAbsFact.cc:60
#define assume(x)
Definition: mod2.h:387

◆ collectIrreducibleMonomials() [2/2]

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

Definition at line 1983 of file tgb_internal.h.

1984 {
1985  int i;
1986  for(i=0;i<root.branches_len;i++)
1987  {
1989  }
1990 }
NoroCacheNode root
Definition: tgb_internal.h:740

◆ ensureTempBufferSize()

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

Definition at line 656 of file tgb_internal.h.

657  {
658  if (tempBufferSize<size)
659  {
663  }
664  }
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 2013 of file tgb_internal.h.

2014 {
2015  int i;
2016  NoroCacheNode* parent=&root;
2017  for(i=1;i<(currRing->N);i++)
2018  {
2019  parent=parent->getBranch(p_GetExp(term,i,currRing));
2020  if (!(parent))
2021  {
2022  return NULL;
2023  }
2024  }
2026  return res_holder;
2027 }
NoroCacheNode * getBranch(int branch)
Definition: tgb_internal.h:462
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:469

◆ insert() [1/2]

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

Definition at line 593 of file tgb_internal.h.

594  {
595  //assume(impl.find(p_Copy(term,currRing))==impl.end());
596  //assume(len==pLength(nf));
598  if (term==nf)
599  {
601 
602  ressources.push_back(term);
604  return treeInsertBackLink(term);
605 
606  }
607  else
608  {
609  if (nf)
610  {
611  //nf=p_Copy(nf,currRing);
612  assume(p_LmCmp(nf,term,currRing)==-1);
613  ressources.push_back(nf);
614  }
615  return treeInsert(term,nf,len);
616 
617  }
618 
619  //impl[term]=std::pair<PolySimple,int> (nf,len);
620  }
DataNoroCacheNode< number_type > * treeInsert(poly term, poly nf, int len)
Definition: tgb_internal.h:697
DataNoroCacheNode< number_type > * treeInsertBackLink(poly term)
Definition: tgb_internal.h:723
static BOOLEAN npIsOne(number a, const coeffs)
Definition: modulop.h:179
#define p_GetCoeff(p, r)
Definition: monomials.h:50
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1552
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:818
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 622 of file tgb_internal.h.

623  {
624  //assume(impl.find(p_Copy(term,currRing))==impl.end());
625  //assume(len==pLength(nf));
626 
627  return treeInsert(term,srow);
628 
629 
630  //impl[term]=std::pair<PolySimple,int> (nf,len);
631  }

◆ insertAndTransferOwnerShip()

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

Definition at line 633 of file tgb_internal.h.

634  {
635  ressources.push_back(t);
637  res->term_index=nIrreducibleMonomials;
639  return res;
640  }

◆ lookup()

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

Definition at line 2028 of file tgb_internal.h.

2029 {
2030  int i;
2031  NoroCacheNode* parent=&root;
2032  for(i=1;i<(currRing->N);i++)
2033  {
2034  parent=parent->getBranch(p_GetExp(term,i,currRing));
2035  if (!(parent))
2036  {
2037  succ=FALSE;
2038  return NULL;
2039  }
2040  }
2042  if (res_holder)
2043  {
2044  succ=TRUE;
2045  if ( /*(*/ res_holder->value_len==backLinkCode /*)*/ )
2046  {
2047  len=1;
2048  return term;
2049  }
2050  len=res_holder->value_len;
2051  return res_holder->value_poly;
2052  } else {
2053  succ=FALSE;
2054  return NULL;
2055  }
2056 }
#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 697 of file tgb_internal.h.

698  {
699  int i;
701  int nvars=(currRing->N);
702  NoroCacheNode* parent=&root;
703  for(i=1;i<nvars;i++)
704  {
705  parent=parent->getOrInsertBranch(p_GetExp(term,i,currRing));
706  }
708  }
NoroCacheNode * getOrInsertBranch(int branch)
Definition: tgb_internal.h:476
NoroCacheNode * setNode(int branch, NoroCacheNode *node)
Definition: tgb_internal.h:431

◆ treeInsert() [2/2]

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

Definition at line 710 of file tgb_internal.h.

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

◆ treeInsertBackLink()

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

Definition at line 723 of file tgb_internal.h.

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

Field Documentation

◆ backLinkCode

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

Definition at line 592 of file tgb_internal.h.

◆ buffer

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

Definition at line 741 of file tgb_internal.h.

◆ nIrreducibleMonomials

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

Definition at line 692 of file tgb_internal.h.

◆ nReducibleMonomials

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

Definition at line 693 of file tgb_internal.h.

◆ ressources

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

Definition at line 737 of file tgb_internal.h.

◆ root

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

Definition at line 740 of file tgb_internal.h.

◆ temp_term

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

Definition at line 579 of file tgb_internal.h.

◆ tempBuffer

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

Definition at line 694 of file tgb_internal.h.

◆ tempBufferSize

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

Definition at line 695 of file tgb_internal.h.


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