My Project
Loading...
Searching...
No Matches
Macros | Functions | Variables
polymake_wrapper.cc File Reference
#include "kernel/mod2.h"
#include "Singular/dyn_modules/gfanlib/bbcone.h"
#include "Singular/dyn_modules/gfanlib/bbfan.h"
#include "Singular/dyn_modules/gfanlib/bbpolytope.h"
#include "Singular/blackbox.h"
#include "Singular/ipshell.h"
#include "Singular/subexpr.h"
#include "Singular/mod_lib.h"
#include <polymake/client.h>
#include <polymake_conversion.h>
#include <polymake_documentation.h>
#include <polymake/Graph.h>
#include <omp.h>

Go to the source code of this file.

Macros

#define POLYAMKE_VERSION   POLYMAKEVERSION
 

Functions

static BOOLEAN bbpolytope_Op2 (int op, leftv res, leftv i1, leftv i2)
 
BOOLEAN PMisLatticePolytope (leftv res, leftv args)
 
BOOLEAN PMisBounded (leftv res, leftv args)
 
BOOLEAN PMisReflexive (leftv res, leftv args)
 
BOOLEAN PMisGorenstein (leftv res, leftv args)
 
BOOLEAN PMgorensteinIndex (leftv res, leftv args)
 
BOOLEAN PMgorensteinVector (leftv res, leftv args)
 
BOOLEAN PMisCanonical (leftv res, leftv args)
 
BOOLEAN PMisTerminal (leftv res, leftv args)
 
BOOLEAN PMisLatticeEmpty (leftv res, leftv args)
 
BOOLEAN PMlatticeVolume (leftv res, leftv args)
 
BOOLEAN PMlatticeDegree (leftv res, leftv args)
 
BOOLEAN PMlatticeCodegree (leftv res, leftv args)
 
BOOLEAN PMehrhartPolynomialCoeff (leftv res, leftv args)
 
BOOLEAN PMfVector (leftv res, leftv args)
 
BOOLEAN PMhVector (leftv res, leftv args)
 
BOOLEAN PMhStarVector (leftv res, leftv args)
 
BOOLEAN PMisNormal (leftv res, leftv args)
 
BOOLEAN PMfacetWidths (leftv res, leftv args)
 
BOOLEAN PMfacetWidth (leftv res, leftv args)
 
BOOLEAN PMfacetVertexLatticeDistances (leftv res, leftv args)
 
BOOLEAN PMisCompressed (leftv res, leftv args)
 
BOOLEAN PMisSmooth (leftv res, leftv args)
 
BOOLEAN PMisVeryAmple (leftv res, leftv args)
 
BOOLEAN PMlatticePoints (leftv res, leftv args)
 
BOOLEAN PMnLatticePoints (leftv res, leftv args)
 
BOOLEAN PMinteriorLatticePoints (leftv res, leftv args)
 
BOOLEAN PMnInteriorLatticePoints (leftv res, leftv args)
 
BOOLEAN PMboundaryLatticePoints (leftv res, leftv args)
 
BOOLEAN PMnBoundaryLatticePoints (leftv res, leftv args)
 
BOOLEAN PMhilbertBasis (leftv res, leftv args)
 
BOOLEAN PMnHilbertBasis (leftv res, leftv args)
 
BOOLEAN PMminkowskiSum (leftv res, leftv args)
 
polymake::Matrix< polymake::Integer > verticesOf (const polymake::perl::Object *p, const polymake::Set< polymake::Integer > *s)
 
BOOLEAN PMmaximalFace (leftv res, leftv args)
 
BOOLEAN PMminimalFace (leftv res, leftv args)
 
BOOLEAN PMmaximalValue (leftv res, leftv args)
 
BOOLEAN PMminimalValue (leftv res, leftv args)
 
BOOLEAN visual (leftv res, leftv args)
 
BOOLEAN normalFan (leftv res, leftv args)
 
BOOLEAN PMconeViaRays (leftv res, leftv args)
 
BOOLEAN PMpolytopeViaVertices (leftv res, leftv args)
 
BOOLEAN PMvertexAdjacencyGraph (leftv res, leftv args)
 
BOOLEAN PMvertexEdgeGraph (leftv res, leftv args)
 
int SI_MOD_INIT() polymake (SModulFunctions *p)
 

Variables

polymake::Main * init_polymake =NULL
 

Macro Definition Documentation

◆ POLYAMKE_VERSION

#define POLYAMKE_VERSION   POLYMAKEVERSION

Definition at line 5 of file polymake_wrapper.cc.

Function Documentation

◆ bbpolytope_Op2()

static BOOLEAN bbpolytope_Op2 ( int  op,
leftv  res,
leftv  i1,
leftv  i2 
)
static

Definition at line 24 of file polymake_wrapper.cc.

25{
26 gfan::ZCone* zp = (gfan::ZCone*) i1->Data();
27 switch(op)
28 {
29 case '+':
30 {
31 if (i2->Typ()==polytopeID || i2->Typ()==coneID)
32 {
33 gfan::initializeCddlibIfRequired();
34 gfan::ZCone* zq = (gfan::ZCone*) i2->Data();
35 gfan::ZCone* ms;
36 try
37 {
38 polymake::perl::Object* pp = ZPolytope2PmPolytope(zp);
39 polymake::perl::Object* pq = ZPolytope2PmPolytope(zq);
40 polymake::perl::Object pms;
41 #if (POLYMAKE_VERSION >= 305)
42 polymake::call_function("minkowski_sum", *pp, *pq) >> pms;
43 #else
44 CallPolymakeFunction("minkowski_sum", *pp, *pq) >> pms;
45 #endif
46 ms = PmPolytope2ZPolytope(&pms);
47 delete pp;
48 delete pq;
49 }
50 catch (const std::exception& ex)
51 {
52 gfan::deinitializeCddlibIfRequired();
53 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
54 return TRUE;
55 }
56 gfan::deinitializeCddlibIfRequired();
57 res->rtyp = polytopeID;
58 res->data = (void*) ms;
59 return FALSE;
60 }
61 return blackboxDefaultOp2(op,res,i1,i2);
62 }
63 case '*':
64 {
65 if (i2->Typ()==INT_CMD)
66 {
67 gfan::initializeCddlibIfRequired();
68 int s = (int)(long) i2->Data();
69 gfan::ZMatrix zm = zp->extremeRays();
70 for (int i=0; i<zm.getHeight(); i++)
71 for (int j=1; j<zm.getWidth(); j++)
72 zm[i][j] *= s;
73 gfan::ZCone* zs = new gfan::ZCone();
74 *zs = gfan::ZCone::givenByRays(zm,gfan::ZMatrix(0, zm.getWidth()));
75 gfan::deinitializeCddlibIfRequired();
76 res->rtyp = polytopeID;
77 res->data = (void*) zs;
78 return FALSE;
79 }
80 return blackboxDefaultOp2(op,res,i1,i2);
81 }
82 case '&':
83 {
84 if (i2->Typ()==polytopeID)
85 {
86 gfan::initializeCddlibIfRequired();
87 gfan::ZCone* zq = (gfan::ZCone*) i2->Data();
88 int d1 = zp->ambientDimension();
89 int d2 = zq->ambientDimension();
90 if (d1 != d2)
91 {
92 gfan::deinitializeCddlibIfRequired();
93 WerrorS("mismatching ambient dimensions");
94 return TRUE;
95 }
96 gfan::ZCone* zs = new gfan::ZCone();
97 *zs = gfan::intersection(*zp, *zq);
98 zs->canonicalize();
99 gfan::deinitializeCddlibIfRequired();
100 res->rtyp = polytopeID;
101 res->data = (void*) zs;
102 return FALSE;
103 }
104 return blackboxDefaultOp2(op,res,i1,i2);
105 }
106 case '|':
107 {
108 if(i2->Typ()==polytopeID)
109 {
110 gfan::initializeCddlibIfRequired();
111 gfan::ZCone* zq = (gfan::ZCone*) i2->Data();
112 int d1 = zp->ambientDimension();
113 int d2 = zq->ambientDimension();
114 if (d1 != d2)
115 {
116 gfan::deinitializeCddlibIfRequired();
117 WerrorS("mismatching ambient dimensions");
118 return TRUE;
119 }
120 gfan::ZMatrix rays = zp->extremeRays();
121 rays.append(zq->extremeRays());
122 gfan::ZMatrix lineality = zp->generatorsOfLinealitySpace();
123 lineality.append(zq->generatorsOfLinealitySpace());
124 gfan::ZCone* zs = new gfan::ZCone();
125 *zs = gfan::ZCone::givenByRays(rays,lineality);
126 zs->canonicalize();
127 gfan::deinitializeCddlibIfRequired();
128 res->rtyp = polytopeID;
129 res->data = (void*) zs;
130 return FALSE;
131 }
132 return blackboxDefaultOp2(op,res,i1,i2);
133 }
134 case EQUAL_EQUAL:
135 {
136 if(i2->Typ()==polytopeID)
137 {
138 gfan::initializeCddlibIfRequired();
139 gfan::ZCone* zq = (gfan::ZCone*) i2->Data();
140 zp->canonicalize();
141 zq->canonicalize();
142 bool b = !((*zp)!=(*zq));
143 gfan::deinitializeCddlibIfRequired();
144 res->rtyp = INT_CMD;
145 res->data = (char*) (long) b;
146 return FALSE;
147 }
148 return blackboxDefaultOp2(op,res,i1,i2);
149 }
150 default:
151 return blackboxDefaultOp2(op,res,i1,i2);
152 }
153 return blackboxDefaultOp2(op,res,i1,i2);
154}
#define TRUE
Definition: auxiliary.h:100
#define FALSE
Definition: auxiliary.h:96
VAR int coneID
Definition: bbcone.cc:25
BOOLEAN rays(leftv res, leftv args)
Definition: bbcone.cc:662
VAR int polytopeID
Definition: bbpolytope.cc:16
BOOLEAN blackboxDefaultOp2(int, leftv, leftv, leftv)
default procedure blackboxDefaultOp2, to be called as "default:" branch
Definition: blackbox.cc:97
CanonicalForm FACTORY_PUBLIC pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:676
int i
Definition: cfEzgcd.cc:132
CanonicalForm b
Definition: cfModGcd.cc:4103
int Typ()
Definition: subexpr.cc:1019
void * Data()
Definition: subexpr.cc:1162
const CanonicalForm int s
Definition: facAbsFact.cc:51
CanonicalForm res
Definition: facAbsFact.cc:60
int j
Definition: facHensel.cc:110
void WerrorS(const char *s)
Definition: feFopen.cc:24
@ EQUAL_EQUAL
Definition: grammar.cc:268
gfan::ZCone * PmPolytope2ZPolytope(polymake::perl::Object *pp)
polymake::perl::Object * ZPolytope2PmPolytope(gfan::ZCone *zc)
@ INT_CMD
Definition: tok.h:96

◆ normalFan()

BOOLEAN normalFan ( leftv  res,
leftv  args 
)

Definition at line 1793 of file polymake_wrapper.cc.

1794{
1795 leftv u = args;
1796 if ((u != NULL) && (u->Typ() == polytopeID))
1797 {
1798 gfan::initializeCddlibIfRequired();
1799 gfan::ZCone* zp = (gfan::ZCone*)u->Data();
1800 gfan::ZFan* zf = new gfan::ZFan(0);
1801 try
1802 {
1803 polymake::perl::Object* p=ZPolytope2PmPolytope(zp);
1804 polymake::perl::Object pf;
1805 #if (POLYMAKE_VERSION >= 305)
1806 polymake::call_function("normal_fan", *p) >> pf;
1807 #else
1808 CallPolymakeFunction("normal_fan",*p) >> pf;
1809 #endif
1810 delete p;
1811 zf = PmFan2ZFan(&pf);
1812 }
1813 catch (const std::exception& ex)
1814 {
1815 gfan::deinitializeCddlibIfRequired();
1816 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1817 return TRUE;
1818 }
1819 gfan::deinitializeCddlibIfRequired();
1820 res->rtyp = fanID;
1821 res->data = (char*) zf;
1822 return FALSE;
1823 }
1824 WerrorS("normalFan: unexpected parameters");
1825 return TRUE;
1826}
VAR int fanID
Definition: bbfan.cc:19
int p
Definition: cfModGcd.cc:4078
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define NULL
Definition: omList.c:12
gfan::ZFan * PmFan2ZFan(polymake::perl::Object *pf)

◆ PMboundaryLatticePoints()

BOOLEAN PMboundaryLatticePoints ( leftv  res,
leftv  args 
)

Definition at line 1217 of file polymake_wrapper.cc.

1218{
1219 leftv u = args;
1220 if ((u != NULL) && (u->Typ() == polytopeID))
1221 {
1222 gfan::initializeCddlibIfRequired();
1223 gfan::ZCone* zp = (gfan::ZCone*)u->Data();
1224 intvec* iv;
1225 bool ok = true;
1226 try
1227 {
1228 polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
1229 polymake::Matrix<polymake::Integer> lp = p->give("BOUNDARY_LATTICE_POINTS");
1230 delete p;
1231 iv = PmMatrixInteger2Intvec(&lp,ok);
1232 }
1233 catch (const std::exception& ex)
1234 {
1235 gfan::deinitializeCddlibIfRequired();
1236 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1237 return TRUE;
1238 }
1239 gfan::deinitializeCddlibIfRequired();
1240 if (!ok)
1241 {
1242 WerrorS("overflow while converting polymake::Integer to int");
1243 return TRUE;
1244 }
1245 res->rtyp = INTMAT_CMD;
1246 res->data = (char*) iv;
1247 return FALSE;
1248 }
1249 WerrorS("boundaryLatticePoints: unexpected parameters");
1250 return TRUE;
1251}
Definition: intvec.h:23
@ INTMAT_CMD
Definition: grammar.cc:279
intvec * PmMatrixInteger2Intvec(polymake::Matrix< polymake::Integer > *mi, bool &ok)

◆ PMconeViaRays()

BOOLEAN PMconeViaRays ( leftv  res,
leftv  args 
)

Definition at line 1828 of file polymake_wrapper.cc.

1829{
1830 leftv u = args;
1831 if ((u != NULL) && (u->Typ() == INTMAT_CMD))
1832 {
1833 gfan::initializeCddlibIfRequired();
1834 polymake::perl::Object pc("Cone<Rational>");
1835 intvec* hlines = (intvec*) u->Data(); // these will are half lines in the cone
1836 polymake::Matrix<polymake::Integer> pmhlines = Intvec2PmMatrixInteger(hlines);
1837 pc.take("INPUT_RAYS") << pmhlines;
1838
1839 leftv v = u->next;
1840 if ((v != NULL) && (v->Typ() == INTMAT_CMD))
1841 {
1842 intvec* lines = (intvec*) v->Data(); // these will be lines in the cone
1843 polymake::Matrix<polymake::Integer> pmlines = Intvec2PmMatrixInteger(lines);
1844 pc.take("INPUT_LINEALITY") << pmlines;
1845
1846 // leftv w = v->next;
1847 // if ((w != NULL) && (w->Typ() == INT_CMD))
1848 // {
1849 // int flag = (int) (long) w->Data(); // TODO: this will indicate whether the
1850 // // information provided are exact
1851 // }
1852 }
1853 gfan::ZCone* zc = PmCone2ZCone(&pc);
1854 gfan::deinitializeCddlibIfRequired();
1855 res->rtyp = coneID;
1856 res->data = (char*) zc;
1857 return FALSE;
1858 }
1859 WerrorS("coneViaRays: unexpected parameters");
1860 return TRUE;
1861}
int lines
Definition: checklibs.c:13
leftv next
Definition: subexpr.h:86
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:39
gfan::ZCone * PmCone2ZCone(polymake::perl::Object *pc)
polymake::Matrix< polymake::Integer > Intvec2PmMatrixInteger(const intvec *im)

◆ PMehrhartPolynomialCoeff()

BOOLEAN PMehrhartPolynomialCoeff ( leftv  res,
leftv  args 
)

Definition at line 638 of file polymake_wrapper.cc.

639{
640 leftv u = args;
641 if ((u != NULL) && (u->Typ() == polytopeID))
642 {
643 gfan::initializeCddlibIfRequired();
644 gfan::ZCone* zp = (gfan::ZCone*)u->Data();
645 intvec* ec;
646 bool ok = true;
647 try
648 {
649 polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
650 polymake::Vector<polymake::Integer> pec = p->give("EHRHART_POLYNOMIAL_COEFF");
651 delete p;
652 ec = PmVectorInteger2Intvec(&pec,ok);
653 }
654 catch (const std::exception& ex)
655 {
656 gfan::deinitializeCddlibIfRequired();
657 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
658 return TRUE;
659 }
660 gfan::deinitializeCddlibIfRequired();
661 if (!ok)
662 {
663 WerrorS("ehrhartPolynomialCoeff: overflow in PmVectorInteger2Intvec");
664 return TRUE;
665 }
666 res->rtyp = INTVEC_CMD;
667 res->data = (char*) ec;
668 return FALSE;
669 }
670 WerrorS("ehrhartPolynomialCoeff: unexpected parameters");
671 return TRUE;
672}
intvec * PmVectorInteger2Intvec(const polymake::Vector< polymake::Integer > *vi, bool &ok)
@ INTVEC_CMD
Definition: tok.h:101

◆ PMfacetVertexLatticeDistances()

BOOLEAN PMfacetVertexLatticeDistances ( leftv  res,
leftv  args 
)

Definition at line 890 of file polymake_wrapper.cc.

891{
892 leftv u = args;
893 if ((u != NULL) && (u->Typ() == polytopeID))
894 {
895 gfan::initializeCddlibIfRequired();
896 gfan::ZCone* zp = (gfan::ZCone*)u->Data();
897 intvec* ld;
898 bool ok=true;
899 try
900 {
901 polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
902 polymake::Matrix<polymake::Integer> pld = p->give("FACET_VERTEX_LATTICE_DISTANCES");
903 delete p;
904 ld = PmMatrixInteger2Intvec(&pld,ok);
905 }
906 catch (const std::exception& ex)
907 {
908 gfan::deinitializeCddlibIfRequired();
909 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
910 return TRUE;
911 }
912 gfan::deinitializeCddlibIfRequired();
913 if (!ok)
914 {
915 WerrorS("overflow while converting polymake::Integer to int");
916 return TRUE;
917 }
918 res->rtyp = INTMAT_CMD;
919 res->data = (char*) ld;
920 return FALSE;
921 }
922 WerrorS("facetVertexLatticeDistances: unexpected parameters");
923 return TRUE;
924}

◆ PMfacetWidth()

BOOLEAN PMfacetWidth ( leftv  res,
leftv  args 
)

Definition at line 853 of file polymake_wrapper.cc.

854{
855 leftv u = args;
856 if ((u != NULL) && (u->Typ() == polytopeID))
857 {
858 gfan::initializeCddlibIfRequired();
859 gfan::ZCone* zp = (gfan::ZCone*)u->Data();
860 int fw;
861 bool ok = true;
862 try
863 {
864 polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
865 polymake::Integer pfw = p->give("FACET_WIDTH");
866 delete p;
867 fw = PmInteger2Int(pfw,ok);
868 }
869 catch (const std::exception& ex)
870 {
871 gfan::deinitializeCddlibIfRequired();
872 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
873 return TRUE;
874 }
875 gfan::deinitializeCddlibIfRequired();
876 if (!ok)
877 {
878 WerrorS("overflow while converting polymake::Integer to int");
879 return TRUE;
880 }
881 res->rtyp = INT_CMD;
882 res->data = (char*) (long) fw;
883 return FALSE;
884 }
885 WerrorS("facetWidth: unexpected parameters");
886 return TRUE;
887}
int PmInteger2Int(const polymake::Integer &pi, bool &ok)

◆ PMfacetWidths()

BOOLEAN PMfacetWidths ( leftv  res,
leftv  args 
)

Definition at line 816 of file polymake_wrapper.cc.

817{
818 leftv u = args;
819 if ((u != NULL) && (u->Typ() == polytopeID))
820 {
821 gfan::initializeCddlibIfRequired();
822 gfan::ZCone* zp = (gfan::ZCone*)u->Data();
823 intvec* fw;
824 bool ok = true;
825 try
826 {
827 polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
828 polymake::Vector<polymake::Integer> pfw = p->give("FACET_WIDTHS");
829 delete p;
830 fw = PmVectorInteger2Intvec(&pfw,ok);
831 }
832 catch (const std::exception& ex)
833 {
834 gfan::deinitializeCddlibIfRequired();
835 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
836 return TRUE;
837 }
838 gfan::deinitializeCddlibIfRequired();
839 if (!ok)
840 {
841 WerrorS("facetWidths: overflow in PmVectorInteger2Intvec");
842 return TRUE;
843 }
844 res->rtyp = INTVEC_CMD;
845 res->data = (char*) fw;
846 return FALSE;
847 }
848 WerrorS("facetWidths: unexpected parameters");
849 return TRUE;
850}

◆ PMfVector()

BOOLEAN PMfVector ( leftv  res,
leftv  args 
)

Definition at line 675 of file polymake_wrapper.cc.

676{
677 leftv u = args;
678 if ((u != NULL) && (u->Typ() == polytopeID))
679 {
680 gfan::initializeCddlibIfRequired();
681 gfan::ZCone* zp = (gfan::ZCone*)u->Data();
682 intvec* hv;
683 bool ok = true;
684 try
685 {
686 polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
687 polymake::Vector<polymake::Integer> phv = p->give("F_VECTOR");
688 delete p;
689 hv = PmVectorInteger2Intvec(&phv,ok);
690 }
691 catch (const std::exception& ex)
692 {
693 gfan::deinitializeCddlibIfRequired();
694 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
695 return TRUE;
696 }
697 gfan::deinitializeCddlibIfRequired();
698 if (!ok)
699 {
700 WerrorS("fVectorP: overflow in PmVectorInteger2Intvec");
701 return TRUE;
702 }
703 res->rtyp = INTVEC_CMD;
704 res->data = (char*) hv;
705 return FALSE;
706 }
707 WerrorS("fVectorP: unexpected parameters");
708 return TRUE;
709}

◆ PMgorensteinIndex()

BOOLEAN PMgorensteinIndex ( leftv  res,
leftv  args 
)

Definition at line 341 of file polymake_wrapper.cc.

342{
343 leftv u = args;
344 if ((u != NULL) && (u->Typ() == polytopeID))
345 {
346 gfan::initializeCddlibIfRequired();
347 gfan::ZCone* zp = (gfan::ZCone*)u->Data();
348 int gi;
349 bool ok = true;
350 try
351 {
352 polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
353 bool b = p->give("GORENSTEIN");
354 if (b)
355 {
356 polymake::Integer pgi = p->give("GORENSTEIN_INDEX");
357 gi = PmInteger2Int(pgi,ok);
358 delete p;
359 }
360 else
361 {
362 delete p;
363 gfan::deinitializeCddlibIfRequired();
364 WerrorS("gorensteinIndex: input polytope not gorenstein");
365 return TRUE;
366 }
367 }
368 catch (const std::exception& ex)
369 {
370 gfan::deinitializeCddlibIfRequired();
371 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
372 return TRUE;
373 }
374 gfan::deinitializeCddlibIfRequired();
375 if (!ok)
376 {
377 WerrorS("overflow while converting polymake::Integer to int");
378 return TRUE;
379 }
380 res->rtyp = INT_CMD;
381 res->data = (char*) (long) gi;
382 return FALSE;
383 }
384 WerrorS("gorensteinIndex: unexpected parameters");
385 return TRUE;
386}

◆ PMgorensteinVector()

BOOLEAN PMgorensteinVector ( leftv  res,
leftv  args 
)

Definition at line 389 of file polymake_wrapper.cc.

390{
391 leftv u = args;
392 if ((u != NULL) && (u->Typ() == polytopeID))
393 {
394 gfan::initializeCddlibIfRequired();
395 gfan::ZCone* zp = (gfan::ZCone*)u->Data();
396 intvec* gv;
397 bool ok = true;
398 try
399 {
400 polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
401 bool b = p->give("GORENSTEIN");
402 if (b)
403 {
404 polymake::Vector<polymake::Integer> pgv = p->give("GORENSTEIN_VECTOR");
405 gv = PmVectorInteger2Intvec(&pgv,ok);
406 delete p;
407 }
408 else
409 {
410 delete p;
411 gfan::deinitializeCddlibIfRequired();
412 WerrorS("gorensteinVector: input polytope not gorenstein");
413 return TRUE;
414 }
415 }
416 catch (const std::exception& ex)
417 {
418 gfan::deinitializeCddlibIfRequired();
419 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
420 return TRUE;
421 }
422 gfan::deinitializeCddlibIfRequired();
423 if (!ok)
424 {
425 WerrorS("gorensteinVector: overflow in PmVectorInteger2Intvec");
426 return TRUE;
427 }
428 res->rtyp = INTVEC_CMD;
429 res->data = (char*) gv;
430 return FALSE;
431 }
432 WerrorS("gorensteinVector: unexpected parameters");
433 return TRUE;
434}

◆ PMhilbertBasis()

BOOLEAN PMhilbertBasis ( leftv  res,
leftv  args 
)

Definition at line 1291 of file polymake_wrapper.cc.

1292{
1293 leftv u = args;
1294 if ((u != NULL) && (u->Typ() == coneID))
1295 {
1296 gfan::initializeCddlibIfRequired();
1297 gfan::ZCone* zp = (gfan::ZCone*)u->Data();
1298 intvec* iv;
1299 bool ok = true;
1300 try
1301 {
1302 polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
1303 #if (POLYMAKEVERSION >=305)
1304 polymake::Matrix<polymake::Integer> lp = p->call_method("HILBERT_BASIS");
1305 #elif (POLYMAKEVERSION >=214)
1306 polymake::Matrix<polymake::Integer> lp = p->CallPolymakeMethod("HILBERT_BASIS");
1307 #elif (POLYMAKEVERSION >=212)
1308 polymake::Matrix<polymake::Integer> lp = p->give("HILBERT_BASIS");
1309 #else
1310 #error polymake version too old
1311 #endif
1312 delete p;
1313 iv = PmMatrixInteger2Intvec(&lp,ok);
1314 }
1315 catch (const std::exception& ex)
1316 {
1317 gfan::deinitializeCddlibIfRequired();
1318 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1319 return TRUE;
1320 }
1321 gfan::deinitializeCddlibIfRequired();
1322 if (!ok)
1323 {
1324 WerrorS("overflow while converting polymake::Integer to int");
1325 return TRUE;
1326 }
1327 res->rtyp = INTMAT_CMD;
1328 res->data = (char*) iv;
1329 return FALSE;
1330 }
1331 WerrorS("hilbertBasis: unexpected parameters");
1332 return TRUE;
1333}

◆ PMhStarVector()

BOOLEAN PMhStarVector ( leftv  res,
leftv  args 
)

Definition at line 749 of file polymake_wrapper.cc.

750{
751 leftv u = args;
752 if ((u != NULL) && (u->Typ() == polytopeID))
753 {
754 gfan::initializeCddlibIfRequired();
755 gfan::ZCone* zp = (gfan::ZCone*)u->Data();
756 intvec* hv;
757 bool ok = true;
758 try
759 {
760 polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
761 polymake::Vector<polymake::Integer> phv = p->give("H_STAR_VECTOR");
762 delete p;
763 hv = PmVectorInteger2Intvec(&phv,ok);
764 }
765 catch (const std::exception& ex)
766 {
767 gfan::deinitializeCddlibIfRequired();
768 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
769 return TRUE;
770 }
771 gfan::deinitializeCddlibIfRequired();
772 if (!ok)
773 {
774 WerrorS("hStarVector: overflow in PmVectorInteger2Intvec");
775 return TRUE;
776 }
777 res->rtyp = INTVEC_CMD;
778 res->data = (char*) hv;
779 return FALSE;
780 }
781 WerrorS("hStarVector: unexpected parameters");
782 return TRUE;
783}

◆ PMhVector()

BOOLEAN PMhVector ( leftv  res,
leftv  args 
)

Definition at line 712 of file polymake_wrapper.cc.

713{
714 leftv u = args;
715 if ((u != NULL) && (u->Typ() == polytopeID))
716 {
717 gfan::initializeCddlibIfRequired();
718 gfan::ZCone* zp = (gfan::ZCone*)u->Data();
719 intvec* hv;
720 bool ok = true;
721 try
722 {
723 polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
724 polymake::Vector<polymake::Integer> phv = p->give("H_VECTOR");
725 delete p;
726 hv = PmVectorInteger2Intvec(&phv,ok);
727 }
728 catch (const std::exception& ex)
729 {
730 gfan::deinitializeCddlibIfRequired();
731 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
732 return TRUE;
733 }
734 gfan::deinitializeCddlibIfRequired();
735 if (!ok)
736 {
737 WerrorS("hVector: overflow in PmVectorInteger2Intvec");
738 return TRUE;
739 }
740 res->rtyp = INTVEC_CMD;
741 res->data = (char*) hv;
742 return FALSE;
743 }
744 WerrorS("hVector: unexpected parameters");
745 return TRUE;
746}

◆ PMinteriorLatticePoints()

BOOLEAN PMinteriorLatticePoints ( leftv  res,
leftv  args 
)

Definition at line 1143 of file polymake_wrapper.cc.

1144{
1145 leftv u = args;
1146 if ((u != NULL) && (u->Typ() == polytopeID))
1147 {
1148 gfan::initializeCddlibIfRequired();
1149 gfan::ZCone* zp = (gfan::ZCone*)u->Data();
1150 intvec* iv;
1151 bool ok = true;
1152 try
1153 {
1154 polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
1155 polymake::Matrix<polymake::Integer> lp = p->give("INTERIOR_LATTICE_POINTS");
1156 delete p;
1157 iv = PmMatrixInteger2Intvec(&lp,ok);
1158 }
1159 catch (const std::exception& ex)
1160 {
1161 gfan::deinitializeCddlibIfRequired();
1162 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1163 return TRUE;
1164 }
1165 gfan::deinitializeCddlibIfRequired();
1166 if (!ok)
1167 {
1168 WerrorS("overflow while converting polymake::Integer to int");
1169 return TRUE;
1170 }
1171 res->rtyp = INTMAT_CMD;
1172 res->data = (char*) iv;
1173 return FALSE;
1174 }
1175 WerrorS("interiorLatticePoints: unexpected parameters");
1176 return TRUE;
1177}

◆ PMisBounded()

BOOLEAN PMisBounded ( leftv  res,
leftv  args 
)

Definition at line 251 of file polymake_wrapper.cc.

252{
253 leftv u = args;
254 if ((u != NULL) && (u->Typ() == polytopeID))
255 {
256 gfan::initializeCddlibIfRequired();
257 gfan::ZCone* zp = (gfan::ZCone*)u->Data();
258 bool b;
259 try
260 {
261 polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
262 b = p->give("BOUNDED");
263 delete p;
264 }
265 catch (const std::exception& ex)
266 {
267 gfan::deinitializeCddlibIfRequired();
268 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
269 return TRUE;
270 }
271 gfan::deinitializeCddlibIfRequired();
272 res->rtyp = INT_CMD;
273 res->data = (char*) (long) b;
274 return FALSE;
275 }
276 WerrorS("isBounded: unexpected parameters");
277 return TRUE;
278}

◆ PMisCanonical()

BOOLEAN PMisCanonical ( leftv  res,
leftv  args 
)

Definition at line 437 of file polymake_wrapper.cc.

438{
439 leftv u = args;
440 if ((u != NULL) && (u->Typ() == polytopeID))
441 {
442 gfan::initializeCddlibIfRequired();
443 gfan::ZCone* zp = (gfan::ZCone*)u->Data();
444 bool b;
445 try
446 {
447 polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
448 b = p->give("CANONICAL");
449 delete p;
450 }
451 catch (const std::exception& ex)
452 {
453 gfan::deinitializeCddlibIfRequired();
454 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
455 return TRUE;
456 }
457 gfan::deinitializeCddlibIfRequired();
458 res->rtyp = INT_CMD;
459 res->data = (char*) (long) b;
460 return FALSE;
461 }
462 WerrorS("isCanonical: unexpected parameters");
463 return TRUE;
464}

◆ PMisCompressed()

BOOLEAN PMisCompressed ( leftv  res,
leftv  args 
)

Definition at line 927 of file polymake_wrapper.cc.

928{
929 leftv u = args;
930 if ((u != NULL) && (u->Typ() == polytopeID))
931 {
932 gfan::initializeCddlibIfRequired();
933 gfan::ZCone* zp = (gfan::ZCone*)u->Data();
934 bool b;
935 try
936 {
937 polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
938 b = p->give("COMPRESSED");
939 delete p;
940 }
941 catch (const std::exception& ex)
942 {
943 gfan::deinitializeCddlibIfRequired();
944 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
945 return TRUE;
946 }
947 gfan::deinitializeCddlibIfRequired();
948 res->rtyp = INT_CMD;
949 res->data = (char*) (long) b;
950 return FALSE;
951 }
952 WerrorS("isCompressed: unexpected parameters");
953 return TRUE;
954}

◆ PMisGorenstein()

BOOLEAN PMisGorenstein ( leftv  res,
leftv  args 
)

Definition at line 311 of file polymake_wrapper.cc.

312{
313 leftv u = args;
314 if ((u != NULL) && (u->Typ() == polytopeID))
315 {
316 gfan::initializeCddlibIfRequired();
317 gfan::ZCone* zp = (gfan::ZCone*)u->Data();
318 bool b;
319 try
320 {
321 polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
322 b = p->give("GORENSTEIN");
323 delete p;
324 }
325 catch (const std::exception& ex)
326 {
327 gfan::deinitializeCddlibIfRequired();
328 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
329 return TRUE;
330 }
331 gfan::deinitializeCddlibIfRequired();
332 res->rtyp = INT_CMD;
333 res->data = (char*) (long) b;
334 return FALSE;
335 }
336 WerrorS("isGorenstein: unexpected parameters");
337 return TRUE;
338}

◆ PMisLatticeEmpty()

BOOLEAN PMisLatticeEmpty ( leftv  res,
leftv  args 
)

Definition at line 497 of file polymake_wrapper.cc.

498{
499 leftv u = args;
500 if ((u != NULL) && (u->Typ() == polytopeID))
501 {
502 gfan::initializeCddlibIfRequired();
503 gfan::ZCone* zp = (gfan::ZCone*)u->Data();
504 bool b;
505 try
506 {
507 polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
508 b = p->give("LATTICE_EMPTY");
509 delete p;
510 }
511 catch (const std::exception& ex)
512 {
513 gfan::deinitializeCddlibIfRequired();
514 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
515 return TRUE;
516 }
517 gfan::deinitializeCddlibIfRequired();
518 res->rtyp = INT_CMD;
519 res->data = (char*) (long) b;
520 return FALSE;
521 }
522 WerrorS("isLatticeEmpty: unexpected parameters");
523 return TRUE;
524}

◆ PMisLatticePolytope()

BOOLEAN PMisLatticePolytope ( leftv  res,
leftv  args 
)

Definition at line 221 of file polymake_wrapper.cc.

222{
223 leftv u = args;
224 if ((u != NULL) && (u->Typ() == polytopeID))
225 {
226 gfan::initializeCddlibIfRequired();
227 gfan::ZCone* zp = (gfan::ZCone*)u->Data();
228 bool b;
229 try
230 {
231 polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
232 b = p->give("Lattice");
233 delete p;
234 }
235 catch (const std::exception& ex)
236 {
237 gfan::deinitializeCddlibIfRequired();
238 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
239 return TRUE;
240 }
241 gfan::deinitializeCddlibIfRequired();
242 res->rtyp = INT_CMD;
243 res->data = (char*) (long) b;
244 return FALSE;
245 }
246 WerrorS("isLatticePolytope: unexpected parameters");
247 return TRUE;
248}

◆ PMisNormal()

BOOLEAN PMisNormal ( leftv  res,
leftv  args 
)

Definition at line 786 of file polymake_wrapper.cc.

787{
788 leftv u = args;
789 if ((u != NULL) && (u->Typ() == polytopeID))
790 {
791 gfan::initializeCddlibIfRequired();
792 gfan::ZCone* zp = (gfan::ZCone*)u->Data();
793 bool b;
794 try
795 {
796 polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
797 b = p->give("NORMAL");
798 delete p;
799 }
800 catch (const std::exception& ex)
801 {
802 gfan::deinitializeCddlibIfRequired();
803 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
804 return TRUE;
805 }
806 gfan::deinitializeCddlibIfRequired();
807 res->rtyp = INT_CMD;
808 res->data = (char*) (long) b;
809 return FALSE;
810 }
811 WerrorS("isNormal: unexpected parameters");
812 return TRUE;
813}

◆ PMisReflexive()

BOOLEAN PMisReflexive ( leftv  res,
leftv  args 
)

Definition at line 281 of file polymake_wrapper.cc.

282{
283 leftv u = args;
284 if ((u != NULL) && (u->Typ() == polytopeID))
285 {
286 gfan::initializeCddlibIfRequired();
287 gfan::ZCone* zp = (gfan::ZCone*)u->Data();
288 bool b;
289 try
290 {
291 polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
292 b = p->give("REFLEXIVE");
293 delete p;
294 }
295 catch (const std::exception& ex)
296 {
297 gfan::deinitializeCddlibIfRequired();
298 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
299 return TRUE;
300 }
301 gfan::deinitializeCddlibIfRequired();
302 res->rtyp = INT_CMD;
303 res->data = (char*) (long) b;
304 return FALSE;
305 }
306 WerrorS("isReflexive: unexpected parameters");
307 return TRUE;
308}

◆ PMisSmooth()

BOOLEAN PMisSmooth ( leftv  res,
leftv  args 
)

Definition at line 957 of file polymake_wrapper.cc.

958{
959 leftv u = args;
960 if ((u != NULL) && (u->Typ() == coneID))
961 {
962 gfan::initializeCddlibIfRequired();
963 gfan::ZCone* zc = (gfan::ZCone*)u->Data();
964 bool b;
965 try
966 {
967 polymake::perl::Object* p = ZCone2PmCone(zc);
968 b = p->give("SMOOTH_CONE");
969 delete p;
970 }
971 catch (const std::exception& ex)
972 {
973 gfan::deinitializeCddlibIfRequired();
974 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
975 return TRUE;
976 }
977 gfan::deinitializeCddlibIfRequired();
978 res->rtyp = INT_CMD;
979 res->data = (char*) (long) b;
980 return FALSE;
981 }
982 if ((u != NULL) && (u->Typ() == polytopeID))
983 {
984 gfan::initializeCddlibIfRequired();
985 gfan::ZCone* zp = (gfan::ZCone*)u->Data();
986 bool b;
987 try
988 {
989 polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
990 b = p->give("SMOOTH");
991 delete p;
992 }
993 catch (const std::exception& ex)
994 {
995 gfan::deinitializeCddlibIfRequired();
996 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
997 return TRUE;
998 }
999 gfan::deinitializeCddlibIfRequired();
1000 res->rtyp = INT_CMD;
1001 res->data = (char*) (long) b;
1002 return FALSE;
1003 }
1004 if ((u != NULL) && (u->Typ() == fanID))
1005 {
1006 gfan::initializeCddlibIfRequired();
1007 gfan::ZFan* zf = (gfan::ZFan*)u->Data();
1008 bool b;
1009 try
1010 {
1011 polymake::perl::Object* p = ZFan2PmFan(zf);
1012 b = p->give("SMOOTH_FAN");
1013 delete p;
1014 }
1015 catch (const std::exception& ex)
1016 {
1017 gfan::deinitializeCddlibIfRequired();
1018 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1019 return TRUE;
1020 }
1021 gfan::deinitializeCddlibIfRequired();
1022 res->rtyp = INT_CMD;
1023 res->data = (char*) (long) b;
1024 return FALSE;
1025 }
1026 WerrorS("isSmooth: unexpected parameters");
1027 return TRUE;
1028}
polymake::perl::Object * ZFan2PmFan(gfan::ZFan *zf)
polymake::perl::Object * ZCone2PmCone(gfan::ZCone *zc)

◆ PMisTerminal()

BOOLEAN PMisTerminal ( leftv  res,
leftv  args 
)

Definition at line 467 of file polymake_wrapper.cc.

468{
469 leftv u = args;
470 if ((u != NULL) && (u->Typ() == polytopeID))
471 {
472 gfan::initializeCddlibIfRequired();
473 gfan::ZCone* zp = (gfan::ZCone*)u->Data();
474 bool b;
475 try
476 {
477 polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
478 b = p->give("TERMINAL");
479 delete p;
480 }
481 catch (const std::exception& ex)
482 {
483 gfan::deinitializeCddlibIfRequired();
484 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
485 return TRUE;
486 }
487 gfan::deinitializeCddlibIfRequired();
488 res->rtyp = INT_CMD;
489 res->data = (char*) (long) b;
490 return FALSE;
491 }
492 WerrorS("isTerminal: unexpected parameters");
493 return TRUE;
494}

◆ PMisVeryAmple()

BOOLEAN PMisVeryAmple ( leftv  res,
leftv  args 
)

Definition at line 1031 of file polymake_wrapper.cc.

1032{
1033 leftv u = args;
1034 if ((u != NULL) && (u->Typ() == polytopeID))
1035 {
1036 gfan::initializeCddlibIfRequired();
1037 gfan::ZCone* zp = (gfan::ZCone*)u->Data();
1038 bool b;
1039 try
1040 {
1041 polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
1042 b = p->give("VERY_AMPLE");
1043 delete p;
1044 }
1045 catch (const std::exception& ex)
1046 {
1047 gfan::deinitializeCddlibIfRequired();
1048 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1049 return TRUE;
1050 }
1051 gfan::deinitializeCddlibIfRequired();
1052 res->rtyp = INT_CMD;
1053 res->data = (char*) (long) b;
1054 return FALSE;
1055 }
1056 WerrorS("isVeryAmple: unexpected parameters");
1057 return TRUE;
1058}

◆ PMlatticeCodegree()

BOOLEAN PMlatticeCodegree ( leftv  res,
leftv  args 
)

Definition at line 601 of file polymake_wrapper.cc.

602{
603 leftv u = args;
604 if ((u != NULL) && (u->Typ() == polytopeID))
605 {
606 gfan::initializeCddlibIfRequired();
607 gfan::ZCone* zp = (gfan::ZCone*)u->Data();
608 int lc;
609 bool ok = true;
610 try
611 {
612 polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
613 polymake::Integer plc = p->give("LATTICE_CODEGREE");
614 delete p;
615 lc = PmInteger2Int(plc,ok);
616 }
617 catch (const std::exception& ex)
618 {
619 gfan::deinitializeCddlibIfRequired();
620 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
621 return TRUE;
622 }
623 gfan::deinitializeCddlibIfRequired();
624 if (!ok)
625 {
626 WerrorS("overflow while converting polymake::Integer to int");
627 return TRUE;
628 }
629 res->rtyp = INT_CMD;
630 res->data = (char*) (long) lc;
631 return FALSE;
632 }
633 WerrorS("latticeCodegree: unexpected parameters");
634 return TRUE;
635}
CanonicalForm lc(const CanonicalForm &f)

◆ PMlatticeDegree()

BOOLEAN PMlatticeDegree ( leftv  res,
leftv  args 
)

Definition at line 564 of file polymake_wrapper.cc.

565{
566 leftv u = args;
567 if ((u != NULL) && (u->Typ() == polytopeID))
568 {
569 gfan::initializeCddlibIfRequired();
570 gfan::ZCone* zp = (gfan::ZCone*)u->Data();
571 int ld;
572 bool ok = true;
573 try
574 {
575 polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
576 polymake::Integer pld = p->give("LATTICE_DEGREE");
577 delete p;
578 ld = PmInteger2Int(pld,ok);
579 }
580 catch (const std::exception& ex)
581 {
582 gfan::deinitializeCddlibIfRequired();
583 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
584 return TRUE;
585 }
586 gfan::deinitializeCddlibIfRequired();
587 if (!ok)
588 {
589 WerrorS("overflow while converting polymake::Integer to int");
590 return TRUE;
591 }
592 res->rtyp = INT_CMD;
593 res->data = (char*) (long) ld;
594 return FALSE;
595 }
596 WerrorS("latticeDegree: unexpected parameters");
597 return TRUE;
598}

◆ PMlatticePoints()

BOOLEAN PMlatticePoints ( leftv  res,
leftv  args 
)

Definition at line 1061 of file polymake_wrapper.cc.

1062{
1063 leftv u = args;
1064 if ((u != NULL) && (u->Typ() == polytopeID))
1065 {
1066 gfan::initializeCddlibIfRequired();
1067 gfan::ZCone* zp = (gfan::ZCone*)u->Data();
1068 intvec* iv;
1069 bool ok = true;
1070 try
1071 {
1072 polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
1073 #if (POLYMAKEVERSION >=305)
1074 polymake::Matrix<polymake::Integer> lp = p->call_method("LATTICE_POINTS");
1075 #elif (POLYMAKEVERSION >=214)
1076 polymake::Matrix<polymake::Integer> lp = p->CallPolymakeMethod("LATTICE_POINTS");
1077 #elif (POLYMAKEVERSION >=212)
1078 polymake::Matrix<polymake::Integer> lp = p->give("LATTICE_POINTS");
1079 #else
1080 #error polymake version too old
1081 #endif
1082 delete p;
1083 iv = PmMatrixInteger2Intvec(&lp,ok);
1084 }
1085 catch (const std::exception& ex)
1086 {
1087 gfan::deinitializeCddlibIfRequired();
1088 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1089 return TRUE;
1090 }
1091 gfan::deinitializeCddlibIfRequired();
1092 if (!ok)
1093 {
1094 WerrorS("overflow while converting polymake::Integer to int");
1095 return TRUE;
1096 }
1097 res->rtyp = INTMAT_CMD;
1098 res->data = (char*) iv;
1099 return FALSE;
1100 }
1101 WerrorS("LatticePoints: unexpected parameters");
1102 return TRUE;
1103}

◆ PMlatticeVolume()

BOOLEAN PMlatticeVolume ( leftv  res,
leftv  args 
)

Definition at line 527 of file polymake_wrapper.cc.

528{
529 leftv u = args;
530 if ((u != NULL) && (u->Typ() == polytopeID))
531 {
532 gfan::initializeCddlibIfRequired();
533 gfan::ZCone* zp = (gfan::ZCone*)u->Data();
534 int lv;
535 bool ok = true;
536 try
537 {
538 polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
539 polymake::Integer plv = p->give("LATTICE_VOLUME");
540 delete p;
541 lv = PmInteger2Int(plv,ok);
542 }
543 catch (const std::exception& ex)
544 {
545 gfan::deinitializeCddlibIfRequired();
546 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
547 return TRUE;
548 }
549 gfan::deinitializeCddlibIfRequired();
550 if (!ok)
551 {
552 WerrorS("overflow while converting polymake::Integer to int");
553 return TRUE;
554 }
555 res->rtyp = INT_CMD;
556 res->data = (char*) (long) lv;
557 return FALSE;
558 }
559 WerrorS("latticeVolume: unexpected parameters");
560 return TRUE;
561}

◆ PMmaximalFace()

BOOLEAN PMmaximalFace ( leftv  res,
leftv  args 
)

Definition at line 1544 of file polymake_wrapper.cc.

1545{
1546 leftv u = args;
1547 if ((u != NULL) && (u->Typ() == polytopeID))
1548 {
1549 leftv v = u->next;
1550 if ((v != NULL) && (v->Typ() == INTVEC_CMD))
1551 {
1552 gfan::initializeCddlibIfRequired();
1553 gfan::ZCone* zp = (gfan::ZCone*)u->Data();
1554 intvec* iv = (intvec*) v->Data();
1555 intvec* maxface;
1556 bool ok = true;
1557 try
1558 {
1559 polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
1560 polymake::perl::Object o("LinearProgram<Rational>");
1561 o.take("LINEAR_OBJECTIVE") << Intvec2PmVectorInteger(iv);
1562 p->take("LP") << o;
1563 polymake::Set<polymake::Integer> mf = p->give("LP.MAXIMAL_FACE");
1564 polymake::Matrix<polymake::Integer> vertices = verticesOf(p,&mf);
1565 delete p;
1566 maxface = new intvec(PmMatrixInteger2Intvec(&vertices,ok));
1567 }
1568 catch (const std::exception& ex)
1569 {
1570 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1571 gfan::deinitializeCddlibIfRequired();
1572 return TRUE;
1573 }
1574 gfan::deinitializeCddlibIfRequired();
1575 if (!ok)
1576 {
1577 WerrorS("overflow while converting polymake::Integer to int");
1578 return TRUE;
1579 }
1580 res->rtyp = INTVEC_CMD;
1581 res->data = (char*) maxface;
1582 return FALSE;
1583 }
1584 }
1585 WerrorS("maximalFace: unexpected parameters");
1586 return TRUE;
1587}
BOOLEAN vertices(leftv res, leftv args)
Definition: bbpolytope.cc:369
polymake::Vector< polymake::Integer > Intvec2PmVectorInteger(const intvec *iv)
polymake::Matrix< polymake::Integer > verticesOf(const polymake::perl::Object *p, const polymake::Set< polymake::Integer > *s)

◆ PMmaximalValue()

BOOLEAN PMmaximalValue ( leftv  res,
leftv  args 
)

Definition at line 1636 of file polymake_wrapper.cc.

1637{
1638 leftv u = args;
1639 if ((u != NULL) && (u->Typ() == polytopeID))
1640 {
1641 leftv v = u->next;
1642 if ((v != NULL) && (v->Typ() == INTVEC_CMD))
1643 {
1644 gfan::initializeCddlibIfRequired();
1645 gfan::ZCone* zp = (gfan::ZCone*)u->Data();
1646 intvec* iv = (intvec*) v->Data();
1647 if (iv->rows()==zp->ambientDimension())
1648 {
1649 int m;
1650 bool ok = true;
1651 try
1652 {
1653 polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
1654 polymake::Vector<polymake::Integer> lo = Intvec2PmVectorInteger(iv);
1655 polymake::perl::Object o("LinearProgram<Rational>");
1656 o.take("LINEAR_OBJECTIVE") << lo;
1657 p->take("LP") << o;
1658 polymake::Integer mv = p->give("LP.MAXIMAL_VALUE");
1659 delete p;
1660 m = PmInteger2Int(mv,ok);
1661 }
1662 catch (const std::exception& ex)
1663 {
1664 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1665 gfan::deinitializeCddlibIfRequired();
1666 return TRUE;
1667 }
1668 gfan::deinitializeCddlibIfRequired();
1669 if (!ok)
1670 {
1671 WerrorS("overflow while converting polymake::Integer to int");
1672 return TRUE;
1673 }
1674 res->rtyp = INT_CMD;
1675 res->data = (char*) (long) m;
1676 return FALSE;
1677 }
1678 }
1679 WerrorS("maximalValue: vector is of wrong size");
1680 return TRUE;
1681 }
1682 WerrorS("maximalValue: unexpected parameters");
1683 return TRUE;
1684}
int m
Definition: cfEzgcd.cc:128
int rows() const
Definition: intvec.h:96

◆ PMminimalFace()

BOOLEAN PMminimalFace ( leftv  res,
leftv  args 
)

Definition at line 1590 of file polymake_wrapper.cc.

1591{
1592 leftv u = args;
1593 if ((u != NULL) && (u->Typ() == polytopeID))
1594 {
1595 leftv v = u->next;
1596 if ((v != NULL) && (v->Typ() == INTVEC_CMD))
1597 {
1598 gfan::initializeCddlibIfRequired();
1599 gfan::ZCone* zp = (gfan::ZCone*)u->Data();
1600 intvec* iv = (intvec*) v->Data();
1601 intvec* minface;
1602 bool ok = true;
1603 try
1604 {
1605 polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
1606 polymake::perl::Object o("LinearProgram<Rational>");
1607 o.take("LINEAR_OBJECTIVE") << Intvec2PmVectorInteger(iv);
1608 p->take("LP") << o;
1609 polymake::Set<polymake::Integer> mf = p->give("LP.MINIMAL_FACE");
1610 polymake::Matrix<polymake::Integer> vertices = verticesOf(p,&mf);
1611 delete p;
1612 minface = new intvec(PmMatrixInteger2Intvec(&vertices,ok));
1613 }
1614 catch (const std::exception& ex)
1615 {
1616 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1617 gfan::deinitializeCddlibIfRequired();
1618 return TRUE;
1619 }
1620 gfan::deinitializeCddlibIfRequired();
1621 if (!ok)
1622 {
1623 WerrorS("overflow while converting polymake::Integer to int");
1624 return TRUE;
1625 }
1626 res->rtyp = INTVEC_CMD;
1627 res->data = (char*) minface;
1628 return FALSE;
1629 }
1630 }
1631 WerrorS("minimalFace: unexpected parameters");
1632 return TRUE;
1633}

◆ PMminimalValue()

BOOLEAN PMminimalValue ( leftv  res,
leftv  args 
)

Definition at line 1686 of file polymake_wrapper.cc.

1687{
1688 leftv u = args;
1689 if ((u != NULL) && (u->Typ() == polytopeID))
1690 {
1691 leftv v = u->next;
1692 if ((v != NULL) && (v->Typ() == INTVEC_CMD))
1693 {
1694 gfan::initializeCddlibIfRequired();
1695 gfan::ZCone* zp = (gfan::ZCone*)u->Data();
1696 intvec* iv = (intvec*) v->Data();
1697 if (iv->rows()==zp->ambientDimension())
1698 {
1699 int m;
1700 bool ok = true;
1701 try
1702 {
1703 polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
1704 polymake::Vector<polymake::Integer> lo = Intvec2PmVectorInteger(iv);
1705 polymake::perl::Object o("LinearProgram<Rational>");
1706 o.take("LINEAR_OBJECTIVE") << lo;
1707 p->take("LP") << o;
1708 polymake::Integer mv = p->give("LP.MINIMAL_VALUE");
1709 delete p;
1710 m = PmInteger2Int(mv,ok);
1711 }
1712 catch (const std::exception& ex)
1713 {
1714 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1715 gfan::deinitializeCddlibIfRequired();
1716 return TRUE;
1717 }
1718 gfan::deinitializeCddlibIfRequired();
1719 if (!ok)
1720 {
1721 WerrorS("overflow while converting polymake::Integer to int");
1722 return TRUE;
1723 }
1724 res->rtyp = INT_CMD;
1725 res->data = (char*) (long) m;
1726 return FALSE;
1727 }
1728 }
1729 WerrorS("minimalValue: vector is of wrong size");
1730 return TRUE;
1731 }
1732 WerrorS("minimalValue: unexpected parameters");
1733 return TRUE;
1734}

◆ PMminkowskiSum()

BOOLEAN PMminkowskiSum ( leftv  res,
leftv  args 
)

Definition at line 1373 of file polymake_wrapper.cc.

1374{
1375 leftv u = args;
1376 if ((u != NULL) && (u->Typ() == polytopeID))
1377 {
1378 leftv v = u->next;
1379 if ((v != NULL) && (v->Typ() == polytopeID))
1380 {
1381 gfan::initializeCddlibIfRequired();
1382 gfan::ZCone* zp = (gfan::ZCone*)u->Data();
1383 gfan::ZCone* zq = (gfan::ZCone*)v->Data();
1384 gfan::ZCone* ms;
1385 try
1386 {
1387 polymake::perl::Object* pp = ZPolytope2PmPolytope(zp);
1388 polymake::perl::Object* pq = ZPolytope2PmPolytope(zq);
1389 polymake::perl::Object pms;
1390 #if (POLYMAKE_VERSION >= 305)
1391 polymake::call_function("minkowski_sum", *pp, *pq) >> pms;
1392 #else
1393 CallPolymakeFunction("minkowski_sum", *pp, *pq) >> pms;
1394 #endif
1395 delete pp;
1396 delete pq;
1397 ms = PmPolytope2ZPolytope(&pms);
1398 }
1399 catch (const std::exception& ex)
1400 {
1401 gfan::deinitializeCddlibIfRequired();
1402 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1403 return TRUE;
1404 }
1405 gfan::deinitializeCddlibIfRequired();
1406 res->rtyp = polytopeID;
1407 res->data = (char*) ms;
1408 return FALSE;
1409 }
1410 if ((v != NULL) && (v->Typ() == coneID))
1411 {
1412 gfan::initializeCddlibIfRequired();
1413 gfan::ZCone* zp = (gfan::ZCone*)u->Data();
1414 gfan::ZCone* zc = (gfan::ZCone*)v->Data();
1415 gfan::ZCone* zq = new gfan::ZCone(liftUp(*zc));
1416 gfan::ZCone* ms;
1417 try
1418 {
1419 polymake::perl::Object* pp = ZPolytope2PmPolytope(zp);
1420 polymake::perl::Object* pq = ZPolytope2PmPolytope(zq);
1421 polymake::perl::Object pms;
1422 #if (POLYMAKE_VERSION >= 305)
1423 polymake::call_function("minkowski_sum", *pp, *pq) >> pms;
1424 #else
1425 CallPolymakeFunction("minkowski_sum", *pp, *pq) >> pms;
1426 #endif
1427 delete pp;
1428 delete pq;
1429 ms = PmPolytope2ZPolytope(&pms);
1430 }
1431 catch (const std::exception& ex)
1432 {
1433 delete zq;
1434 gfan::deinitializeCddlibIfRequired();
1435 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1436 return TRUE;
1437 }
1438 delete zq;
1439 gfan::deinitializeCddlibIfRequired();
1440 res->rtyp = polytopeID;
1441 res->data = (char*) ms;
1442 return FALSE;
1443 }
1444 }
1445 if ((u != NULL) && (u->Typ() == coneID))
1446 {
1447 leftv v = u->next;
1448 if ((v != NULL) && (v->Typ() == polytopeID))
1449 {
1450 gfan::initializeCddlibIfRequired();
1451 gfan::ZCone* zc = (gfan::ZCone*)u->Data();
1452 gfan::ZCone* zp = new gfan::ZCone(liftUp(*zc));
1453 gfan::ZCone* zq = (gfan::ZCone*)v->Data();
1454 gfan::ZCone* ms;
1455 try
1456 {
1457 polymake::perl::Object* pp = ZPolytope2PmPolytope(zp);
1458 polymake::perl::Object* pq = ZPolytope2PmPolytope(zq);
1459 polymake::perl::Object pms;
1460 #if (POLYMAKE_VERSION >= 305)
1461 polymake::call_function("minkowski_sum", *pp, *pq) >> pms;
1462 #else
1463 CallPolymakeFunction("minkowski_sum", *pp, *pq) >> pms;
1464 #endif
1465 delete pp;
1466 delete pq;
1467 ms = PmPolytope2ZPolytope(&pms);
1468 }
1469 catch (const std::exception& ex)
1470 {
1471 delete zp;
1472 gfan::deinitializeCddlibIfRequired();
1473 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1474 return TRUE;
1475 }
1476 delete zp;
1477 gfan::deinitializeCddlibIfRequired();
1478 res->rtyp = polytopeID;
1479 res->data = (char*) ms;
1480 return FALSE;
1481 }
1482 if ((v != NULL) && (v->Typ() == coneID))
1483 {
1484 gfan::initializeCddlibIfRequired();
1485 gfan::ZCone* zp = (gfan::ZCone*)u->Data();
1486 gfan::ZCone* zq = (gfan::ZCone*)v->Data();
1487 gfan::ZCone* ms;
1488 try
1489 {
1490 polymake::perl::Object* pp = ZPolytope2PmPolytope(zp);
1491 polymake::perl::Object* pq = ZPolytope2PmPolytope(zq);
1492 polymake::perl::Object pms;
1493 #if (POLYMAKE_VERSION >= 305)
1494 polymake::call_function("minkowski_sum", *pp, *pq) >> pms;
1495 #else
1496 CallPolymakeFunction("minkowski_sum", *pp, *pq) >> pms;
1497 #endif
1498 delete pp;
1499 delete pq;
1500 ms = PmPolytope2ZPolytope(&pms);
1501 }
1502 catch (const std::exception& ex)
1503 {
1504 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1505 gfan::deinitializeCddlibIfRequired();
1506 return TRUE;
1507 }
1508 gfan::deinitializeCddlibIfRequired();
1509 res->rtyp = coneID;
1510 res->data = (char*) ms;
1511 return FALSE;
1512 }
1513 }
1514 WerrorS("minkowskiSum: unexpected parameters");
1515 return TRUE;
1516}
gfan::ZMatrix liftUp(const gfan::ZMatrix &zm)
Definition: bbcone.cc:1170

◆ PMnBoundaryLatticePoints()

BOOLEAN PMnBoundaryLatticePoints ( leftv  res,
leftv  args 
)

Definition at line 1254 of file polymake_wrapper.cc.

1255{
1256 leftv u = args;
1257 if ((u != NULL) && (u->Typ() == polytopeID))
1258 {
1259 gfan::initializeCddlibIfRequired();
1260 gfan::ZCone* zp = (gfan::ZCone*)u->Data();
1261 int n;
1262 bool ok = true;
1263 try
1264 {
1265 polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
1266 polymake::Integer nlp = p->give("N_BOUNDARY_LATTICE_POINTS");
1267 delete p;
1268 n = PmInteger2Int(nlp,ok);
1269 }
1270 catch (const std::exception& ex)
1271 {
1272 gfan::deinitializeCddlibIfRequired();
1273 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1274 return TRUE;
1275 }
1276 gfan::deinitializeCddlibIfRequired();
1277 if (!ok)
1278 {
1279 WerrorS("overflow while converting polymake::Integer to int");
1280 return TRUE;
1281 }
1282 res->rtyp = INT_CMD;
1283 res->data = (char*) (long) n;
1284 return FALSE;
1285 }
1286 WerrorS("nBoundaryLatticePoints: unexpected parameters");
1287 return TRUE;
1288}

◆ PMnHilbertBasis()

BOOLEAN PMnHilbertBasis ( leftv  res,
leftv  args 
)

Definition at line 1336 of file polymake_wrapper.cc.

1337{
1338 leftv u = args;
1339 if ((u != NULL) && (u->Typ() == coneID))
1340 {
1341 gfan::initializeCddlibIfRequired();
1342 gfan::ZCone* zp = (gfan::ZCone*)u->Data();
1343 int n;
1344 bool ok = true;
1345 try
1346 {
1347 polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
1348 polymake::Integer nlp = p->give("N_HILBERT_BASIS");
1349 delete p;
1350 n = PmInteger2Int(nlp,ok);
1351 }
1352 catch (const std::exception& ex)
1353 {
1354 gfan::deinitializeCddlibIfRequired();
1355 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1356 return TRUE;
1357 }
1358 gfan::deinitializeCddlibIfRequired();
1359 if (!ok)
1360 {
1361 WerrorS("overflow while converting polymake::Integer to int");
1362 return TRUE;
1363 }
1364 res->rtyp = INT_CMD;
1365 res->data = (char*) (long) n;
1366 return FALSE;
1367 }
1368 WerrorS("nHilbertBasis: unexpected parameters");
1369 return TRUE;
1370}

◆ PMnInteriorLatticePoints()

BOOLEAN PMnInteriorLatticePoints ( leftv  res,
leftv  args 
)

Definition at line 1180 of file polymake_wrapper.cc.

1181{
1182 leftv u = args;
1183 if ((u != NULL) && (u->Typ() == polytopeID))
1184 {
1185 gfan::initializeCddlibIfRequired();
1186 gfan::ZCone* zp = (gfan::ZCone*)u->Data();
1187 int n;
1188 bool ok = true;
1189 try
1190 {
1191 polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
1192 polymake::Integer nlp = p->give("N_INTERIOR_LATTICE_POINTS");
1193 delete p;
1194 n = PmInteger2Int(nlp,ok);
1195 }
1196 catch (const std::exception& ex)
1197 {
1198 gfan::deinitializeCddlibIfRequired();
1199 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1200 return TRUE;
1201 }
1202 gfan::deinitializeCddlibIfRequired();
1203 if (!ok)
1204 {
1205 WerrorS("overflow while converting polymake::Integer to int");
1206 return TRUE;
1207 }
1208 res->rtyp = INT_CMD;
1209 res->data = (char*) (long) n;
1210 return FALSE;
1211 }
1212 WerrorS("nInteriorLatticePoints: unexpected parameters");
1213 return TRUE;
1214}

◆ PMnLatticePoints()

BOOLEAN PMnLatticePoints ( leftv  res,
leftv  args 
)

Definition at line 1106 of file polymake_wrapper.cc.

1107{
1108 leftv u = args;
1109 if ((u != NULL) && (u->Typ() == polytopeID))
1110 {
1111 gfan::initializeCddlibIfRequired();
1112 gfan::ZCone* zp = (gfan::ZCone*)u->Data();
1113 int n;
1114 bool ok = true;
1115 try
1116 {
1117 polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
1118 polymake::Integer nlp = p->give("N_LATTICE_POINTS");
1119 delete p;
1120 n = PmInteger2Int(nlp,ok);
1121 }
1122 catch (const std::exception& ex)
1123 {
1124 gfan::deinitializeCddlibIfRequired();
1125 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1126 return TRUE;
1127 }
1128 gfan::deinitializeCddlibIfRequired();
1129 if (!ok)
1130 {
1131 WerrorS("overflow while converting polymake::Integer to int");
1132 return TRUE;
1133 }
1134 res->rtyp = INT_CMD;
1135 res->data = (char*) (long) n;
1136 return FALSE;
1137 }
1138 WerrorS("nLatticePoints: unexpected parameters");
1139 return TRUE;
1140}

◆ PMpolytopeViaVertices()

BOOLEAN PMpolytopeViaVertices ( leftv  res,
leftv  args 
)

Definition at line 1864 of file polymake_wrapper.cc.

1865{
1866 leftv u = args;
1867 if ((u != NULL) && (u->Typ() == INTMAT_CMD))
1868 {
1869 gfan::initializeCddlibIfRequired();
1870 polymake::perl::Object pp("Polytope<Rational>");
1871 intvec* points = (intvec*) u->Data(); // these will be vertices of or points in the polytope
1872 polymake::Matrix<polymake::Integer> pmpoints = Intvec2PmMatrixInteger(points);
1873
1874 leftv v = u->next;
1875 if ((v != NULL) && (v->Typ() == INT_CMD))
1876 {
1877 int flag = (int) (long) v->Data();
1878 switch(flag)
1879 {
1880 case 0: pp.take("POINTS") << pmpoints; // case means the matrix may contain points inside the polytope
1881 case 1: pp.take("VERTICES") << pmpoints; // case means the matrix only contains vertices of the polytope
1882 default: WerrorS("polytopeViaVertices: invalid flag");
1883 }
1884 }
1885 else
1886 pp.take("POINTS") << pmpoints; // by default, we assume that matrix may contain non-vertices
1887
1888 gfan::ZCone* zp = PmPolytope2ZPolytope(&pp);
1889 gfan::deinitializeCddlibIfRequired();
1890 res->rtyp = polytopeID;
1891 res->data = (char*) zp;
1892 return FALSE;
1893 }
1894 WerrorS("polytopeViaVertices: unexpected parameters");
1895 return TRUE;
1896}
STATIC_VAR coordinates * points

◆ PMvertexAdjacencyGraph()

BOOLEAN PMvertexAdjacencyGraph ( leftv  res,
leftv  args 
)

Definition at line 1899 of file polymake_wrapper.cc.

1900{
1901 leftv u = args;
1902 if ((u != NULL) && (u->Typ() == polytopeID))
1903 {
1904 gfan::initializeCddlibIfRequired();
1905 gfan::ZCone* zp = (gfan::ZCone*) u->Data();
1906 lists output=(lists)omAllocBin(slists_bin); output->Init(2);
1907 try
1908 {
1909 polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
1910 polymake::Matrix<polymake::Integer> vert0 = p->give("VERTICES");
1911 bigintmat* vert1 = PmMatrixInteger2Bigintmat(&vert0);
1912 output->m[0].rtyp = BIGINTMAT_CMD;
1913 output->m[0].data = (void*) vert1;
1914
1915 polymake::Graph<> gr=p->give("GRAPH.ADJACENCY");
1916 polymake::IncidenceMatrix<polymake::NonSymmetric> adj = adjacency_matrix(gr);
1917 lists listOfEdges = PmIncidenceMatrix2ListOfIntvecs(&adj);
1918 output->m[1].rtyp = LIST_CMD;
1919 output->m[1].data = (void*) listOfEdges;
1920 delete p;
1921 }
1922 catch (const std::exception& ex)
1923 {
1924 gfan::deinitializeCddlibIfRequired();
1925 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1926 return TRUE;
1927 }
1928 gfan::deinitializeCddlibIfRequired();
1929 res->rtyp = LIST_CMD;
1930 res->data = (void*) output;
1931 return FALSE;
1932 }
1933 WerrorS("vertexEdgeGraph: unexpected parameters");
1934 return TRUE;
1935}
Matrices of numbers.
Definition: bigintmat.h:51
int rtyp
Definition: subexpr.h:91
void * data
Definition: subexpr.h:88
Definition: lists.h:24
sleftv * m
Definition: lists.h:46
INLINE_THIS void Init(int l=0)
@ BIGINTMAT_CMD
Definition: grammar.cc:278
VAR omBin slists_bin
Definition: lists.cc:23
slists * lists
Definition: mpr_numeric.h:146
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
lists PmIncidenceMatrix2ListOfIntvecs(polymake::IncidenceMatrix< polymake::NonSymmetric > *icmat)
bigintmat * PmMatrixInteger2Bigintmat(polymake::Matrix< polymake::Integer > *mi)
@ LIST_CMD
Definition: tok.h:118

◆ PMvertexEdgeGraph()

BOOLEAN PMvertexEdgeGraph ( leftv  res,
leftv  args 
)

Definition at line 1938 of file polymake_wrapper.cc.

1939{
1940 leftv u = args;
1941 if ((u != NULL) && (u->Typ() == polytopeID))
1942 {
1943 gfan::initializeCddlibIfRequired();
1944 gfan::ZCone* zp = (gfan::ZCone*) u->Data();
1945 lists output=(lists)omAllocBin(slists_bin); output->Init(2);
1946 try
1947 {
1948 polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
1949 polymake::Matrix<polymake::Integer> vert0 = p->give("VERTICES");
1950 bigintmat* vert1 = PmMatrixInteger2Bigintmat(&vert0);
1951 output->m[0].rtyp = BIGINTMAT_CMD;
1952 output->m[0].data = (void*) vert1;
1953
1954 polymake::Graph<> gr=p->give("GRAPH.ADJACENCY");
1955 polymake::IncidenceMatrix<polymake::NonSymmetric> adj = adjacency_matrix(gr);
1956 lists listOfEdges = PmAdjacencyMatrix2ListOfEdges(&adj);
1957 output->m[1].rtyp = LIST_CMD;
1958 output->m[1].data = (void*) listOfEdges;
1959 delete p;
1960 }
1961 catch (const std::exception& ex)
1962 {
1963 gfan::deinitializeCddlibIfRequired();
1964 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1965 return TRUE;
1966 }
1967 gfan::deinitializeCddlibIfRequired();
1968 res->rtyp = LIST_CMD;
1969 res->data = (void*) output;
1970 return FALSE;
1971 }
1972 WerrorS("vertexEdgeGraph: unexpected parameters");
1973 return TRUE;
1974}
lists PmAdjacencyMatrix2ListOfEdges(polymake::IncidenceMatrix< polymake::NonSymmetric > *icmat)

◆ polymake()

int SI_MOD_INIT() polymake ( SModulFunctions p)

Definition at line 1979 of file polymake_wrapper.cc.

1980{
1981 omp_set_num_threads(1); // avoid multiple threads within polymake/libnormaliz
1982 if (init_polymake==NULL)
1983 {init_polymake = new polymake::Main();}
1984 init_polymake->set_application("fan");
1985 // p->iiAddCproc("polymake.so","coneViaPoints",FALSE,PMconeViaRays);
1986 // p->iiAddCproc("polymake.so","polytopeViaPoints",FALSE,PMpolytopeViaVertices);
1987 p->iiAddCproc("polymake.lib","isLatticePolytope",FALSE,PMisLatticePolytope);
1988 p->iiAddCproc("polymake.lib","isBounded",FALSE,PMisBounded);
1989 p->iiAddCproc("polymake.lib","isReflexive",FALSE,PMisReflexive);
1990 p->iiAddCproc("polymake.lib","isGorenstein",FALSE,PMisGorenstein);
1991 p->iiAddCproc("polymake.lib","gorensteinIndex",FALSE,PMgorensteinIndex);
1992 p->iiAddCproc("polymake.lib","gorensteinVector",FALSE,PMgorensteinVector);
1993 p->iiAddCproc("polymake.lib","isCanonical",FALSE,PMisCanonical);
1994 p->iiAddCproc("polymake.lib","isTerminal",FALSE,PMisTerminal);
1995 p->iiAddCproc("polymake.lib","isLatticeEmpty",FALSE,PMisLatticeEmpty);
1996 p->iiAddCproc("polymake.lib","latticeVolume",FALSE,PMlatticeVolume);
1997 p->iiAddCproc("polymake.lib","latticeDegree",FALSE,PMlatticeDegree);
1998 p->iiAddCproc("polymake.lib","latticeCodegree",FALSE,PMlatticeCodegree);
1999 p->iiAddCproc("polymake.lib","ehrhartPolynomialCoeff",FALSE,PMehrhartPolynomialCoeff);
2000 p->iiAddCproc("polymake.lib","fVectorP",FALSE,PMfVector);
2001 p->iiAddCproc("polymake.lib","hVector",FALSE,PMhVector);
2002 p->iiAddCproc("polymake.lib","hStarVector",FALSE,PMhStarVector);
2003 p->iiAddCproc("polymake.lib","isNormal",FALSE,PMisNormal);
2004 p->iiAddCproc("polymake.lib","facetWidths",FALSE,PMfacetWidths);
2005 p->iiAddCproc("polymake.lib","facetWidth",FALSE,PMfacetWidth);
2006 p->iiAddCproc("polymake.lib","facetVertexLatticeDistances",FALSE,PMfacetVertexLatticeDistances);
2007 p->iiAddCproc("polymake.lib","isCompressed",FALSE,PMisCompressed);
2008 p->iiAddCproc("polymake.lib","isSmooth",FALSE,PMisSmooth);
2009 p->iiAddCproc("polymake.lib","isVeryAmple",FALSE,PMisVeryAmple);
2010 p->iiAddCproc("polymake.lib","latticePoints",FALSE,PMlatticePoints);
2011 p->iiAddCproc("polymake.lib","nLatticePoints",FALSE,PMnLatticePoints);
2012 p->iiAddCproc("polymake.lib","interiorLatticePoints",FALSE,PMinteriorLatticePoints);
2013 p->iiAddCproc("polymake.lib","nInteriorLatticePoints",FALSE,PMnInteriorLatticePoints);
2014 p->iiAddCproc("polymake.lib","boundaryLatticePoints",FALSE,PMboundaryLatticePoints);
2015 p->iiAddCproc("polymake.lib","nBoundaryLatticePoints",FALSE,PMnBoundaryLatticePoints);
2016 p->iiAddCproc("polymake.lib","hilbertBasis",FALSE,PMhilbertBasis);
2017 p->iiAddCproc("polymake.lib","nHilbertBasis",FALSE,PMnHilbertBasis);
2018 p->iiAddCproc("polymake.lib","minkowskiSum",FALSE,PMminkowskiSum);
2019 p->iiAddCproc("polymake.lib","maximalFace",FALSE,PMmaximalFace);
2020 p->iiAddCproc("polymake.lib","minimalFace",FALSE,PMminimalFace);
2021 p->iiAddCproc("polymake.lib","maximalValue",FALSE,PMmaximalValue);
2022 p->iiAddCproc("polymake.lib","minimalValue",FALSE,PMminimalValue);
2023 p->iiAddCproc("polymake.lib","visual",FALSE,visual);
2024 p->iiAddCproc("polymake.lib","normalFan",FALSE,normalFan);
2025 p->iiAddCproc("polymake.lib","vertexAdjacencyGraph",FALSE,PMvertexAdjacencyGraph);
2026 p->iiAddCproc("polymake.lib","vertexEdgeGraph",FALSE,PMvertexEdgeGraph);
2027
2028 blackbox* b=getBlackboxStuff(polytopeID);
2029 b->blackbox_Op2=bbpolytope_Op2;
2030
2032 return MAX_TOK;
2033}
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition: blackbox.cc:17
void init_polymake_help()
BOOLEAN PMnInteriorLatticePoints(leftv res, leftv args)
static BOOLEAN bbpolytope_Op2(int op, leftv res, leftv i1, leftv i2)
BOOLEAN PMisLatticePolytope(leftv res, leftv args)
BOOLEAN PMvertexAdjacencyGraph(leftv res, leftv args)
BOOLEAN PMminkowskiSum(leftv res, leftv args)
BOOLEAN PMmaximalFace(leftv res, leftv args)
BOOLEAN PMfVector(leftv res, leftv args)
BOOLEAN PMisSmooth(leftv res, leftv args)
BOOLEAN normalFan(leftv res, leftv args)
BOOLEAN PMnBoundaryLatticePoints(leftv res, leftv args)
BOOLEAN PMfacetVertexLatticeDistances(leftv res, leftv args)
BOOLEAN PMisLatticeEmpty(leftv res, leftv args)
BOOLEAN PMgorensteinIndex(leftv res, leftv args)
BOOLEAN visual(leftv res, leftv args)
BOOLEAN PMehrhartPolynomialCoeff(leftv res, leftv args)
BOOLEAN PMvertexEdgeGraph(leftv res, leftv args)
BOOLEAN PMboundaryLatticePoints(leftv res, leftv args)
BOOLEAN PMisReflexive(leftv res, leftv args)
BOOLEAN PMisVeryAmple(leftv res, leftv args)
BOOLEAN PMlatticeVolume(leftv res, leftv args)
BOOLEAN PMnHilbertBasis(leftv res, leftv args)
BOOLEAN PMmaximalValue(leftv res, leftv args)
BOOLEAN PMgorensteinVector(leftv res, leftv args)
polymake::Main * init_polymake
BOOLEAN PMlatticeDegree(leftv res, leftv args)
BOOLEAN PMhVector(leftv res, leftv args)
BOOLEAN PMminimalValue(leftv res, leftv args)
BOOLEAN PMisCompressed(leftv res, leftv args)
BOOLEAN PMlatticePoints(leftv res, leftv args)
BOOLEAN PMisBounded(leftv res, leftv args)
BOOLEAN PMnLatticePoints(leftv res, leftv args)
BOOLEAN PMinteriorLatticePoints(leftv res, leftv args)
BOOLEAN PMfacetWidth(leftv res, leftv args)
BOOLEAN PMisNormal(leftv res, leftv args)
BOOLEAN PMhStarVector(leftv res, leftv args)
BOOLEAN PMminimalFace(leftv res, leftv args)
BOOLEAN PMlatticeCodegree(leftv res, leftv args)
BOOLEAN PMisCanonical(leftv res, leftv args)
BOOLEAN PMfacetWidths(leftv res, leftv args)
BOOLEAN PMisTerminal(leftv res, leftv args)
BOOLEAN PMhilbertBasis(leftv res, leftv args)
BOOLEAN PMisGorenstein(leftv res, leftv args)
@ MAX_TOK
Definition: tok.h:218

◆ verticesOf()

polymake::Matrix< polymake::Integer > verticesOf ( const polymake::perl::Object *  p,
const polymake::Set< polymake::Integer > *  s 
)

Definition at line 1519 of file polymake_wrapper.cc.

1521{
1522 polymake::Matrix<polymake::Integer> allrays = p->give("VERTICES");
1523 polymake::Matrix<polymake::Integer> wantedrays;
1524 bool ok = true;
1525 #if (POLYMAKE_VERSION >= 305)
1526 for(const auto i : *s)
1527 {
1528 wantedrays = wantedrays / allrays.row(PmInteger2Int(i,ok));
1529 }
1530 #else
1531 for(polymake::Entire<polymake::Set<polymake::Integer> >::const_iterator i=polymake::entire(*s); !i.at_end(); i++)
1532 {
1533 wantedrays = wantedrays / allrays.row(PmInteger2Int(*i,ok));
1534 }
1535 #endif
1536 if (!ok)
1537 {
1538 WerrorS("overflow while converting polymake::Integer to int in raysOf");
1539 }
1540 return wantedrays;
1541}

◆ visual()

BOOLEAN visual ( leftv  res,
leftv  args 
)

Definition at line 1737 of file polymake_wrapper.cc.

1738{
1739 leftv u = args;
1740 if ((u != NULL) && (u->Typ() == polytopeID))
1741 {
1742 gfan::initializeCddlibIfRequired();
1743 gfan::ZCone* zp = (gfan::ZCone*)u->Data();
1744 try
1745 {
1746 polymake::perl::Object* pp = ZPolytope2PmPolytope(zp);
1747 #if (POLYMAKE_VERSION >= 305)
1748 polymake::call_function("jreality",pp->call_method("VISUAL"));
1749 #else
1750 VoidCallPolymakeFunction("jreality",pp->CallPolymakeMethod("VISUAL"));
1751 #endif
1752 delete pp;
1753 }
1754 catch (const std::exception& ex)
1755 {
1756 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1757 gfan::deinitializeCddlibIfRequired();
1758 return TRUE;
1759 }
1760 gfan::deinitializeCddlibIfRequired();
1761 res->rtyp = NONE;
1762 res->data = NULL;
1763 return FALSE;
1764 }
1765 if ((u != NULL) && (u->Typ() == fanID))
1766 {
1767 gfan::initializeCddlibIfRequired();
1768 gfan::ZFan* zf = (gfan::ZFan*)u->Data();
1769 try
1770 {
1771 polymake::perl::Object* pf=ZFan2PmFan(zf);
1772 #if (POLYMAKE_VERSION >= 305)
1773 polymake::call_function("jreality",pf->call_method("VISUAL"));
1774 #else
1775 VoidCallPolymakeFunction("jreality",pf->CallPolymakeMethod("VISUAL"));
1776 #endif
1777 }
1778 catch (const std::exception& ex)
1779 {
1780 gfan::deinitializeCddlibIfRequired();
1781 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1782 return TRUE;
1783 }
1784 gfan::deinitializeCddlibIfRequired();
1785 res->rtyp = NONE;
1786 res->data = NULL;
1787 return FALSE;
1788 }
1789 WerrorS("visual: unexpected parameters");
1790 return TRUE;
1791}
#define NONE
Definition: tok.h:221

Variable Documentation

◆ init_polymake

polymake::Main* init_polymake =NULL

Definition at line 22 of file polymake_wrapper.cc.