Loading...
Searching...
No Matches
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< PolySimple > | poly_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.

{
buffer=NULL;
#ifdef NORO_RED_ARRAY_RESERVER
reserved=0;
recursionPolyBuffer=(poly*)omAlloc(1000000*sizeof(poly));
#endif
nIrreducibleMonomials=0;
nReducibleMonomials=0;
temp_term=pOne();
tempBufferSize=3000;
tempBuffer=omAlloc(tempBufferSize);
}
NoroCache
Definition tgb_internal.h:573
NoroCache::nIrreducibleMonomials
int nIrreducibleMonomials
Definition tgb_internal.h:688
NoroCache::temp_term
poly temp_term
Definition tgb_internal.h:575
NoroCache::tempBuffer
void * tempBuffer
Definition tgb_internal.h:690
NoroCache::buffer
number * buffer
Definition tgb_internal.h:737
NoroCache::tempBufferSize
size_t tempBufferSize
Definition tgb_internal.h:691
NoroCache::nReducibleMonomials
int nReducibleMonomials
Definition tgb_internal.h:689
omAlloc
#define omAlloc(size)
Definition omAllocDecl.h:210
pOne
#define pOne()
Definition polys.h:316

## ~NoroCache()

template<class number_type>

NoroCache< number_type >::~NoroCache | ( |  | ) |

inline

Definition at line 673 of file tgb_internal.h.

{
int s=ressources.size();
int i;
for(i=0;i<s;i++)
{
p_Delete(&ressources[i].impl,currRing);
}
p_Delete(&temp_term,currRing);
#ifdef NORO_RED_ARRAY_RESERVER
omfree(recursionPolyBuffer);
#endif
omFree(tempBuffer);
}
NoroCache::ressources
poly_vec ressources
Definition tgb_internal.h:733
omfree
#define omfree(addr)
Definition omAllocDecl.h:237
omFree
#define omFree(addr)
Definition omAllocDecl.h:261
p_Delete
static void p_Delete(poly *p, const ring r)
Definition p_polys.h:903

## 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.

{
assume(level>=0);
if (node==NULL) return;
if (level<(currRing->N))
{
int i;
for(i=0;i<node->branches_len;i++)
{
collectIrreducibleMonomials(level+1,node->branches[i],res);
}
}
else
{
DataNoroCacheNode<number_type>* dn=(DataNoroCacheNode<number_type>*) node;
if (dn->value_len==backLinkCode)
{
res.push_back(dn);
}
}
}
NoroCache::collectIrreducibleMonomials
void collectIrreducibleMonomials(std::vector< DataNoroCacheNode< number_type > * > &res)
Definition tgb_internal.h:1979
NoroCache::backLinkCode
static const int backLinkCode
Definition tgb_internal.h:588
assume
#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.

{
int i;
for(i=0;i<root.branches_len;i++)
{
collectIrreducibleMonomials(1,root.branches[i],res);
}
}
NoroCache::root
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.

{
if (tempBufferSize<size)
{
tempBufferSize=2*size;
omFree(tempBuffer);
tempBuffer=omAlloc(tempBufferSize);
}
}

## getCacheReference()

template<class number_type>

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

Definition at line 2009 of file tgb_internal.h.

{
int i;
NoroCacheNode* parent=&root;
for(i=1;i<(currRing->N);i++)
{
parent=parent->getBranch(p_GetExp(term,i,currRing));
if (!(parent))
{
return NULL;
}
}
DataNoroCacheNode<number_type>* res_holder=(DataNoroCacheNode<number_type>*) parent->getBranch(p_GetExp(term,i,currRing));
return res_holder;
}
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:471

## 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.

{
//assume(impl.find(p_Copy(term,currRing))==impl.end());
//assume(len==pLength(nf));
assume(npIsOne(p_GetCoeff(term,currRing),currRing->cf));
if (term==nf)
{
term=p_Copy(term,currRing);
ressources.push_back(term);
nIrreducibleMonomials++;
return treeInsertBackLink(term);
}
else
{
if (nf)
{
//nf=p_Copy(nf,currRing);
assume(p_LmCmp(nf,term,currRing)==-1);
ressources.push_back(nf);
}
return treeInsert(term,nf,len);
}
//impl[term]=std::pair<PolySimple,int> (nf,len);
}
NoroCache::treeInsert
DataNoroCacheNode< number_type > * treeInsert(poly term, poly nf, int len)
Definition tgb_internal.h:693
NoroCache::treeInsertBackLink
DataNoroCacheNode< number_type > * treeInsertBackLink(poly term)
Definition tgb_internal.h:719
npIsOne
static BOOLEAN npIsOne(number a, const coeffs)
Definition modulop.h:179
p_GetCoeff
#define p_GetCoeff(p, r)
Definition monomials.h:50
p_LmCmp
static int p_LmCmp(poly p, poly q, const ring r)
Definition p_polys.h:1601
p_Copy
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition p_polys.h:848

## 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.

{
//assume(impl.find(p_Copy(term,currRing))==impl.end());
//assume(len==pLength(nf));
return treeInsert(term,srow);
//impl[term]=std::pair<PolySimple,int> (nf,len);
}

## 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.

{
ressources.push_back(t);
DataNoroCacheNode<number_type>* res=treeInsertBackLink(t);
res->term_index=nIrreducibleMonomials;
nIrreducibleMonomials++;
return res;
}

## 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.

{
int i;
NoroCacheNode* parent=&root;
for(i=1;i<(currRing->N);i++)
{
parent=parent->getBranch(p_GetExp(term,i,currRing));
if (!(parent))
{
succ=FALSE;
return NULL;
}
}
DataNoroCacheNode<number_type>* res_holder=(DataNoroCacheNode<number_type>*) parent->getBranch(p_GetExp(term,i,currRing));
if (res_holder)
{
succ=TRUE;
if ( /*(*/ res_holder->value_len==backLinkCode /*)*/ )
{
len=1;
return term;
}
len=res_holder->value_len;
return res_holder->value_poly;
} else {
succ=FALSE;
return NULL;
}
}

## treeInsert() [1/2]

template<class number_type>

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

inline protected

Definition at line 693 of file tgb_internal.h.

{
int i;
nReducibleMonomials++;
int nvars=(currRing->N);
NoroCacheNode* parent=&root;
for(i=1;i<nvars;i++)
{
parent=parent->getOrInsertBranch(p_GetExp(term,i,currRing));
}
return (DataNoroCacheNode<number_type>*) parent->setNode(p_GetExp(term,nvars,currRing),new DataNoroCacheNode<number_type>(nf,len));
}

## treeInsert() [2/2]

template<class number_type>

DataNoroCacheNode< number_type > * NoroCache< number_type >::treeInsert | ( | poly | term,
|  | SparseRow< number_type > * | srow )

inline protected

Definition at line 706 of file tgb_internal.h.

{
int i;
nReducibleMonomials++;
int nvars=(currRing->N);
NoroCacheNode* parent=&root;
for(i=1;i<nvars;i++)
{
parent=parent->getOrInsertBranch(p_GetExp(term,i,currRing));
}
return (DataNoroCacheNode<number_type>*) parent->setNode(p_GetExp(term,nvars,currRing),new DataNoroCacheNode<number_type>(srow));
}

## treeInsertBackLink()

template<class number_type>

DataNoroCacheNode< number_type > * NoroCache< number_type >::treeInsertBackLink | ( | poly | term | ) |

inline protected

Definition at line 719 of file tgb_internal.h.

{
int i;
int nvars=(currRing->N);
NoroCacheNode* parent=&root;
for(i=1;i<nvars;i++)
{
parent=parent->getOrInsertBranch(p_GetExp(term,i,currRing));
}
return (DataNoroCacheNode<number_type>*) parent->setNode(p_GetExp(term,nvars,currRing),new DataNoroCacheNode<number_type>(term,backLinkCode));
}

## 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:

- kernel/GBEngine/tgb_internal.h