Loading...
Searching...
No Matches
convexHull Class Reference

## Public Member Functions

| convexHull (simplex *_pLP)
| ~convexHull ()
pointSet ** | newtonPolytopesP (const ideal gls)
| Computes the point sets of the convex hulls of the supports given by the polynoms in gls.
ideal | newtonPolytopesI (const ideal gls)

## Private Member Functions

bool | inHull (poly p, poly pointPoly, int m, int site)
| Returns true iff the support of poly pointPoly is inside the convex hull of all points given by the support of poly p.

## Private Attributes

pointSet ** | Q
int | n
simplex * | pLP

## Detailed Description

Definition at line 249 of file mpr_base.cc.

## Constructor & Destructor Documentation

## convexHull()

convexHull::convexHull | ( | simplex * | _pLP | ) |

inline

Definition at line 252 of file mpr_base.cc.

: pLP(_pLP) {}
convexHull::pLP
simplex * pLP
Definition mpr_base.cc:271

## ~convexHull()

convexHull::~convexHull | ( |  | ) |

inline

Definition at line 253 of file mpr_base.cc.

{}

## Member Function Documentation

## inHull()

bool convexHull::inHull | ( | poly | p,
|  | poly | pointPoly,
|  | int | m,
|  | int | site )

private

Returns true iff the support of poly pointPoly is inside the convex hull of all points given by the support of poly p.

Definition at line 730 of file mpr_base.cc.

{
int i, j, col;
pLP->m = n+1;
pLP->n = m; // this includes col of cts
pLP->LiPM[1][1] = +0.0;
pLP->LiPM[1][2] = +1.0; // optimize (arbitrary) var
pLP->LiPM[2][1] = +1.0;
pLP->LiPM[2][2] = -1.0; // lambda vars sum up to 1
for ( j=3; j <= pLP->n; j++)
{
pLP->LiPM[1][j] = +0.0;
pLP->LiPM[2][j] = -1.0;
}
for( i= 1; i <= n; i++) { // each row constraints one coor
pLP->LiPM[i+2][1] = (mprfloat)pGetExp(pointPoly,i);
col = 2;
for( j= 1; j <= m; j++ )
{
if( j != site )
{
pLP->LiPM[i+2][col] = -(mprfloat)pGetExp( monomAt(p,j), i );
col++;
}
}
}
#ifdef mprDEBUG_ALL
PrintS("Matrix of Linear Programming\n");
print_mat( pLP->LiPM, pLP->m+1,pLP->n);
#endif
pLP->m3= pLP->m;
pLP->compute();
return (pLP->icase == 0);
}
m
int m
Definition cfEzgcd.cc:128
i
int i
Definition cfEzgcd.cc:132
p
int p
Definition cfModGcd.cc:4086
convexHull::n
int n
Definition mpr_base.cc:270
j
int j
Definition facHensel.cc:110
monomAt
poly monomAt(poly p, int i)
Definition mpr_base.cc:720
mprfloat
double mprfloat
Definition mpr_global.h:17
pGetExp
#define pGetExp(p, i)
Exponent.
Definition polys.h:42
PrintS
void PrintS(const char *s)
Definition reporter.cc:288

## newtonPolytopesI()

ideal convexHull::newtonPolytopesI | ( | const ideal | gls | ) |

Definition at line 834 of file mpr_base.cc.

{
int i, j;
int m; // Anzahl der Exponentvektoren im i-ten Polynom (gls->m)[i] des Ideals gls
int idelem= IDELEMS(gls);
ideal id;
poly p,pid=NULL;
int * vert;
n= (currRing->N);
vert= (int *)omAlloc( (idelem+1) * sizeof(int) );
id= idInit( idelem, 1 );
for( i= 0; i < idelem; i++ )
{
m = pLength( (gls->m)[i] );
p= (gls->m)[i];
for( j= 1; j <= m; j++) { // fuer jeden Exponentvektor
if( !inHull( (gls->m)[i], p, m, j ) )
{
if ( (id->m)[i] == NULL )
{
(id->m)[i]= pHead(p);
pid=(id->m)[i];
}
else
{
pNext(pid)= pHead(p);
pIter(pid);
//pNext(pid)= NULL;// done by pHead
}
mprSTICKYPROT(ST_SPARSE_VADD);
}
else
{
mprSTICKYPROT(ST_SPARSE_VREJ);
}
pIter( p );
} // j
mprSTICKYPROT("\n");
} // i
omFreeSize( (void *) vert, (idelem+1) * sizeof(int) );
#ifdef mprDEBUG_PROT
PrintLn();
for( i= 0; i < idelem; i++ )
{
}
#endif
return id;
}
convexHull::inHull
bool inHull(poly p, poly pointPoly, int m, int site)
Returns true iff the support of poly pointPoly is inside the convex hull of all points given by the s...
Definition mpr_base.cc:730
pIter
#define pIter(p)
Definition monomials.h:37
pNext
#define pNext(p)
Definition monomials.h:36
mprSTICKYPROT
#define mprSTICKYPROT(msg)
Definition mpr_global.h:54
ST_SPARSE_VADD
#define ST_SPARSE_VADD
Definition mpr_global.h:70
ST_SPARSE_VREJ
#define ST_SPARSE_VREJ
Definition mpr_global.h:71
omFreeSize
#define omFreeSize(addr, size)
Definition omAllocDecl.h:260
omAlloc
#define omAlloc(size)
Definition omAllocDecl.h:210
NULL
#define NULL
Definition omList.c:12
pLength
static int pLength(poly a)
Definition p_polys.h:190
currRing
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13
pHead
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
Definition polys.h:68
PrintLn
void PrintLn()
Definition reporter.cc:314
idInit
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition simpleideals.cc:35
IDELEMS
#define IDELEMS(i)
Definition simpleideals.h:23

## newtonPolytopesP()

pointSet ** convexHull::newtonPolytopesP | ( | const ideal | gls | ) |

Computes the point sets of the convex hulls of the supports given by the polynoms in gls.

Returns Q[].

Definition at line 776 of file mpr_base.cc.

{
int i, j, k;
int m; // Anzahl der Exponentvektoren im i-ten Polynom (gls->m)[i] des Ideals gls
int idelem= IDELEMS(gls);
int * vert;
n= (currRing->N);
vert= (int *)omAlloc( (idelem+1) * sizeof(int) );
Q = (pointSet **)omAlloc( idelem * sizeof(pointSet*) ); // support hulls
for ( i= 0; i < idelem; i++ )
Q[i] = new pointSet( (currRing->N), i+1, pLength((gls->m)[i])+1 );
for( i= 0; i < idelem; i++ )
{
k=1;
m = pLength( (gls->m)[i] );
poly p= (gls->m)[i];
for( j= 1; j <= m; j++) { // fuer jeden Exponentvektor
if( !inHull( (gls->m)[i], p, m, j ) )
{
p_GetExpV( p, vert, currRing );
Q[i]->addPoint( vert );
k++;
mprSTICKYPROT(ST_SPARSE_VADD);
}
else
{
mprSTICKYPROT(ST_SPARSE_VREJ);
}
pIter( p );
} // j
mprSTICKYPROT("\n");
} // i
omFreeSize( (void *) vert, (idelem+1) * sizeof(int) );
#ifdef mprDEBUG_PROT
PrintLn();
for( i= 0; i < idelem; i++ )
{
Print(" \\Conv(Qi[%d]): #%d\n", i,Q[i]->num );
for ( j=1; j <= Q[i]->num; j++ )
{
Print("%d: <",j);print_exp( (*Q[i])[j] , (currRing->N) );PrintS(">\n");
}
PrintLn();
}
#endif
return Q;
}
num
CanonicalForm num(const CanonicalForm &f)
Definition canonicalform.h:337
k
int k
Definition cfEzgcd.cc:99
convexHull::Q
pointSet ** Q
Definition mpr_base.cc:269
Print
#define Print
Definition emacs.cc:80
p_GetExpV
static void p_GetExpV(poly p, int *ev, const ring r)
Definition p_polys.h:1541

## Field Documentation

## n

int convexHull::n

private

Definition at line 270 of file mpr_base.cc.

## pLP

simplex* convexHull::pLP

private

Definition at line 271 of file mpr_base.cc.

## Q

pointSet** convexHull::Q

private

Definition at line 269 of file mpr_base.cc.

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

- kernel/numeric/mpr_base.cc