My Project
Loading...
Searching...
No Matches
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 249 of file mpr_base.cc.

Constructor & Destructor Documentation

◆ convexHull()

convexHull::convexHull ( simplex _pLP)
inline

Definition at line 252 of file mpr_base.cc.

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

◆ ~convexHull()

convexHull::~convexHull ( )
inline

Definition at line 253 of file mpr_base.cc.

253{}

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.

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

◆ newtonPolytopesI()

ideal convexHull::newtonPolytopesI ( const ideal  gls)

Definition at line 834 of file mpr_base.cc.

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

777{
778 int i, j, k;
779 int m; // Anzahl der Exponentvektoren im i-ten Polynom (gls->m)[i] des Ideals gls
780 int idelem= IDELEMS(gls);
781 int * vert;
782
783 n= (currRing->N);
784 vert= (int *)omAlloc( (idelem+1) * sizeof(int) );
785
786 Q = (pointSet **)omAlloc( idelem * sizeof(pointSet*) ); // support hulls
787 for ( i= 0; i < idelem; i++ )
788 Q[i] = new pointSet( (currRing->N), i+1, pLength((gls->m)[i])+1 );
789
790 for( i= 0; i < idelem; i++ )
791 {
792 k=1;
793 m = pLength( (gls->m)[i] );
794
795 poly p= (gls->m)[i];
796 for( j= 1; j <= m; j++) { // fuer jeden Exponentvektor
797 if( !inHull( (gls->m)[i], p, m, j ) )
798 {
799 p_GetExpV( p, vert, currRing );
800 Q[i]->addPoint( vert );
801 k++;
803 }
804 else
805 {
807 }
808 pIter( p );
809 } // j
810 mprSTICKYPROT("\n");
811 } // i
812
813 omFreeSize( (void *) vert, (idelem+1) * sizeof(int) );
814
815#ifdef mprDEBUG_PROT
816 PrintLn();
817 for( i= 0; i < idelem; i++ )
818 {
819 Print(" \\Conv(Qi[%d]): #%d\n", i,Q[i]->num );
820 for ( j=1; j <= Q[i]->num; j++ )
821 {
822 Print("%d: <",j);print_exp( (*Q[i])[j] , (currRing->N) );PrintS(">\n");
823 }
824 PrintLn();
825 }
826#endif
827
828 return Q;
829}
CanonicalForm num(const CanonicalForm &f)
int k
Definition: cfEzgcd.cc:99
pointSet ** Q
Definition: mpr_base.cc:269
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
int num
Definition: mpr_base.cc:167
#define Print
Definition: emacs.cc:80
static void p_GetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1518

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: