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

Constructor & Destructor Documentation

convexHull::convexHull ( simplex _pLP)
inline

Definition at line 255 of file mpr_base.cc.

255 : pLP(_pLP) {}
simplex * pLP
Definition: mpr_base.cc:274
convexHull::~convexHull ( )
inline

Definition at line 256 of file mpr_base.cc.

256 {}

Member Function Documentation

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

734 {
735  int i, j, col;
736 
737  pLP->m = n+1;
738  pLP->n = m; // this includes col of cts
739 
740  pLP->LiPM[1][1] = +0.0;
741  pLP->LiPM[1][2] = +1.0; // optimize (arbitrary) var
742  pLP->LiPM[2][1] = +1.0;
743  pLP->LiPM[2][2] = -1.0; // lambda vars sum up to 1
744 
745  for ( j=3; j <= pLP->n; j++)
746  {
747  pLP->LiPM[1][j] = +0.0;
748  pLP->LiPM[2][j] = -1.0;
749  }
750 
751  for( i= 1; i <= n; i++) { // each row constraints one coor
752  pLP->LiPM[i+2][1] = (mprfloat)pGetExp(pointPoly,i);
753  col = 2;
754  for( j= 1; j <= m; j++ )
755  {
756  if( j != site )
757  {
758  pLP->LiPM[i+2][col] = -(mprfloat)pGetExp( monomAt(p,j), i );
759  col++;
760  }
761  }
762  }
763 
764 #ifdef mprDEBUG_ALL
765  PrintS("Matrix of Linear Programming\n");
766  print_mat( pLP->LiPM, pLP->m+1,pLP->n);
767 #endif
768 
769  pLP->m3= pLP->m;
770 
771  pLP->compute();
772 
773  return (pLP->icase == 0);
774 }
void compute()
return P p
Definition: myNF.cc:203
double mprfloat
Definition: mpr_global.h:17
#define pGetExp(p, i)
Exponent.
Definition: polys.h:41
poly monomAt(poly p, int i)
Definition: mpr_base.cc:723
int j
Definition: myNF.cc:70
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
simplex * pLP
Definition: mpr_base.cc:274
mprfloat ** LiPM
Definition: mpr_numeric.h:205
int icase
Definition: mpr_numeric.h:201
ideal convexHull::newtonPolytopesI ( const ideal  gls)

Definition at line 837 of file mpr_base.cc.

838 {
839  int i, j;
840  int m; // Anzahl der Exponentvektoren im i-ten Polynom (gls->m)[i] des Ideals gls
841  int idelem= IDELEMS(gls);
842  ideal id;
843  poly p,pid;
844  int * vert;
845 
846  n= (currRing->N);
847  vert= (int *)omAlloc( (idelem+1) * sizeof(int) );
848  id= idInit( idelem, 1 );
849 
850  for( i= 0; i < idelem; i++ )
851  {
852  m = pLength( (gls->m)[i] );
853 
854  p= (gls->m)[i];
855  for( j= 1; j <= m; j++) { // für jeden Exponentvektor
856  if( !inHull( (gls->m)[i], p, m, j ) )
857  {
858  if ( (id->m)[i] == NULL )
859  {
860  (id->m)[i]= pHead(p);
861  pid=(id->m)[i];
862  }
863  else
864  {
865  pNext(pid)= pHead(p);
866  pIter(pid);
867  pNext(pid)= NULL;
868  }
870  }
871  else
872  {
874  }
875  pIter( p );
876  } // j
877  mprSTICKYPROT("\n");
878  } // i
879 
880  omFreeSize( (void *) vert, (idelem+1) * sizeof(int) );
881 
882 #ifdef mprDEBUG_PROT
883  PrintLn();
884  for( i= 0; i < idelem; i++ )
885  {
886  }
887 #endif
888 
889  return id;
890 }
#define mprSTICKYPROT(msg)
Definition: mpr_global.h:54
void PrintLn()
Definition: reporter.cc:327
return P p
Definition: myNF.cc:203
#define ST_SPARSE_VREJ
Definition: mpr_global.h:71
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
#define omAlloc(size)
Definition: omAllocDecl.h:210
static int pLength(poly a)
Definition: p_polys.h:189
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int j
Definition: myNF.cc:70
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
#define IDELEMS(i)
Definition: simpleideals.h:24
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
#define ST_SPARSE_VADD
Definition: mpr_global.h:70
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:733
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 779 of file mpr_base.cc.

780 {
781  int i, j, k;
782  int m; // Anzahl der Exponentvektoren im i-ten Polynom (gls->m)[i] des Ideals gls
783  int idelem= IDELEMS(gls);
784  int * vert;
785 
786  n= (currRing->N);
787  vert= (int *)omAlloc( (idelem+1) * sizeof(int) );
788 
789  Q = (pointSet **)omAlloc( idelem * sizeof(pointSet*) ); // support hulls
790  for ( i= 0; i < idelem; i++ )
791  Q[i] = new pointSet( (currRing->N), i+1, pLength((gls->m)[i])+1 );
792 
793  for( i= 0; i < idelem; i++ )
794  {
795  k=1;
796  m = pLength( (gls->m)[i] );
797 
798  poly p= (gls->m)[i];
799  for( j= 1; j <= m; j++) { // für jeden Exponentvektor
800  if( !inHull( (gls->m)[i], p, m, j ) )
801  {
802  pGetExpV( p, vert );
803  Q[i]->addPoint( vert );
804  k++;
806  }
807  else
808  {
810  }
811  pIter( p );
812  } // j
813  mprSTICKYPROT("\n");
814  } // i
815 
816  omFreeSize( (void *) vert, (idelem+1) * sizeof(int) );
817 
818 #ifdef mprDEBUG_PROT
819  PrintLn();
820  for( i= 0; i < idelem; i++ )
821  {
822  Print(" \\Conv(Qi[%d]): #%d\n", i,Q[i]->num );
823  for ( j=1; j <= Q[i]->num; j++ )
824  {
825  Print("%d: <",j);print_exp( (*Q[i])[j] , (currRing->N) );PrintS(">\n");
826  }
827  PrintLn();
828  }
829 #endif
830 
831  return Q;
832 }
#define mprSTICKYPROT(msg)
Definition: mpr_global.h:54
void PrintLn()
Definition: reporter.cc:327
#define Print
Definition: emacs.cc:83
CanonicalForm num(const CanonicalForm &f)
return P p
Definition: myNF.cc:203
#define ST_SPARSE_VREJ
Definition: mpr_global.h:71
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
int k
Definition: cfEzgcd.cc:93
#define omAlloc(size)
Definition: omAllocDecl.h:210
static int pLength(poly a)
Definition: p_polys.h:189
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int j
Definition: myNF.cc:70
pointSet ** Q
Definition: mpr_base.cc:272
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
#define IDELEMS(i)
Definition: simpleideals.h:24
int num
Definition: mpr_base.cc:170
bool addPoint(const onePointP vert)
Adds a point to pointSet, copy vert[0,...,dim] ot point[num+1][0,...,dim].
Definition: mpr_base.cc:467
#define pGetExpV(p, e)
Gets a copy of (resp. set) the exponent vector, where e is assumed to point to (r->N +1)*sizeof(long)...
Definition: polys.h:96
polyrec * poly
Definition: hilb.h:10
#define ST_SPARSE_VADD
Definition: mpr_global.h:70
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:733

Field Documentation

int convexHull::n
private

Definition at line 273 of file mpr_base.cc.

simplex* convexHull::pLP
private

Definition at line 274 of file mpr_base.cc.

pointSet** convexHull::Q
private

Definition at line 272 of file mpr_base.cc.


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