4#ifndef POLYMAKE_VERSION
5#define POLYAMKE_VERSION POLYMAKEVERSION
17#include <polymake/client.h>
20#include <polymake/Graph.h>
40 polymake::perl::Object
pms;
41 #if (POLYMAKE_VERSION >= 305)
42 polymake::call_function(
"minkowski_sum", *
pp, *
pq) >>
pms;
50 catch (
const std::exception&
ex)
58 res->data = (
void*)
ms;
68 int s = (
int)(
long)
i2->Data();
70 for (
int i=0;
i<
zm.getHeight();
i++)
71 for (
int j=1;
j<
zm.getWidth();
j++)
77 res->data = (
void*)
zs;
88 int d1 =
zp->ambientDimension();
89 int d2 =
zq->ambientDimension();
93 WerrorS(
"mismatching ambient dimensions");
101 res->data = (
void*)
zs;
112 int d1 =
zp->ambientDimension();
113 int d2 =
zq->ambientDimension();
117 WerrorS(
"mismatching ambient dimensions");
129 res->data = (
void*)
zs;
142 bool b = !((*zp)!=(*zq));
145 res->data = (
char*) (
long)
b;
232 b =
p->give(
"Lattice");
235 catch (
const std::exception&
ex)
243 res->data = (
char*) (
long)
b;
246 WerrorS(
"isLatticePolytope: unexpected parameters");
262 b =
p->give(
"BOUNDED");
265 catch (
const std::exception&
ex)
273 res->data = (
char*) (
long)
b;
276 WerrorS(
"isBounded: unexpected parameters");
292 b =
p->give(
"REFLEXIVE");
295 catch (
const std::exception&
ex)
303 res->data = (
char*) (
long)
b;
306 WerrorS(
"isReflexive: unexpected parameters");
322 b =
p->give(
"GORENSTEIN");
325 catch (
const std::exception&
ex)
333 res->data = (
char*) (
long)
b;
336 WerrorS(
"isGorenstein: unexpected parameters");
353 bool b =
p->give(
"GORENSTEIN");
356 polymake::Integer
pgi =
p->give(
"GORENSTEIN_INDEX");
364 WerrorS(
"gorensteinIndex: input polytope not gorenstein");
368 catch (
const std::exception&
ex)
377 WerrorS(
"overflow while converting polymake::Integer to int");
381 res->data = (
char*) (
long)
gi;
384 WerrorS(
"gorensteinIndex: unexpected parameters");
401 bool b =
p->give(
"GORENSTEIN");
404 polymake::Vector<polymake::Integer>
pgv =
p->give(
"GORENSTEIN_VECTOR");
412 WerrorS(
"gorensteinVector: input polytope not gorenstein");
416 catch (
const std::exception&
ex)
425 WerrorS(
"gorensteinVector: overflow in PmVectorInteger2Intvec");
429 res->data = (
char*)
gv;
432 WerrorS(
"gorensteinVector: unexpected parameters");
448 b =
p->give(
"CANONICAL");
451 catch (
const std::exception&
ex)
459 res->data = (
char*) (
long)
b;
462 WerrorS(
"isCanonical: unexpected parameters");
478 b =
p->give(
"TERMINAL");
481 catch (
const std::exception&
ex)
489 res->data = (
char*) (
long)
b;
492 WerrorS(
"isTerminal: unexpected parameters");
508 b =
p->give(
"LATTICE_EMPTY");
511 catch (
const std::exception&
ex)
519 res->data = (
char*) (
long)
b;
522 WerrorS(
"isLatticeEmpty: unexpected parameters");
539 polymake::Integer
plv =
p->give(
"LATTICE_VOLUME");
543 catch (
const std::exception&
ex)
552 WerrorS(
"overflow while converting polymake::Integer to int");
556 res->data = (
char*) (
long) lv;
559 WerrorS(
"latticeVolume: unexpected parameters");
576 polymake::Integer
pld =
p->give(
"LATTICE_DEGREE");
580 catch (
const std::exception&
ex)
589 WerrorS(
"overflow while converting polymake::Integer to int");
593 res->data = (
char*) (
long)
ld;
596 WerrorS(
"latticeDegree: unexpected parameters");
613 polymake::Integer
plc =
p->give(
"LATTICE_CODEGREE");
617 catch (
const std::exception&
ex)
626 WerrorS(
"overflow while converting polymake::Integer to int");
630 res->data = (
char*) (
long)
lc;
633 WerrorS(
"latticeCodegree: unexpected parameters");
650 polymake::Vector<polymake::Integer>
pec =
p->give(
"EHRHART_POLYNOMIAL_COEFF");
654 catch (
const std::exception&
ex)
663 WerrorS(
"ehrhartPolynomialCoeff: overflow in PmVectorInteger2Intvec");
667 res->data = (
char*)
ec;
670 WerrorS(
"ehrhartPolynomialCoeff: unexpected parameters");
687 polymake::Vector<polymake::Integer>
phv =
p->give(
"F_VECTOR");
691 catch (
const std::exception&
ex)
700 WerrorS(
"fVectorP: overflow in PmVectorInteger2Intvec");
704 res->data = (
char*)
hv;
707 WerrorS(
"fVectorP: unexpected parameters");
724 polymake::Vector<polymake::Integer>
phv =
p->give(
"H_VECTOR");
728 catch (
const std::exception&
ex)
737 WerrorS(
"hVector: overflow in PmVectorInteger2Intvec");
741 res->data = (
char*)
hv;
744 WerrorS(
"hVector: unexpected parameters");
761 polymake::Vector<polymake::Integer>
phv =
p->give(
"H_STAR_VECTOR");
765 catch (
const std::exception&
ex)
774 WerrorS(
"hStarVector: overflow in PmVectorInteger2Intvec");
778 res->data = (
char*)
hv;
781 WerrorS(
"hStarVector: unexpected parameters");
797 b =
p->give(
"NORMAL");
800 catch (
const std::exception&
ex)
808 res->data = (
char*) (
long)
b;
811 WerrorS(
"isNormal: unexpected parameters");
828 polymake::Vector<polymake::Integer>
pfw =
p->give(
"FACET_WIDTHS");
832 catch (
const std::exception&
ex)
841 WerrorS(
"facetWidths: overflow in PmVectorInteger2Intvec");
845 res->data = (
char*)
fw;
848 WerrorS(
"facetWidths: unexpected parameters");
865 polymake::Integer
pfw =
p->give(
"FACET_WIDTH");
869 catch (
const std::exception&
ex)
878 WerrorS(
"overflow while converting polymake::Integer to int");
882 res->data = (
char*) (
long)
fw;
885 WerrorS(
"facetWidth: unexpected parameters");
902 polymake::Matrix<polymake::Integer>
pld =
p->give(
"FACET_VERTEX_LATTICE_DISTANCES");
906 catch (
const std::exception&
ex)
915 WerrorS(
"overflow while converting polymake::Integer to int");
919 res->data = (
char*)
ld;
922 WerrorS(
"facetVertexLatticeDistances: unexpected parameters");
938 b =
p->give(
"COMPRESSED");
941 catch (
const std::exception&
ex)
949 res->data = (
char*) (
long)
b;
952 WerrorS(
"isCompressed: unexpected parameters");
968 b =
p->give(
"SMOOTH_CONE");
971 catch (
const std::exception&
ex)
979 res->data = (
char*) (
long)
b;
990 b =
p->give(
"SMOOTH");
993 catch (
const std::exception&
ex)
1001 res->data = (
char*) (
long)
b;
1012 b =
p->give(
"SMOOTH_FAN");
1015 catch (
const std::exception&
ex)
1023 res->data = (
char*) (
long)
b;
1026 WerrorS(
"isSmooth: unexpected parameters");
1042 b =
p->give(
"VERY_AMPLE");
1045 catch (
const std::exception&
ex)
1053 res->data = (
char*) (
long)
b;
1056 WerrorS(
"isVeryAmple: unexpected parameters");
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");
1080 #error polymake version too old
1085 catch (
const std::exception&
ex)
1094 WerrorS(
"overflow while converting polymake::Integer to int");
1098 res->data = (
char*) iv;
1101 WerrorS(
"LatticePoints: unexpected parameters");
1118 polymake::Integer
nlp =
p->give(
"N_LATTICE_POINTS");
1122 catch (
const std::exception&
ex)
1131 WerrorS(
"overflow while converting polymake::Integer to int");
1135 res->data = (
char*) (
long) n;
1138 WerrorS(
"nLatticePoints: unexpected parameters");
1155 polymake::Matrix<polymake::Integer>
lp =
p->give(
"INTERIOR_LATTICE_POINTS");
1159 catch (
const std::exception&
ex)
1168 WerrorS(
"overflow while converting polymake::Integer to int");
1172 res->data = (
char*) iv;
1175 WerrorS(
"interiorLatticePoints: unexpected parameters");
1192 polymake::Integer
nlp =
p->give(
"N_INTERIOR_LATTICE_POINTS");
1196 catch (
const std::exception&
ex)
1205 WerrorS(
"overflow while converting polymake::Integer to int");
1209 res->data = (
char*) (
long) n;
1212 WerrorS(
"nInteriorLatticePoints: unexpected parameters");
1229 polymake::Matrix<polymake::Integer>
lp =
p->give(
"BOUNDARY_LATTICE_POINTS");
1233 catch (
const std::exception&
ex)
1242 WerrorS(
"overflow while converting polymake::Integer to int");
1246 res->data = (
char*) iv;
1249 WerrorS(
"boundaryLatticePoints: unexpected parameters");
1266 polymake::Integer
nlp =
p->give(
"N_BOUNDARY_LATTICE_POINTS");
1270 catch (
const std::exception&
ex)
1279 WerrorS(
"overflow while converting polymake::Integer to int");
1283 res->data = (
char*) (
long) n;
1286 WerrorS(
"nBoundaryLatticePoints: unexpected parameters");
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");
1310 #error polymake version too old
1315 catch (
const std::exception&
ex)
1324 WerrorS(
"overflow while converting polymake::Integer to int");
1328 res->data = (
char*) iv;
1331 WerrorS(
"hilbertBasis: unexpected parameters");
1348 polymake::Integer
nlp =
p->give(
"N_HILBERT_BASIS");
1352 catch (
const std::exception&
ex)
1361 WerrorS(
"overflow while converting polymake::Integer to int");
1365 res->data = (
char*) (
long) n;
1368 WerrorS(
"nHilbertBasis: unexpected parameters");
1389 polymake::perl::Object
pms;
1390 #if (POLYMAKE_VERSION >= 305)
1391 polymake::call_function(
"minkowski_sum", *
pp, *
pq) >>
pms;
1399 catch (
const std::exception&
ex)
1407 res->data = (
char*)
ms;
1421 polymake::perl::Object
pms;
1422 #if (POLYMAKE_VERSION >= 305)
1423 polymake::call_function(
"minkowski_sum", *
pp, *
pq) >>
pms;
1431 catch (
const std::exception&
ex)
1441 res->data = (
char*)
ms;
1459 polymake::perl::Object
pms;
1460 #if (POLYMAKE_VERSION >= 305)
1461 polymake::call_function(
"minkowski_sum", *
pp, *
pq) >>
pms;
1469 catch (
const std::exception&
ex)
1479 res->data = (
char*)
ms;
1492 polymake::perl::Object
pms;
1493 #if (POLYMAKE_VERSION >= 305)
1494 polymake::call_function(
"minkowski_sum", *
pp, *
pq) >>
pms;
1502 catch (
const std::exception&
ex)
1510 res->data = (
char*)
ms;
1514 WerrorS(
"minkowskiSum: unexpected parameters");
1519polymake::Matrix<polymake::Integer>
verticesOf(
const polymake::perl::Object*
p,
1520 const polymake::Set<polymake::Integer>*
s)
1522 polymake::Matrix<polymake::Integer>
allrays =
p->give(
"VERTICES");
1523 polymake::Matrix<polymake::Integer>
wantedrays;
1525 #if (POLYMAKE_VERSION >= 305)
1526 for(
const auto i : *
s)
1531 for(polymake::Entire<polymake::Set<polymake::Integer> >::const_iterator
i=polymake::entire(*
s); !
i.at_end();
i++)
1538 WerrorS(
"overflow while converting polymake::Integer to int in raysOf");
1560 polymake::perl::Object o(
"LinearProgram<Rational>");
1563 polymake::Set<polymake::Integer>
mf =
p->give(
"LP.MAXIMAL_FACE");
1568 catch (
const std::exception&
ex)
1577 WerrorS(
"overflow while converting polymake::Integer to int");
1585 WerrorS(
"maximalFace: unexpected parameters");
1606 polymake::perl::Object o(
"LinearProgram<Rational>");
1609 polymake::Set<polymake::Integer>
mf =
p->give(
"LP.MINIMAL_FACE");
1614 catch (
const std::exception&
ex)
1623 WerrorS(
"overflow while converting polymake::Integer to int");
1631 WerrorS(
"minimalFace: unexpected parameters");
1647 if (iv->
rows()==
zp->ambientDimension())
1655 polymake::perl::Object o(
"LinearProgram<Rational>");
1656 o.take(
"LINEAR_OBJECTIVE") <<
lo;
1658 polymake::Integer
mv =
p->give(
"LP.MAXIMAL_VALUE");
1662 catch (
const std::exception&
ex)
1671 WerrorS(
"overflow while converting polymake::Integer to int");
1675 res->data = (
char*) (
long)
m;
1679 WerrorS(
"maximalValue: vector is of wrong size");
1682 WerrorS(
"maximalValue: unexpected parameters");
1697 if (iv->
rows()==
zp->ambientDimension())
1705 polymake::perl::Object o(
"LinearProgram<Rational>");
1706 o.take(
"LINEAR_OBJECTIVE") <<
lo;
1708 polymake::Integer
mv =
p->give(
"LP.MINIMAL_VALUE");
1712 catch (
const std::exception&
ex)
1721 WerrorS(
"overflow while converting polymake::Integer to int");
1725 res->data = (
char*) (
long)
m;
1729 WerrorS(
"minimalValue: vector is of wrong size");
1732 WerrorS(
"minimalValue: unexpected parameters");
1747 #if (POLYMAKE_VERSION >= 305)
1748 polymake::call_function(
"jreality",
pp->call_method(
"VISUAL"));
1754 catch (
const std::exception&
ex)
1772 #if (POLYMAKE_VERSION >= 305)
1773 polymake::call_function(
"jreality",
pf->call_method(
"VISUAL"));
1778 catch (
const std::exception&
ex)
1789 WerrorS(
"visual: unexpected parameters");
1804 polymake::perl::Object
pf;
1805 #if (POLYMAKE_VERSION >= 305)
1806 polymake::call_function(
"normal_fan", *
p) >>
pf;
1813 catch (
const std::exception&
ex)
1821 res->data = (
char*)
zf;
1824 WerrorS(
"normalFan: unexpected parameters");
1834 polymake::perl::Object
pc(
"Cone<Rational>");
1856 res->data = (
char*)
zc;
1859 WerrorS(
"coneViaRays: unexpected parameters");
1870 polymake::perl::Object
pp(
"Polytope<Rational>");
1877 int flag = (
int) (
long)
v->Data();
1882 default:
WerrorS(
"polytopeViaVertices: invalid flag");
1891 res->data = (
char*)
zp;
1894 WerrorS(
"polytopeViaVertices: unexpected parameters");
1910 polymake::Matrix<polymake::Integer>
vert0 =
p->give(
"VERTICES");
1915 polymake::Graph<>
gr=
p->give(
"GRAPH.ADJACENCY");
1922 catch (
const std::exception&
ex)
1933 WerrorS(
"vertexEdgeGraph: unexpected parameters");
1949 polymake::Matrix<polymake::Integer>
vert0 =
p->give(
"VERTICES");
1954 polymake::Graph<>
gr=
p->give(
"GRAPH.ADJACENCY");
1961 catch (
const std::exception&
ex)
1972 WerrorS(
"vertexEdgeGraph: unexpected parameters");
gfan::ZMatrix liftUp(const gfan::ZMatrix &zm)
BOOLEAN rays(leftv res, leftv args)
BOOLEAN vertices(leftv res, leftv args)
BOOLEAN blackboxDefaultOp2(int, leftv, leftv, leftv)
default procedure blackboxDefaultOp2, to be called as "default:" branch
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Class used for (list of) interpreter objects.
const CanonicalForm int s
const Variable & v
< [in] a sqrfree bivariate poly
void WerrorS(const char *s)
STATIC_VAR coordinates * points
int PmInteger2Int(const polymake::Integer &pi, bool &ok)
gfan::ZCone * PmPolytope2ZPolytope(polymake::perl::Object *pp)
polymake::Vector< polymake::Integer > Intvec2PmVectorInteger(const intvec *iv)
polymake::perl::Object * ZFan2PmFan(gfan::ZFan *zf)
gfan::ZCone * PmCone2ZCone(polymake::perl::Object *pc)
gfan::ZFan * PmFan2ZFan(polymake::perl::Object *pf)
lists PmIncidenceMatrix2ListOfIntvecs(polymake::IncidenceMatrix< polymake::NonSymmetric > *icmat)
intvec * PmMatrixInteger2Intvec(polymake::Matrix< polymake::Integer > *mi, bool &ok)
polymake::Matrix< polymake::Integer > Intvec2PmMatrixInteger(const intvec *im)
lists PmAdjacencyMatrix2ListOfEdges(polymake::IncidenceMatrix< polymake::NonSymmetric > *icmat)
polymake::perl::Object * ZCone2PmCone(gfan::ZCone *zc)
polymake::perl::Object * ZPolytope2PmPolytope(gfan::ZCone *zc)
bigintmat * PmMatrixInteger2Bigintmat(polymake::Matrix< polymake::Integer > *mi)
intvec * PmVectorInteger2Intvec(const polymake::Vector< polymake::Integer > *vi, bool &ok)
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 PMconeViaRays(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)
polymake::Matrix< polymake::Integer > verticesOf(const polymake::perl::Object *p, const polymake::Set< polymake::Integer > *s)
BOOLEAN PMfacetWidths(leftv res, leftv args)
BOOLEAN PMisTerminal(leftv res, leftv args)
int SI_MOD_INIT polymake(SModulFunctions *p)
BOOLEAN PMhilbertBasis(leftv res, leftv args)
BOOLEAN PMpolytopeViaVertices(leftv res, leftv args)
BOOLEAN PMisGorenstein(leftv res, leftv args)