My Project
Loading...
Searching...
No Matches
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 572 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 732 of file tgb_internal.h.

Constructor & Destructor Documentation

◆ NoroCache()

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

Definition at line 639 of file tgb_internal.h.

640 {
641 buffer=NULL;
642#ifdef NORO_RED_ARRAY_RESERVER
643 reserved=0;
644 recursionPolyBuffer=(poly*)omAlloc(1000000*sizeof(poly));
645#endif
648 temp_term=pOne();
649 tempBufferSize=3000;
651 }
int nIrreducibleMonomials
Definition: tgb_internal.h:688
poly temp_term
Definition: tgb_internal.h:575
void * tempBuffer
Definition: tgb_internal.h:690
number * buffer
Definition: tgb_internal.h:737
size_t tempBufferSize
Definition: tgb_internal.h:691
int nReducibleMonomials
Definition: tgb_internal.h:689
#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 673 of file tgb_internal.h.

674 {
675 int s=ressources.size();
676 int i;
677 for(i=0;i<s;i++)
678 {
680 }
682#ifdef NORO_RED_ARRAY_RESERVER
683 omfree(recursionPolyBuffer);
684#endif
686 }
int i
Definition: cfEzgcd.cc:132
poly_vec ressources
Definition: tgb_internal.h:733
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:899
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 1987 of file tgb_internal.h.

1988{
1989 assume(level>=0);
1990 if (node==NULL) return;
1991 if (level<(currRing->N))
1992 {
1993 int i;
1994 for(i=0;i<node->branches_len;i++)
1995 {
1997 }
1998 }
1999 else
2000 {
2002 if (dn->value_len==backLinkCode)
2003 {
2004 res.push_back(dn);
2005 }
2006 }
2007}
int level(const CanonicalForm &f)
NoroCacheNode ** branches
Definition: tgb_internal.h:417
void collectIrreducibleMonomials(std::vector< DataNoroCacheNode< number_type > * > &res)
static const int backLinkCode
Definition: tgb_internal.h:588
CanonicalForm res
Definition: facAbsFact.cc:60
#define assume(x)
Definition: mod2.h:389

◆ collectIrreducibleMonomials() [2/2]

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

Definition at line 1979 of file tgb_internal.h.

1980{
1981 int i;
1982 for(i=0;i<root.branches_len;i++)
1983 {
1985 }
1986}
NoroCacheNode root
Definition: tgb_internal.h:736

◆ ensureTempBufferSize()

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

Definition at line 652 of file tgb_internal.h.

653 {
655 {
659 }
660 }
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 2009 of file tgb_internal.h.

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

◆ insert() [1/2]

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

Definition at line 589 of file tgb_internal.h.

590 {
591 //assume(impl.find(p_Copy(term,currRing))==impl.end());
592 //assume(len==pLength(nf));
594 if (term==nf)
595 {
597
598 ressources.push_back(term);
600 return treeInsertBackLink(term);
601
602 }
603 else
604 {
605 if (nf)
606 {
607 //nf=p_Copy(nf,currRing);
609 ressources.push_back(nf);
610 }
611 return treeInsert(term,nf,len);
612
613 }
614
615 //impl[term]=std::pair<PolySimple,int> (nf,len);
616 }
DataNoroCacheNode< number_type > * treeInsert(poly term, poly nf, int len)
Definition: tgb_internal.h:693
DataNoroCacheNode< number_type > * treeInsertBackLink(poly term)
Definition: tgb_internal.h:719
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:1578
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:844
Definition: gnumpfl.cc:25

◆ insert() [2/2]

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

Definition at line 618 of file tgb_internal.h.

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

◆ insertAndTransferOwnerShip()

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

Definition at line 629 of file tgb_internal.h.

630 {
631 ressources.push_back(t);
633 res->term_index=nIrreducibleMonomials;
635 return res;
636 }

◆ lookup()

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

Definition at line 2024 of file tgb_internal.h.

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

694 {
695 int i;
697 int nvars=(currRing->N);
698 NoroCacheNode* parent=&root;
699 for(i=1;i<nvars;i++)
700 {
701 parent=parent->getOrInsertBranch(p_GetExp(term,i,currRing));
702 }
704 }
NoroCacheNode * getOrInsertBranch(int branch)
Definition: tgb_internal.h:472
NoroCacheNode * setNode(int branch, NoroCacheNode *node)
Definition: tgb_internal.h:427

◆ treeInsert() [2/2]

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

Definition at line 706 of file tgb_internal.h.

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

◆ treeInsertBackLink()

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

Definition at line 719 of file tgb_internal.h.

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

Field Documentation

◆ backLinkCode

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

Definition at line 588 of file tgb_internal.h.

◆ buffer

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

Definition at line 737 of file tgb_internal.h.

◆ nIrreducibleMonomials

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

Definition at line 688 of file tgb_internal.h.

◆ nReducibleMonomials

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

Definition at line 689 of file tgb_internal.h.

◆ ressources

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

Definition at line 733 of file tgb_internal.h.

◆ root

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

Definition at line 736 of file tgb_internal.h.

◆ temp_term

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

Definition at line 575 of file tgb_internal.h.

◆ tempBuffer

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

Definition at line 690 of file tgb_internal.h.

◆ tempBufferSize

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

Definition at line 691 of file tgb_internal.h.


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