Loading...
Searching...
No Matches
pointSet Class Reference

## Public Member Functions

| pointSet (const int _dim, const int _index=0, const int count=MAXINITELEMS)
| ~pointSet ()
onePointP | operator[] (const int index)
bool | addPoint (const onePointP vert)
| Adds a point to pointSet, copy vert[0,...,dim] to point[num+1][0,...,dim].
bool | addPoint (const int *vert)
| Adds a point to pointSet, copy vert[0,...,dim] to point[num+1][0,...,dim].
bool | addPoint (const Coord_t *vert)
| Adds a point to pointSet, copy vert[0,...,dim] to point[num+1][0,...,dim].
bool | removePoint (const int indx)
bool | mergeWithExp (const onePointP vert)
| Adds point to pointSet, iff pointSet \cap point = \emptyset.
bool | mergeWithExp (const int *vert)
| Adds point to pointSet, iff pointSet \cap point = \emptyset.
void | mergeWithPoly (const poly p)
void | getRowMP (const int indx, int *vert)
int | getExpPos (const poly p)
void | sort ()
| sort lex
void | lift (int *l=NULL)
| Lifts the point set using sufficiently generic linear lifting homogeneous forms l[1]..l[dim] in Z.
void | unlift ()

## Data Fields

int | num
int | max
int | dim
int | index

## Private Member Functions

| pointSet (const pointSet &)
bool | smaller (int, int)
| points[a] < points[b] ?
bool | larger (int, int)
| points[a] > points[b] ?
bool | checkMem ()
| Checks, if more mem is needed ( i.e.

## Private Attributes

onePointP * | points
bool | lifted

## Detailed Description

Definition at line 160 of file mpr_base.cc.

## Constructor & Destructor Documentation

## pointSet() [1/2]

pointSet::pointSet | ( | const int | _dim,
|  | const int | _index = 0,
|  | const int | count = MAXINITELEMS )

Definition at line 412 of file mpr_base.cc.

: num(0), max(count), dim(_dim), index(_index)
{
int i;
points = (onePointP *)omAlloc( (count+1) * sizeof(onePointP) );
for ( i= 0; i <= max; i++ )
{
points[i]= (onePointP)omAlloc( sizeof(onePoint) );
points[i]->point= (Coord_t *)omAlloc0( (dim+2) * sizeof(Coord_t) );
}
lifted= false;
}
i
int i
Definition cfEzgcd.cc:132
pointSet::lifted
bool lifted
Definition mpr_base.cc:164
pointSet::num
int num
Definition mpr_base.cc:167
pointSet::dim
int dim
Definition mpr_base.cc:169
pointSet::index
int index
Definition mpr_base.cc:170
pointSet::points
onePointP * points
Definition mpr_base.cc:163
pointSet::max
int max
Definition mpr_base.cc:168
Coord_t
unsigned int Coord_t
Definition mpr_base.cc:131
omAlloc
#define omAlloc(size)
Definition omAllocDecl.h:210
omAlloc0
#define omAlloc0(size)
Definition omAllocDecl.h:211
count
int status int void size_t count
Definition si_signals.h:69

## ~pointSet()

pointSet::~pointSet | ( |  | ) |

Definition at line 425 of file mpr_base.cc.

{
int i;
int fdim= lifted ? dim+1 : dim+2;
for ( i= 0; i <= max; i++ )
{
omFreeSize( (void *) points[i]->point, fdim * sizeof(Coord_t) );
omFreeSize( (void *) points[i], sizeof(onePoint) );
}
omFreeSize( (void *) points, (max+1) * sizeof(onePointP) );
}
omFreeSize
#define omFreeSize(addr, size)
Definition omAllocDecl.h:260

## pointSet() [2/2]

pointSet::pointSet | ( | const pointSet & |  | ) |

private

## Member Function Documentation

## addPoint() [1/3]

bool pointSet::addPoint | ( | const Coord_t * | vert | ) |

Adds a point to pointSet, copy vert[0,...,dim] to point[num+1][0,...,dim].

Returns false, iff additional memory was allocated ( i.e. num >= max ) else returns true

Definition at line 486 of file mpr_base.cc.

{
int i;
bool ret;
num++;
ret= checkMem();
points[num]->rcPnt= NULL;
for ( i= 0; i < dim; i++ ) points[num]->point[i+1]= vert[i];
return ret;
}
pointSet::checkMem
bool checkMem()
Checks, if more mem is needed ( i.e.
Definition mpr_base.cc:443
NULL
#define NULL
Definition omList.c:12

## addPoint() [2/3]

bool pointSet::addPoint | ( | const int * | vert | ) |

Adds a point to pointSet, copy vert[0,...,dim] to point[num+1][0,...,dim].

Returns false, iff additional memory was allocated ( i.e. num >= max ) else returns true

Definition at line 475 of file mpr_base.cc.

{
int i;
bool ret;
num++;
ret= checkMem();
points[num]->rcPnt= NULL;
for ( i= 1; i <= dim; i++ ) points[num]->point[i]= (Coord_t) vert[i];
return ret;
}

## addPoint() [3/3]

bool pointSet::addPoint | ( | const onePointP | vert | ) |

Adds a point to pointSet, copy vert[0,...,dim] to point[num+1][0,...,dim].

Returns false, iff additional memory was allocated ( i.e. num >= max ) else returns true

Definition at line 464 of file mpr_base.cc.

{
int i;
bool ret;
num++;
ret= checkMem();
points[num]->rcPnt= NULL;
for ( i= 1; i <= dim; i++ ) points[num]->point[i]= vert->point[i];
return ret;
}

## checkMem()

bool pointSet::checkMem | ( |  | ) |

inline private

Checks, if more mem is needed ( i.e.

num >= max ), returns false, if more mem was allocated, else true

Definition at line 443 of file mpr_base.cc.

{
if ( num >= max )
{
int i;
int fdim= lifted ? dim+1 : dim+2;
points= (onePointP*)omReallocSize( points,
(max+1) * sizeof(onePointP),
(2*max + 1) * sizeof(onePointP) );
for ( i= max+1; i <= max*2; i++ )
{
points[i]= (onePointP)omAlloc( sizeof(struct onePoint) );
points[i]->point= (Coord_t *)omAlloc0( fdim * sizeof(Coord_t) );
}
max*= 2;
mprSTICKYPROT(ST_SPARSE_MEM);
return false;
}
return true;
}
mprSTICKYPROT
#define mprSTICKYPROT(msg)
Definition mpr_global.h:54
ST_SPARSE_MEM
#define ST_SPARSE_MEM
Definition mpr_global.h:69
omReallocSize
#define omReallocSize(addr, o_size, size)
Definition omAllocDecl.h:220

## getExpPos()

int pointSet::getExpPos | ( | const poly | p | ) |

Definition at line 578 of file mpr_base.cc.

{
int * vert;
int i,j;
// hier unschoen...
vert= (int *)omAlloc( (dim+1) * sizeof(int) );
p_GetExpV( p, vert, currRing );
for ( i= 1; i <= num; i++ )
{
for ( j= 1; j <= dim; j++ )
if ( points[i]->point[j] != (Coord_t) vert[j] ) break;
if ( j > dim ) break;
}
omFreeSize( (void *) vert, (dim+1) * sizeof(int) );
if ( i > num ) return 0;
else return i;
}
p
int p
Definition cfModGcd.cc:4086
j
int j
Definition facHensel.cc:110
p_GetExpV
static void p_GetExpV(poly p, int *ev, const ring r)
Definition p_polys.h:1541
currRing
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13

## getRowMP()

void pointSet::getRowMP | ( | const int | indx,
|  | int * | vert )

Definition at line 599 of file mpr_base.cc.

{
assume( indx > 0 && indx <= num && points[indx]->rcPnt );
int i;
vert[0]= 0;
for ( i= 1; i <= dim; i++ )
vert[i]= (int)(points[indx]->point[i] - points[indx]->rcPnt->point[i]);
}
assume
#define assume(x)
Definition mod2.h:389

## larger()

bool pointSet::larger | ( | int | a,
|  | int | b )

inline private

points[a] > points[b] ?

Definition at line 628 of file mpr_base.cc.

{
int i;
for ( i= 1; i <= dim; i++ )
{
if ( points[a]->point[i] < points[b]->point[i] )
{
return false;
}
if ( points[a]->point[i] > points[b]->point[i] )
{
return true;
}
}
return false; // they are equal
}
b
CanonicalForm b
Definition cfModGcd.cc:4111

## lift()

void pointSet::lift | ( | int * | l = NULL | ) |

Lifts the point set using sufficiently generic linear lifting homogeneous forms l[1]..l[dim] in Z.

Every l[i] is of the form L1x1+...+Lnxn, for generic L1..Ln in Z.

Lifting raises dimension by one!

Definition at line 670 of file mpr_base.cc.

{
bool outerL= true;
int i, j;
int sum;
dim++;
if ( l==NULL )
{
outerL= false;
l= (int *)omAlloc( (dim+1) * sizeof(int) ); // [1..dim-1]
for(i = 1; i < dim; i++)
{
l[i]= 1 + siRand() % LIFT_COOR;
}
}
for ( j=1; j <= num; j++ )
{
sum= 0;
for ( i=1; i < dim; i++ )
{
sum += (int)points[j]->point[i] * l[i];
}
points[j]->point[dim]= sum;
}
#ifdef mprDEBUG_ALL
PrintS(" lift vector: ");
for ( j=1; j < dim; j++ ) Print(" %d ",l[j] );
PrintLn();
#ifdef mprDEBUG_ALL
PrintS(" lifted points: \n");
for ( j=1; j <= num; j++ )
{
Print("%d: <",j);print_exp(points[j],dim);PrintS(">\n");
}
PrintLn();
#endif
#endif
lifted= true;
if ( !outerL ) omFreeSize( (void *) l, (dim+1) * sizeof(int) );
}
l
int l
Definition cfEzgcd.cc:100
Print
#define Print
Definition emacs.cc:80
LIFT_COOR
#define LIFT_COOR
Definition mpr_base.cc:50
PrintS
void PrintS(const char *s)
Definition reporter.cc:288
PrintLn
void PrintLn()
Definition reporter.cc:314
siRand
int siRand()
Definition sirandom.c:42

## mergeWithExp() [1/2]

bool pointSet::mergeWithExp | ( | const int * | vert | ) |

Adds point to pointSet, iff pointSet \cap point = \emptyset.

Returns true, iff added, else false.

Definition at line 531 of file mpr_base.cc.

{
int i,j;
for ( i= 1; i <= num; i++ )
{
for ( j= 1; j <= dim; j++ )
if ( points[i]->point[j] != (Coord_t) vert[j] ) break;
if ( j > dim ) break;
}
if ( i > num )
{
addPoint( vert );
return true;
}
return false;
}
pointSet::addPoint
bool addPoint(const onePointP vert)
Adds a point to pointSet, copy vert[0,...,dim] to point[num+1][0,...,dim].
Definition mpr_base.cc:464

## mergeWithExp() [2/2]

bool pointSet::mergeWithExp | ( | const onePointP | vert | ) |

Adds point to pointSet, iff pointSet \cap point = \emptyset.

Returns true, iff added, else false.

Definition at line 512 of file mpr_base.cc.

{
int i,j;
for ( i= 1; i <= num; i++ )
{
for ( j= 1; j <= dim; j++ )
if ( points[i]->point[j] != vert->point[j] ) break;
if ( j > dim ) break;
}
if ( i > num )
{
addPoint( vert );
return true;
}
return false;
}

## mergeWithPoly()

void pointSet::mergeWithPoly | ( | const poly | p | ) |

Definition at line 550 of file mpr_base.cc.

{
int i,j;
poly piter= p;
int * vert;
vert= (int *)omAlloc( (dim+1) * sizeof(int) );
while ( piter )
{
p_GetExpV( piter, vert, currRing );
for ( i= 1; i <= num; i++ )
{
for ( j= 1; j <= dim; j++ )
if ( points[i]->point[j] != (Coord_t) vert[j] ) break;
if ( j > dim ) break;
}
if ( i > num )
{
addPoint( vert );
}
pIter( piter );
}
omFreeSize( (void *) vert, (dim+1) * sizeof(int) );
}
pIter
#define pIter(p)
Definition monomials.h:37

## operator[]()

onePointP pointSet::operator[] | ( | const int | index | ) |

inline

Definition at line 437 of file mpr_base.cc.

{
assume( index_i > 0 && index_i <= num );
return points[index_i];
}

## removePoint()

bool pointSet::removePoint | ( | const int | indx | ) |

Definition at line 497 of file mpr_base.cc.

{
assume( indx > 0 && indx <= num );
if ( indx != num )
{
onePointP tmp;
tmp= points[indx];
points[indx]= points[num];
points[num]= tmp;
}
num--;
return true;
}

## smaller()

bool pointSet::smaller | ( | int | a,
|  | int | b )

inline private

points[a] < points[b] ?

Definition at line 609 of file mpr_base.cc.

{
int i;
for ( i= 1; i <= dim; i++ )
{
if ( points[a]->point[i] > points[b]->point[i] )
{
return false;
}
if ( points[a]->point[i] < points[b]->point[i] )
{
return true;
}
}
return false; // they are equal
}

## sort()

void pointSet::sort | ( |  | ) |

sort lex

Definition at line 647 of file mpr_base.cc.

{
int i;
bool found= true;
onePointP tmp;
while ( found )
{
found= false;
for ( i= 1; i < num; i++ )
{
if ( larger( i, i+1 ) )
{
tmp= points[i];
points[i]= points[i+1];
points[i+1]= tmp;
found= true;
}
}
}
}
pointSet::larger
bool larger(int, int)
points[a] > points[b] ?
Definition mpr_base.cc:628
found
bool found
Definition facFactorize.cc:55

## unlift()

void pointSet::unlift | ( |  | ) |

inline

Definition at line 229 of file mpr_base.cc.

{ dim--; lifted= false; }

## Field Documentation

## dim

int pointSet::dim

Definition at line 169 of file mpr_base.cc.

## index

int pointSet::index

Definition at line 170 of file mpr_base.cc.

## lifted

bool pointSet::lifted

private

Definition at line 164 of file mpr_base.cc.

## max

int pointSet::max

Definition at line 168 of file mpr_base.cc.

## num

int pointSet::num

Definition at line 167 of file mpr_base.cc.

## points

onePointP* pointSet::points

private

Definition at line 163 of file mpr_base.cc.

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

- kernel/numeric/mpr_base.cc