My Project  UNKNOWN_GIT_VERSION
Public Member Functions | Private Member Functions | Private Attributes
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. More...
 
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. More...
 

Private Attributes

pointSet ** Q
 
int n
 
simplexpLP
 

Detailed Description

Definition at line 251 of file mpr_base.cc.

Constructor & Destructor Documentation

◆ convexHull()

convexHull::convexHull ( simplex _pLP)
inline

Definition at line 254 of file mpr_base.cc.

254 : pLP(_pLP) {}

◆ ~convexHull()

convexHull::~convexHull ( )
inline

Definition at line 255 of file mpr_base.cc.

255 {}

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 732 of file mpr_base.cc.

733 {
734  int i, j, col;
735 
736  pLP->m = n+1;
737  pLP->n = m; // this includes col of cts
738 
739  pLP->LiPM[1][1] = +0.0;
740  pLP->LiPM[1][2] = +1.0; // optimize (arbitrary) var
741  pLP->LiPM[2][1] = +1.0;
742  pLP->LiPM[2][2] = -1.0; // lambda vars sum up to 1
743 
744  for ( j=3; j <= pLP->n; j++)
745  {
746  pLP->LiPM[1][j] = +0.0;
747  pLP->LiPM[2][j] = -1.0;
748  }
749 
750  for( i= 1; i <= n; i++) { // each row constraints one coor
751  pLP->LiPM[i+2][1] = (mprfloat)pGetExp(pointPoly,i);
752  col = 2;
753  for( j= 1; j <= m; j++ )
754  {
755  if( j != site )
756  {
757  pLP->LiPM[i+2][col] = -(mprfloat)pGetExp( monomAt(p,j), i );
758  col++;
759  }
760  }
761  }
762 
763 #ifdef mprDEBUG_ALL
764  PrintS("Matrix of Linear Programming\n");
765  print_mat( pLP->LiPM, pLP->m+1,pLP->n);
766 #endif
767 
768  pLP->m3= pLP->m;
769 
770  pLP->compute();
771 
772  return (pLP->icase == 0);
773 }

◆ newtonPolytopesI()

ideal convexHull::newtonPolytopesI ( const ideal  gls)

Definition at line 836 of file mpr_base.cc.

837 {
838  int i, j;
839  int m; // Anzahl der Exponentvektoren im i-ten Polynom (gls->m)[i] des Ideals gls
840  int idelem= IDELEMS(gls);
841  ideal id;
842  poly p,pid;
843  int * vert;
844 
845  n= (currRing->N);
846  vert= (int *)omAlloc( (idelem+1) * sizeof(int) );
847  id= idInit( idelem, 1 );
848 
849  for( i= 0; i < idelem; i++ )
850  {
851  m = pLength( (gls->m)[i] );
852 
853  p= (gls->m)[i];
854  for( j= 1; j <= m; j++) { // für jeden Exponentvektor
855  if( !inHull( (gls->m)[i], p, m, j ) )
856  {
857  if ( (id->m)[i] == NULL )
858  {
859  (id->m)[i]= pHead(p);
860  pid=(id->m)[i];
861  }
862  else
863  {
864  pNext(pid)= pHead(p);
865  pIter(pid);
866  pNext(pid)= NULL;
867  }
869  }
870  else
871  {
873  }
874  pIter( p );
875  } // j
876  mprSTICKYPROT("\n");
877  } // i
878 
879  omFreeSize( (void *) vert, (idelem+1) * sizeof(int) );
880 
881 #ifdef mprDEBUG_PROT
882  PrintLn();
883  for( i= 0; i < idelem; i++ )
884  {
885  }
886 #endif
887 
888  return id;
889 }

◆ 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 778 of file mpr_base.cc.

779 {
780  int i, j, k;
781  int m; // Anzahl der Exponentvektoren im i-ten Polynom (gls->m)[i] des Ideals gls
782  int idelem= IDELEMS(gls);
783  int * vert;
784 
785  n= (currRing->N);
786  vert= (int *)omAlloc( (idelem+1) * sizeof(int) );
787 
788  Q = (pointSet **)omAlloc( idelem * sizeof(pointSet*) ); // support hulls
789  for ( i= 0; i < idelem; i++ )
790  Q[i] = new pointSet( (currRing->N), i+1, pLength((gls->m)[i])+1 );
791 
792  for( i= 0; i < idelem; i++ )
793  {
794  k=1;
795  m = pLength( (gls->m)[i] );
796 
797  poly p= (gls->m)[i];
798  for( j= 1; j <= m; j++) { // für jeden Exponentvektor
799  if( !inHull( (gls->m)[i], p, m, j ) )
800  {
801  p_GetExpV( p, vert, currRing );
802  Q[i]->addPoint( vert );
803  k++;
805  }
806  else
807  {
809  }
810  pIter( p );
811  } // j
812  mprSTICKYPROT("\n");
813  } // i
814 
815  omFreeSize( (void *) vert, (idelem+1) * sizeof(int) );
816 
817 #ifdef mprDEBUG_PROT
818  PrintLn();
819  for( i= 0; i < idelem; i++ )
820  {
821  Print(" \\Conv(Qi[%d]): #%d\n", i,Q[i]->num );
822  for ( j=1; j <= Q[i]->num; j++ )
823  {
824  Print("%d: <",j);print_exp( (*Q[i])[j] , (currRing->N) );PrintS(">\n");
825  }
826  PrintLn();
827  }
828 #endif
829 
830  return Q;
831 }

Field Documentation

◆ n

int convexHull::n
private

Definition at line 272 of file mpr_base.cc.

◆ pLP

simplex* convexHull::pLP
private

Definition at line 273 of file mpr_base.cc.

◆ Q

pointSet** convexHull::Q
private

Definition at line 271 of file mpr_base.cc.


The documentation for this class was generated from the following file:
simplex::m
int m
Definition: mpr_numeric.h:197
j
int j
Definition: facHensel.cc:105
k
int k
Definition: cfEzgcd.cc:92
convexHull::Q
pointSet ** Q
Definition: mpr_base.cc:271
pGetExp
#define pGetExp(p, i)
Exponent.
Definition: polys.h:40
num
CanonicalForm num(const CanonicalForm &f)
Definition: canonicalform.h:330
convexHull::pLP
simplex * pLP
Definition: mpr_base.cc:273
simplex::LiPM
mprfloat ** LiPM
Definition: mpr_numeric.h:204
ST_SPARSE_VADD
#define ST_SPARSE_VADD
Definition: mpr_global.h:69
ST_SPARSE_VREJ
#define ST_SPARSE_VREJ
Definition: mpr_global.h:70
pointSet
Definition: mpr_base.cc:162
mprSTICKYPROT
#define mprSTICKYPROT(msg)
Definition: mpr_global.h:53
pLength
static unsigned pLength(poly a)
Definition: p_polys.h:184
currRing
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
i
int i
Definition: cfEzgcd.cc:125
monomAt
poly monomAt(poly p, int i)
Definition: mpr_base.cc:722
PrintS
void PrintS(const char *s)
Definition: reporter.cc:283
omFreeSize
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:258
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:732
simplex::icase
int icase
Definition: mpr_numeric.h:200
pointSet::addPoint
bool addPoint(const onePointP vert)
Adds a point to pointSet, copy vert[0,...,dim] ot point[num+1][0,...,dim].
Definition: mpr_base.cc:466
pIter
#define pIter(p)
Definition: monomials.h:35
convexHull::n
int n
Definition: mpr_base.cc:272
omAlloc
#define omAlloc(size)
Definition: omAllocDecl.h:208
p_GetExpV
static void p_GetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1439
simplex::m3
int m3
Definition: mpr_numeric.h:199
mprfloat
double mprfloat
Definition: mpr_global.h:16
Print
#define Print
Definition: emacs.cc:79
idInit
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:36
m
int m
Definition: cfEzgcd.cc:121
NULL
#define NULL
Definition: omList.c:9
simplex::compute
void compute()
Definition: mpr_numeric.cc:1098
pointSet::num
int num
Definition: mpr_base.cc:169
p
int p
Definition: cfModGcd.cc:4019
IDELEMS
#define IDELEMS(i)
Definition: simpleideals.h:24
pHead
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
Definition: polys.h:65
PrintLn
void PrintLn()
Definition: reporter.cc:309
simplex::n
int n
Definition: mpr_numeric.h:198
pNext
#define pNext(p)
Definition: monomials.h:34