application: polytope

This is the historically first application, and the largest one.

It deals with convex pointed polyhedra. It allows to define a polyhedron either as a convex hull of a point set, an intersection of halfspaces, or as an incidence matrix without any embedding. Then you can ask for a plenty of its (especially combinatorial) properties, construct new polyhedra by modifying it, or study the behavior of the objective functions.

There is a wide range of visualization methods for polyhedra, even for dimensions > 4 and purely combinatorial descriptions, including interfaces to interactive geometry viewers (such as JavaView or geomview), generating PostScript drawings and povray scene files.

imports from: common, graph
uses: group, ideal, topaz

Objects

User Functions

  •  

    These functions capture combinatorial information of the object. Combinatorial properties only depend on combinatorial data of the object like, e.g., the face lattice.

    •  
      circuits2matrix (co) → SparseMatrix<Rational>

      Convert CIRCUITS or COCIRCUITS to a 0/+1/-1 matrix, with one row for each circuit/cocircuit, and as many columns as there are VECTORs/POINTS.

      Parameters
      Set<Pair<Set<Int>,Set<Int>>>co
      /circuits a set of circuits or cocircuits
      Returns
      SparseMatrix<Rational>
    •  
      cocircuit_equation (C, rho, index_of) → SparseVector<Int>

      The cocircuit equations of a cone C corresponding to some interior ridge rho with respect to a list of interior simplices symmetries of the cone are NOT taken into account

      Contained in extension bundled:group.
      Parameters
      ConeC
      Set<Int>rho
      the interior ridge
      Map<Set<Int>, Int>index_of
      the interior_simplices
      Returns
      SparseVector<Int>
    •  
      cocircuit_equations (C, interior_ridge_simplices, interior_simplices) → SparseMatrix<Int>

      A matrix whose rows contain the cocircuit equations of a cone C with respect to a list of interior simplices symmetries of the cone are NOT taken into account

      Contained in extension bundled:group.
      Parameters
      ConeC
      Array<Set>interior_ridge_simplices
      Array<Set>interior_simplices
      Options
      Stringfilename
      where to write the output (default empty)
      Boolreduce_rows
      whether to perform row reduction (default 1)
      Intlog_frequency
      how often to print log messages
      Returns
      SparseMatrix<Int>
    •  
      contraction (C, v)

      Contract a vector configuration C along a specified vector v.

      Parameters
      VectorConfigurationC
      Intv
      index of the vector to contract
    •  
      deletion (C, v)

      Delete a specified vector v from a vector configuration C.

      Parameters
      VectorConfigurationC
      Intv
      index of the vector to delete
    •  
      projected_cocircuit_equations (C, ridge_rep, isotypic_components) → SparseMatrix<Rational>

      A SparseMatrix whose rows contain projections of the cocircuit equations of a cone C corresponding to the orbit of a specified ridge onto a direct sum of specified isotypic components

      Contained in extension bundled:group.
      Parameters
      ConeC
      Set<Int>ridge_rep
      interior ridge
      Set<Int>isotypic_components
      the isotypic components to project to
      Returns
      SparseMatrix<Rational>
    •  
      quotient_of_triangulation (T, G, R) → SparseVector

      In a triangulation T, find the number of representatives of simplices wrt to G, and return the counts in the order indicated by the array R

      Contained in extension bundled:group.
      Parameters
      Array<Set>T
      the input triangulation,
      Array<Array<Int>>G
      the generators of the symmetry group
      Array<Set>R
      the canonical lex-min representatives of the simplices
      Options
      Boolfoldable
      is the triangulation foldable?
      Returns
      SparseVector
      V the number of times a simplex G-isomorphic to each representative in R occurs in T
  •  

    Functions based on graph isomorphisms.

    •  
      congruent (P1, P2) → Scalar

      Check whether two given polytopes P1 and P2 are congruent, i.e. whether there is an affine isomorphism between them that is induced by a (possibly scaled) orthogonal matrix. Returns the scale factor, or 0 if the polytopes are not congruent.

      We are using the reduction of the congruence problem (for arbitrary point sets) to the graph isomorphism problem due to:

      Akutsu, T.: On determining the congruence of point sets in `d` dimensions.
      Comput. Geom. Theory Appl. 9, 247--256 (1998), no. 4
      Parameters
      PolytopeP1
      the first polytope
      PolytopeP2
      the second polytope
      Returns
      Scalar
      the square of the scale factor or 0 if the polytopes are not congruent

      Example:
      • Let's first consider an isosceles triangle and its image of the reflection in the origin:> $t = simplex(2);> $tr = simplex(2,-1); Those two are congruent:> print congruent($t,$tr); 1 If we scale one of them, we get a factor:> print congruent(scale($t,2),$tr); 4 But if we instead take a triangle that is not isosceles, we get a negative result.> $tn = new Polytope(VERTICES => [[1,0,0],[1,2,0],[1,0,1]]);> print congruent($t,$tn); 0
    •  
      equal_polyhedra (P1, P2) → Bool

      Tests if the two polyhedra P1 and P2 are equal.

      Parameters
      PolytopeP1
      the first polytope
      PolytopeP2
      the second polytope
      Options
      Boolverbose
      Prints information on the difference between P1 and P2 if they are not equal.
      Returns
      Bool
      true if the two polyhedra are equal, false otherwise

      Example:
      • > $p = new Polytope(VERTICES => [[1,-1,-1],[1,1,-1],[1,-1,1],[1,1,1]]);> print equal_polyhedra($p,cube(2)); 1 To see why two polytopes are unequal, try this:> print equal_polyhedra($p,cube(3),verbose => 1); Cones/Polytopes do no live in the same ambient space.> print equal_polyhedra($p,simplex(2),verbose => 1); Inequality 0 1 0 not satisfied by point 1 -1 -1.
    •  
      find_facet_vertex_permutations (P1, P2) → Pair<Array<Int>, Array<Int>>

      Find the permutations of facets and vertices which maps the cone or polyhedron P1 to P2. The facet permutation is the first component, the vertex permutation is the second component of the return value.

      Only the combinatorial isomorphism is considered. If the polytopes are not isomorphic, an exception is thrown.

      Parameters
      ConeP1
      the first cone/polytope
      ConeP2
      the second cone/polytope
      Returns
      Pair<Array<Int>, Array<Int>>
      the facet and the vertex permutations
    •  
      included_polyhedra (P1, P2) → Bool

      Tests if polyhedron P1 is included in polyhedron P2.

      Parameters
      PolytopeP1
      the first polytope
      PolytopeP2
      the second polytope
      Options
      Boolverbose
      Prints information on the difference between P1 and P2 if none is included in the other.
      Returns
      Bool
      'true' if P1 is included in P2, 'false' otherwise

      Example:
      • > print included_polyhedra(simplex(3),cube(3)); 1 To see in what way the two polytopes differ, try this:> print included_polyhedra(cube(2),cube(3),verbose=>1); Cones/Polytopes do no live in the same ambient space.
    •  
      isomorphic (P1, P2) → Bool

      Check whether the face lattices of two cones or polytopes are isomorphic. The problem is reduced to graph isomorphism of the vertex-facet incidence graphs.

      Parameters
      ConeP1
      the first cone/polytope
      ConeP2
      the second cone/polytope
      Returns
      Bool
      'true' if the face lattices are isomorphic, 'false' otherwise

      Example:
      • The following compares the standard 2-cube with a polygon generated as the convex hull of five points. The return value is true since both polygons are quadrangles.> $p = new Polytope(POINTS=>[[1,-1,-1],[1,1,-1],[1,-1,1],[1,1,1],[1,0,0]]);> print isomorphic(cube(2),$p); 1
    •  
      lattice_isomorphic_smooth_polytopes (P1, P2) → Bool

      Tests whether two smooth lattice polytopes are lattice equivalent by comparing lattice distances between vertices and facets.

      Parameters
      PolytopeP1
      the first lattice polytope
      PolytopeP2
      the second lattice polytope
      Returns
      Bool
      'true' if the polytopes are lattice equivalent, 'false' otherwise

      Example:
      • > $t = new Vector(2,2);> print lattice_isomorphic_smooth_polytopes(cube(2),translate(cube(2),$t)); 1
  •  

    These functions are for checking the consistency of some properties.

    •  
      check_inc (points, hyperplanes, sign, verbose) → Bool

      Check coordinate data. For each pair of vectors from two given matrices their inner product must satisfy the given relation.

      Parameters
      Matrixpoints
      Matrixhyperplanes
      Stringsign
      composed of one or two characters from [-+0], representing the allowed domain of the vector inner products.
      Boolverbose
      print all products violating the required relation
      Returns
      Bool
      'true' if all relations are satisfied, 'false' otherwise

      Example:
      • Let's check which vertices of the square lie in its zeroth facet:> $H = cube(2)->FACETS->minor([0],All);> print check_inc(cube(2)->VERTICES,$H,'0',1); <1,0> ( 1 1 -1 ) * [ 1 1 0 ] == 2 <3,0> ( 1 1 1 ) * [ 1 1 0 ] == 2 number of points==4, number of hyperplanes==1, -:0, 0:2, +:2, total:4 Thus, the first and third vertex don't lie on the hyperplane defined by the facet but on the positive side of it, and the remaining two lie on the hyperplane.
    •  
      check_poly (VIF) → Polytope

      Try to check whether a given vertex-facet incidence matrix VIF defines a polytope. Note that a successful certification by check_poly is not sufficient to determine whether an incidence matrix actually defines a polytope. Think of it as a plausibility check.

      Parameters
      IncidenceMatrixVIF
      Options
      Booldual
      transposes the incidence matrix
      Boolverbose
      prints information about the check.
      Returns
      Polytope
      the resulting polytope under the assumption that VIF actually defines a polytope
    •  
      validate_moebius_strip (P) → Bool

      Validates the output of the client edge_orientable, in particular it checks whether the MOEBIUS_STRIP_EDGES form a Moebius strip with parallel opposite edges. Prints a message to stdout.

      Parameters
      PolytopeP
      the given polytope
      Returns
      Bool
      'true' if the Moebius strip edges form such a Moebius strip, 'false' otherwise
    •  
      validate_moebius_strip_quads (P) → Matrix<Int>

      Checks whether the MOEBIUS_STRIP_QUADS form a Moebius strip with parallel opposite edges. Prints a message to stdout and returns the MOEBIUS_STRIP_EDGES if the answer is affirmative.

      Parameters
      PolytopeP
      the given polytope
      Options
      Boolverbose
      print details
      Returns
      Matrix<Int>
      the Moebius strip edges
  •  

    The following functions allow for the conversion of the coordinate type of cones and polytopes.

    •  
      affine_float_coords (P) → Matrix<Float>

      Dehomogenize the vertex coordinates and convert them to Float

      Parameters
      PolytopeP
      source object
      Returns
      Matrix<Float>
      the dehomogenized vertices converted to Float

      Example:
      • > print cube(2,1/2)->VERTICES; 1 -1/2 -1/2 1 1/2 -1/2 1 -1/2 1/2 1 1/2 1/2> print affine_float_coords(cube(2,1/2)); -0.5 -0.5 0.5 -0.5 -0.5 0.5 0.5 0.5
    •  
      convert_to <Coord> (c) → Cone<Coord>

      Creates a new Cone object with different coordinate type target coordinate type Coord must be specified in angle brackets e.g. $new_cone = convert_to<Coord>($cone)

      Type Parameters
      Coord
      target coordinate type
      Parameters
      Conec
      the input cone
      Returns
      Cone<Coord>
      a new cone object or C itself it has the requested type
    •  
      convert_to <Coord> (P) → Polytope<Coord>

      provide a Polytope object with desired coordinate type

      Type Parameters
      Coord
      target coordinate type
      Parameters
      PolytopeP
      source object
      Returns
      Polytope<Coord>
      P if it already has the requested type, a new object otherwise

      Example:
      • > print cube(2)->type->full_name; Polytope<Rational>> $pf = convert_to<Float>(cube(2));> print $pf->type->full_name; Polytope<Float>
  •  

    Tight spans and their conections to polyhedral geometry

    •  
      max_metric (n) → Matrix

      Compute a metric such that the f-vector of its tight span is maximal among all metrics with n points.

      S. Herrmann and M. Joswig: Bounds on the f-vectors of tight spans.
      Contrib. Discrete Math., Vol.2, 2007 161-184
      Parameters
      Intn
      the number of points
      Returns
      Matrix

      Example:
      • To compute the max-metric of four points and display the f-vector of its tight span, do this:> $M = max_metric(5);> $w = new Vector(1,1,1,2,3);> print tight_span($M,$w)->F_VECTOR; 6 15 20 15 6
    •  
      min_metric (n) → Matrix

      Compute a metric such that the f-vector of its tight span is minimal among all metrics with n points.

      S. Herrmann and M. Joswig: Bounds on the f-vectors of tight spans.
      Contrib. Discrete Math., Vol.2, 2007 161-184
      Parameters
      Intn
      the number of points
      Returns
      Matrix

      Example:
      • To compute the min-metric of four points and display the f-vector of its tight span, do this:> $M = min_metric(5);> $w = new Vector(1,1,1,2,3);> print tight_span($M,$w)->F_VECTOR; 6 15 20 15 6
    •  
      thrackle_metric (n) → Matrix

      Compute a metric such that the f-vector of its tight span is maximal among all metrics with n points. This metric can be interpreted as a lifting function for the thrackle triangulation (see de Loera, Sturmfels and Thomas: Groebner Basis and triangultaions of the second hypersimplex)

      Parameters
      Intn
      the number of points
      Returns
      Matrix
    •  
      tight_span (points, weight, full) → Polytope

      Compute the tight span dual to the regular subdivision obtained by lifting points to weight and taking the lower complex of the resulting polytope.

      Parameters
      Matrixpoints
      Vectorweight
      Boolfull
      true if the polytope is full-dimensional. Default value is 1.
      Returns
      Polytope
      (The polymake object TightSpan is only used for tight spans of finite metric spaces, not for tight spans of subdivisions in general.)

      Example:
      • This computes the tight span dual to a regular subdivision of the squares vertices.> $p = tight_span(cube(2)->VERTICES,new Vector(1,1,1,23));> print $p->VERTICES; 0 1 1 0 0 1 0 1 1 -1 0 0 1 -1 -11 -11 0 1 0 -1 0 1 -1 0
    •  
      tight_span (P) → Polytope

      Compute the tight span dual to the regular subdivision of a polytope P obtained by the WEIGHTS and taking the lower complex of the resulting polytope.

      Parameters
      PolytopeP
      Returns
      Polytope
      (The polymake object TightSpan is only used for tight spans of finite metric spaces, not for tight spans of subdivisions in general.)

      Example:
      • The following assigns a regular subdivision induced by weights to the square and then creates the tight span dual to it.> $c = cube(2);> $c->POLYTOPAL_SUBDIVISION(WEIGHTS=>[1,1,1,23]);> $p = tight_span($c);> print $p->VERTICES; 0 1 1 0 0 1 0 1 1 -1 0 0 1 -1 -11 -11 0 1 0 -1 0 1 -1 0
    •  
      ts_max_metric (n) → TightSpan

      Computes the tight span of a metric such that its f-vector is maximal among all metrics with n points.

      S. Herrmann and M. Joswig: Bounds on the f-vectors of tight spans.
      Contrib. Discrete Math., Vol.2, 2007 161-184
      Parameters
      Intn
      the number of points
      Returns
      TightSpan
    •  
      ts_min_metric (n) → TightSpan

      Compute the tight span of a metric such its f-vector is minimal among all metrics with n points.

      S. Herrmann and M. Joswig: Bounds on the f-vectors of tight spans.
      Contrib. Discrete Math., Vol.2, 2007 161-184
      Parameters
      Intn
      the number of points
      Returns
      TightSpan
    •  
      ts_thrackle_metric (n) → TightSpan

      Compute a tight span of a metric such that its f-vector is maximal among all metrics with n points. This metric can be interpreted as a lifting function for the thrackle triangulation (see de Loera, Sturmfels and Thomas: Groebner Basis and triangultaions of the second hypersimplex)

      Parameters
      Intn
      the number of points
      Returns
      TightSpan
  •  

    These functions capture geometric information of the object. Geometric properties depend on geometric information of the object, like, e.g., vertices or facets.

    •  
      all_steiner_points (P) → Matrix

      Compute the Steiner points of all faces of a polyhedron P using a randomized approximation of the angles. P must be BOUNDED.

      Parameters
      PolytopeP
      Options
      Floateps
      controls the accuracy of the angles computed
      Intseed
      controls the outcome of the random number generator; fixing a seed number guarantees the same outcome.
      Returns
      Matrix
    •  
      dihedral_angle (H1, H2) → Float

      Compute the dihedral angle between two (oriented) affine or linear hyperplanes.

      Parameters
      Vector<Scalar>H1
      : first hyperplane
      Vector<Scalar>H2
      : second hyperplane
      Options
      Booldeg
      output in degrees rather than radians, default is false
      Boolcone
      hyperplanes seen as linear hyperplanes, default is false
      Returns
      Float

      Example:
      • > $H1 = new Vector(1,5,5);> $H2 = new Vector(1,-5,5);> print dihedral_angle($H1,$H2,deg=>1); 90
    •  
      induced_lattice_basis (p) → Matrix<Integer>

      Returns a basis of the affine lattice spanned by the vertices

      Parameters
      Polytopep
      the input polytope
      Returns
      Matrix<Integer>
      - the lattice basis.

      Example:
      • The vertices of the 2-simplex span all of Z^2...> print induced_lattice_basis(simplex(2)); 0 1 0 0 0 1 ...but if we scale it with 2, we get only every second lattice point.> print induced_lattice_basis(scale(simplex(2),2)); 0 2 0 0 0 2
    •  
      integer_points_bbox (P) → Matrix<Integer>

      Enumerate all integer points in the given polytope by searching a bounding box.


      Example:
      • > $p = new Polytope(VERTICES=>[[1,1.3,0.5],[1,0.2,1.2],[1,0.1,-1.5],[1,-1.4,0.2]]);> print integer_points_bbox($p); 1 0 -1 1 -1 0 1 0 0 1 1 0 1 0 1
    •  
      is_vertex (q, points) → Bool

      Checks whether there exists a hyperplane seperating the given point q from the points via solving a suitable LP (compare cdd redundancy check). If so, q would be a new vertex of the polytope P generated by points and q that is not a vertex in the convex hull of points alone. To get the seperating hyperplane, use seperating_hyperplane Works without knowing the facets of P!

      Parameters
      Vectorq
      the vertex (candidate) which is to be separated from points
      Matrixpoints
      the points from which q is to be separated
      Returns
      Bool
      'true' if q is a vertex

      Example:
      • > $q = cube(2)->VERTICES->row(0);> $points = cube(2)->VERTICES->minor(sequence(1,3),All);> print is_vertex($q,$points); 1
    •  
      minimal_vertex_angle (P) → Float

      Computes the minimal angle between two vertices of the input polytope P.

      Parameters
      PolytopeP
      Returns
      Float

      Example:
      • > print minimal_vertex_angle(simplex(3)); 3.14159265358979
    •  
      normaliz_compute (C) → List

      Compute degree one elements, Hilbert basis or Hilbert series of a cone C with libnormaliz Hilbert series and Hilbert h-vector depend on the given grading and will not work unless C is HOMOGENEOUS or a MONOID_GRADING is set

      Contained in extension bundled:libnormaliz.
      Parameters
      ConeC
      Options
      Boolfrom_facets
      supply facets instead of rays to normaliz
      Booldegree_one_generators
      compute the generators of degree one, i.e. lattice points of the polytope
      Boolhilbert_basis
      compute Hilbert basis of the cone C
      Boolh_star_vector
      compute Hilbert h-vector of the cone C
      Boolhilbert_series
      compute Hilbert series of the monoid
      Boolfacets
      compute support hyperplanes (=FACETS,LINEAR_SPAN)
      Boolrays
      compute extreme rays (=RAYS)
      Booldual_algorithm
      use the dual algorithm by Pottier
      Boolskip_long
      do not try to use long coordinates first
      Boolverbose
      libnormaliz debug output
      Returns
      List
      (Matrix<Integer> degree one generators, Matrix<Integer> Hilbert basis, Vector<Integer> Hilbert h-vector, RationalFunction Hilbert series, Matrix<Rational> facets, Matrix<Rational> linear_span, Matrix<Rational> rays) (only requested items)
    •  
      print_face_lattice (VIF, dual)

      Write the face lattice of a vertex-facet incidence matrix VIF to stdout. If dual is set true the face lattice of the dual is printed.

      Parameters
      IncidenceMatrixVIF
      Booldual

      Example:
      • To get a nice representation of the squares face lattice, do this:> print_face_lattice(cube(2)->VERTICES_IN_FACETS); FACE_LATTICE [ -1 : 4 ] {{0 1} {0 2} {1 3} {2 3}} [ -2 : 4 ] {{0} {1} {2} {3}}
    •  
      steiner_point (P) → Vector

      Compute the Steiner point of a polyhedron P using a randomized approximation of the angles.

      Parameters
      PolytopeP
      Options
      Floateps
      controls the accuracy of the angles computed
      Intseed
      controls the outcome of the random number generator; fixing a seed number guarantees the same outcome.
      Returns
      Vector
    •  
      zonotope_tiling_lattice (P) → AffineLattice

      Calculates a generating set for a tiling lattice for P, i.e., a lattice L such that P + L tiles the affine span of P.

      Parameters
      PolytopeP
      the zonotope
      Options
      Boollattice_origin_is_vertex
      true if the origin of the tiling lattice should be a vertex of P; default false, ie, the origin will be the barycenter of P
      Returns
      AffineLattice

      Example:
      • This determines a tiling lattice for a parallelogram with the origin as its vertex barycenter and prints it base vectors:> $M = new Matrix([[1,1,0],[1,1,1]]);> $p = zonotope($M);> $A = zonotope_tiling_lattice($p);> print $A->BASIS; 0 -1 -1 0 0 1
  •  

    These functions provide tools from linear, integer and dicrete optimization. In particular, linear programs are defined here.

    •  
      ball_lifting_lp (c, facet_index, conv_eps) → Polytope

      Computes the inequalities and the linear objective for an LP to lift a simplicial d-ball embedded starshaped in Rd.

      Contained in extension bundled:local.
      Parameters
      topaz::GeometricSimplicialComplexc
      Intfacet_index
      index of the facet to be lifted
      Rationalconv_eps
      some epsilon > 0
      Returns
      Polytope
    •  
      core_point_algo (p, optLPvalue) → List

      Algorithm to solve highly symmetric integer linear programs (ILP). It is required that the group of the ILP induces the alternating or symmetric group on the set of coordinate directions. The linear objective function is the vector (0,1,1,..,1).

      Parameters
      Polytopep
      RationaloptLPvalue
      optimal value of LP approximation
      Options
      Boolverbose
      Returns
      List
      (Vector<Rational> optimal solution, Rational optimal value) may be empty
    •  
      core_point_algo_Rote (p, optLPvalue) → List

      Version of core_point_algo with improved running time (according to a suggestion by G. Rote). The core_point_algo is an algorithm to solve highly symmetric integer linear programs (ILP). It is required that the group of the ILP induces the alternating or symmetric group on the set of coordinate directions. The linear objective function is the vector (0,1,1,..,1).

      Parameters
      Polytopep
      RationaloptLPvalue
      optimal value of LP approximation
      Options
      Boolverbose
      Returns
      List
      (Vector<Rational> optimal solution, Rational optimal value) may be empty
    •  
      find_transitive_lp_sol (Inequalities) → List

      Algorithm to solve symmetric linear programs (LP) of the form max ctx , c=(0,1,1,..,1) subject to the inequality system given by Inequalities. It is required that the symmetry group of the LP acts transitively on the coordinate directions.

      Parameters
      MatrixInequalities
      the inequalities describing the feasible region
      Returns
      List
      (Vector<Rational> optimal solution, Rational optimal value, Bool feasible, Bool max_bounded)

      Example:
      • Consider the LP described by the facets of the 3-cube:> print find_transitive_lp_sol(cube(3)->FACETS); 1 1 1 1311 The optimal solution is [1,1,1,1], its value under c is 3, and the LP is feasible and bounded in direction of c.
    •  
      inner_point (points) → Vector

      Compute a true inner point of a convex hull of the given set of points.

      Parameters
      Matrixpoints
      Returns
      Vector

      Example:
      • To print an inner point of the square, do this:> print inner_point(cube(2)->VERTICES);1 -1/3 -1/3
    •  
      lp2poly <Scalar> (file, testvec, prefix) → Polytope<Scalar>

      Read a linear programming problem given in LP-Format (as used by cplex & Co.) and convert it to a Polytope<Scalar> object.

      WARNING The property FEASIBLE is NOT computed upon creation. This is done to avoid possibly long computation times before the object becomes available to the caller. This is NOT in keeping with standard practice in polymake, but after, all, these are linear programs and not polytopes.

      Type Parameters
      Scalar
      coordinate type of the resulting polytope; default is Rational.
      Parameters
      Stringfile
      filename of a linear programming problem in LP-Format
      Vectortestvec
      If present, after reading in each line of the LP it is checked whether testvec fulfills it
      Stringprefix
      If testvec is present, all variables in the LP file are assumed to have the form $prefix$i
      Options
      Intnocheck
      Do not automatically compute FEASIBLE for the polytope (recommended for very large LPs)
      Returns
      Polytope<Scalar>
    •  
      poly2lp (P, LP, maximize, file)

      Convert a polymake description of a polyhedron to LP format (as used by CPLEX and other linear problem solvers) and write it to standard output or to a file. If LP comes with an attachment 'INTEGER_VARIABLES' (of type Array<Bool>), the output will contain an additional section 'GENERAL', allowing for IP computations in CPLEX. If the polytope is not FEASIBLE, the function will throw a runtime error.

      Parameters
      PolytopeP
      LinearProgramLP
      default value: P->LP
      Boolmaximize
      produces a maximization problem; default value: 0 (minimize)
      Stringfile
      default value: standard output
    •  
      porta2poly (file) → Polytope<Rational>

      Read an .ieq or .poi file (porta input) or .poi.ieq or .ieq.poi (porta output) and convert it to a Polytope<Rational> object

      Parameters
      Stringfile
      filename of a porta file (.ieq or .poi)
      Returns
      Polytope<Rational>
    •  
      print_constraints (C)

      Write the FACETS / INEQUALITIES and the LINEAR_SPAN / EQUATIONS (if present) of a polytope P or cone C in a readable way. COORDINATE_LABELS are adopted if present.

      Parameters
      Cone<Scalar>C
      the given polytope or cone
      Options
      Array<String>ineq_labels
      changes the labels of the inequality rows
      Array<String>eq_labels
      changes the labels of the equation rows

      Example:
      • The following prints the facet inequalities of the square, changing the labels.> print_constraints(cube(2),ineq_labels=>['zero','one','two','three']); Facets: zero: x1 >= -1 one: -x1 >= -1 two: x2 >= -1 three: -x2 >= -1
    •  
      random_edge_epl (G) → Vector<Rational>

      Computes a vector containing the expected path length to the maximum for each vertex of a directed graph G. The random edge pivot rule is applied.

      Parameters
      Graph<Directed>G
      a directed graph
      Returns
      Vector<Rational>
    •  
      rand_aof (P, start) → Vector<Rational>

      Produce a random abstract objective function on a given simple polytope P. It is assumed that the boundary complex of the dual polytope is extendibly shellable. If, during the computation, it turns out that a certain partial shelling cannot be extended, then this is given instead of an abstract objective function. It is possible (but not required) to specify the index of the starting vertex start.

      Parameters
      PolytopeP
      a simple polytope
      Intstart
      the index of the starting vertex; default value: random
      Options
      Intseed
      controls the outcome of the random number generator; fixing a seed number guarantees the same outcome.
      Returns
      Vector<Rational>
    •  
      separating_hyperplane (q, points) → List

      Computes (the normal vector of) a hyperplane which separates a given point q from points via solving a suitable LP. The scalar product of the normal vector of the separating hyperplane and a point in points is greater or equal than 0 (same behavior as for facets!). If q is not a vertex of P=conv(points,q), the function returns a zero vector and sets answer to 'false'. Works without knowing the facets of P!

      Parameters
      Vectorq
      the vertex (candidate) which is to be separated from points
      Matrixpoints
      the points from which q is to be separated
      Returns
      List
      (Bool answer, Vector sep_hyp)

      Example:
      • The following stores the result in the List @r and then prints the answer and a description of the hyperplane separating the zeroth vertex of the square from the others.> $q = cube(2)->VERTICES->row(0);> $points = cube(2)->VERTICES->minor(sequence(1,3),All);> @r = separating_hyperplane($q,$points);> print $r[0]; 1> print $r[1]; 0 1/2 1/2
    •  
      separating_hyperplane (p1, p2) → Vector

      Computes (the normal vector of) a hyperplane which separates two given polytopes p1 and p2 if possible.

      Parameters
      Polytopep1
      the first polytope
      Polytopep2
      the second polytope
      Returns
      Vector
      a hyperplane separating p1 from p2
    •  
      totally_dual_integral (inequalities) → Bool

      Checks weather a given system of inequalities is totally dual integral or not. The inequalities should describe a full dimensional polyhedron

      Parameters
      Matrixinequalities
      Returns
      Bool

      Example:
      • > print totally_dual_integral(cube(2)->FACETS); 1
    •  
      vertex_colors (P, LP) → Array<RGB>

      Calculate RGB-color-values for each vertex depending on a linear or abstract objective function. Maximal and minimal affine vertices are colored as specified. Far vertices (= rays) orthogonal to the linear function normal vector are white. The colors for other affine vertices are linearly interpolated in the HSV color model.

      If the objective function is linear and the corresponding LP problem is unbounded, then the affine vertices that would become optimal after the removal of the rays are painted pale.

      Parameters
      PolytopeP
      LinearProgramLP
      Options
      RGBmin
      the minimal RGB value
      RGBmax
      the maximal RGB value
      Returns
      Array<RGB>

      Example:
      • This calculates a vertex coloring with respect to a linear program. For a better visualization, we also set the vertex thickness to 2.> $p = cube(3);> $p->LP(LINEAR_OBJECTIVE=>[0,1,2,3]);> $v = vertex_colors($p,$p->LP);> $p->VISUAL(VertexColor=>$v,VertexThickness=>2);
    •  
      write_foldable_max_signature_ilp (P, outfile_name)

      construct a linear program whose optimal value is an upper bound for the algebraic signature of a triangulation of P.

      Contained in extension bundled:group.
      Parameters
      PolytopeP
      Stringoutfile_name
    •  
      write_simplexity_ilp (P, outfile_name)

      construct a linear program whose optimal value is a lower bound for the minimal number of simplices in a triangulation of P.

      Contained in extension bundled:group.
      Parameters
      PolytopeP
      Stringoutfile_name
    •  
      write_symmetrized_simplexity_ilp (P, outfile_name)

      construct a linear program whose optimal value is a lower bound for the minimal number of simplices in a triangulation of P.

      Contained in extension bundled:group.
      Parameters
      PolytopeP
      Stringoutfile_name
  •  

    Special purpose functions.

    •  
      edge_orientable (P)

      Checks whether a 2-cubical polytope P is edge-orientable (in the sense of Hetyei), that means that there exits an orientation of the edges such that for each 2-face the opposite edges point in the same direction. It produces the certificates EDGE_ORIENTATION if the polytope is edge-orientable, or MOEBIUS_STRIP_EDGES otherwise. In the latter case, the output can be checked with the client validate_moebius_strip.

      Parameters
      PolytopeP
      the given 2-cubical polytope
    •  
      lawrence_matrix (M) → Matrix

      UNDOCUMENTED
      Parameters
      MatrixM
      Create the Lawrence matrix Lambda(M) corresponding to M. If M has n rows and d columns, then Lambda(M) equals ( M I_n ) ( 0_{n,d} I_n ).
      Returns
      Matrix
    •  
      matroid_indices_of_hypersimplex_vertices () → Set<Int>

      For a given matroid return the bases as a subset of the vertices of the hypersimplex

      Options
      matroid::Matroidm
      the matroid
      Returns
      Set<Int>
    •  
      violations (P, q) → Set

      Check which relations, if any, are violated by a point.

      Parameters
      PolytopeP
      Vectorq
      Options
      Stringsection
      Which section of P to test against q
      Intviolating_criterion
      has the options: +1 (positive values violate; this is the default), 0 (*non*zero values violate), -1 (negative values violate)
      Returns
      Set

      Example:
      • This calculates and prints the violated equations defining a square with the origin as its center and side length 2 with respect to a certain point:> $p = cube(2);> $v = new Vector([1,2,2]);> $S = violations($p,$v);> print $S; {1 3}
    •  
      wronski_center_ideal (L, lambda)

      Returns a system of polynomials which is necessary to check if degeneration avoids center of projection: compute eliminant e(s); this must not have a zero in (0,1)

      Parameters
      Matrix<Int>L
      lattice points
      Vector<Int>lambda
      height function on lattice points
    •  
      wronski_polynomial (M, lambda, coeff, s)

      Returns a Wronski polynomial of a topaz::FOLDABLE triangulation of a lattice polytope

      Parameters
      Matrix<Int>M
      points (in homogeneous coordinates); affinely span the space
      Vector<Int>lambda
      height function on lattice points
      Array<Rational>coeff
      coefficients
      Rationals
      additional Parameter in the polynomial
      Options
      topaz::SimplicialComplextriangulation
      The triangulation of the pointset corresponding to the lifting function
      Ringring
      the ring in which the polynomial should be
    •  
      wronski_system (M, lambda, coeff_array, s)

      Returns a Wronski system of a topaz::FOLDABLE triangulation of a lattice polytope

      Parameters
      Matrix<Int>M
      points (in homogeneous coordinates); affinely span the space
      Vector<Int>lambda
      height function on lattice points
      Array<Array<Rational>>coeff_array
      coefficients
      Rationals
      additional Parameter in the polynomial
      Options
      topaz::SimplicialComplextriangulation
      The triangulation of the pointset corresponding to the lifting function
      Ringring
      the ring in which the polynomial should be
  •  

    Various constructions of cones.

    •  
      normal_cone (p, v, outer) → Cone

      Computes the normal cone of p at the vertex v. By default this is the inner normal cone.

      Parameters
      Polytopep
      Intv
      vertex number which is not contained in the far face
      Boolouter
      asks for outer normal cone. Default value is 0 (= inner)
      Returns
      Cone

      Example:
      • To compute the outer normal cone of the 3-cube, do this:> $c = normal_cone(cube(3),0,1);> print $c->RAYS; -1 0 0 0 -1 0 0 0 -1
    •  
      recession_cone (P) → Cone<Scalar>

      retuns the recession cone (tail cone, characteristic cone) of a polytope

      Parameters
      Polytope<Scalar>P
      polytope
      Returns
      Cone<Scalar>
    •  
      subcone (C) → Cone

      Make a subcone from a cone.

      Parameters
      ConeC
      the input cone
      Options
      Boolrelabel
      creates an additional section RAY_LABELS;
      Returns
      Cone
  •  

    Constructing a point configuration, either from scratch or from existing objects.

    •  
      minkowski_sum (P1, P2) → PointConfiguration

      Produces the Minkowski sum of P1 and P2.


      Example:
      • > $P1 = new PointConfiguration(POINTS=>simplex(2)->VERTICES);> $P2 = new PointConfiguration(POINTS=>[[1,1,1],[1,-1,1],[1,1,-1],[1,-1,-1],[1,0,0]]);> $m = minkowski_sum($P1,$P2);> print $m->POINTS; 1 1 1 1 -1 1 1 1 -1 1 -1 -1 1 0 0 1 2 1 1 0 1 1 2 -1 1 0 -1 1 1 0 1 1 2 1 -1 2 1 1 0 1 -1 0 1 0 1
    •  
      minkowski_sum (lambda, P1, mu, P2) → PointConfiguration

      Produces the polytope lambda*P1+mu*P2, where * and + are scalar multiplication and Minkowski addition, respectively.


      Example:
      • > $P1 = new PointConfiguration(POINTS=>simplex(2)->VERTICES);> $P2 = new PointConfiguration(POINTS=>[[1,1,1],[1,-1,1],[1,1,-1],[1,-1,-1],[1,0,0]]);> $m = minkowski_sum($P1,$P2);> print $m->POINTS; 1 3 3 1 -3 3 1 3 -3 1 -3 -3 1 0 0 1 4 3 1 -2 3 1 4 -3 1 -2 -3 1 1 0 1 3 4 1 -3 4 1 3 -2 1 -3 -2 1 0 1
  •  

    Polytope constructions which take graphs as input.

    •  
      flow_polytope <Scalar> (G, Arc_Bounds, source, sink) → Polytope

      Produces the flow polytope of a directed Graph G=(V,E) with a given source and sink. The flow polytope has the following outer description: forall v in V-{source, sink}: sum_{e in E going into v} x_e - sum_{e in E going out of v} x_e = 0

      sum_{e in E going into source} x_e - sum_{e in E going out of source} x_e <= 0

      sum_{e in E going into sink} x_e - sum_{e in E going out of sink} x_e >= 0

      forall e in E: x_e <= given bound on edge e

      Type Parameters
      Scalar
      Parameters
      Graph<Directed>G
      EdgeMap<Directed, Scalar>Arc_Bounds
      Intsource
      Intsink
      Returns
      Polytope
    •  
      flow_polytope <Scalar> (G, Arc_Bounds, source, sink) → Polytope

      Produces the flow polytope of a directed Graph G=(V,E) with a given source and sink. The flow polytope has the following outer description: forall v in V-{source, sink}: sum_{e in E going into v} x_e - sum_{e in E going out of v} x_e = 0

      sum_{e in E going into source} x_e - sum_{e in E going out of source} x_e <= 0

      sum_{e in E going into sink} x_e - sum_{e in E going out of sink} x_e >= 0

      forall e in E: x_e <= given bound on edge e

      Type Parameters
      Scalar
      Parameters
      Graph<Directed>G
      Array<Scalar>Arc_Bounds
      Intsource
      Intsink
      Returns
      Polytope
    •  
      fractional_cut_polytope (G) → Polytope

      Cut polytope of an undirected graph.

      Parameters
      GraphG
      Returns
      Polytope
    •  
      fractional_matching_polytope (G) → Polytope

      Matching polytope of an undirected graph.

      Parameters
      GraphG
      Returns
      Polytope
    •  
      tutte_lifting (G) → Polytope

      Let G be a 3-connected planar graph. If the corresponding polytope contains a triangular facet (ie. the graph contains a non- separating cycle of length 3), the client produces a realization in R3.

      Parameters
      GraphG
      Returns
      Polytope
    •  
      weighted_digraph_polyhedron (encoding) → polytope::Polytope

      Weighted digraph polyhedron of a directed graph with a weight function. The graph and the weight function are combined into a matrix.

      Parameters
      Matrixencoding
      weighted digraph
      Returns
      polytope::Polytope
  •  

    Polytope constructions which take other big objects as input.

  •  

    An important way of constructing polytopes is to modify an already existing polytope.

    Actually, these functions don't alter the input polytope (it is forbidden in polymake), but create a new polytope object.

    Many functions can at your choice either calculate the vertex or facet coordinates, or constrain themselves on the purely combinatorial description of the resulting polytope.

    •  
      bipyramid (P, z, z_prime)

      Make a bipyramid over a pointed polyhedron. The bipyramid is the convex hull of the input polyhedron P and two points (v, z), (v, z_prime) on both sides of the affine span of P. For bounded polyhedra, the apex projections v to the affine span of P coincide with the vertex barycenter of P.

      Parameters
      PolytopeP
      Scalarz
      distance between the vertex barycenter and the first apex, default value is 1.
      Scalarz_prime
      distance between the vertex barycenter and the second apex, default value is -z.
      Options
      Boolno_coordinates
      : don't compute the coordinates, purely combinatorial description is produced.
      Boolrelabel
      copy the vertex labels from the original polytope, label the new vertices with "Apex" and "Apex'".

      Example:
      • Here's a way to construct the 3-dimensional cross polytope:> $p = bipyramid(bipyramid(cube(1)));> print equal_polyhedra($p,cross(3)); 1
    •  
      blending (P1, v1, P2, v2) → Polytope

      Compute the blending of two polyhedra at simple vertices. This is a slightly less standard construction. A vertex is simple if its vertex figure is a simplex.

      Moving a vertex v of a bounded polytope to infinity yields an unbounded polyhedron with all edges through v becoming mutually parallel rays. Do this to both input polytopes P1 and P2 at simple vertices v1 and v2, respectively. Up to an affine transformation one can assume that the orthogonal projections of P1 and P2 in direction v1 and v2, respectively, are mutually congruent.

      Any bijection b from the set of edges through v1 to the edges through v2 uniquely defines a way of glueing the unbounded polyhedra to obtain a new bounded polytope, the blending with respect to b. The bijection is specified as a permutation of indices 0 1 2 etc. The default permutation is the identity.

      The number of vertices of the blending is the sum of the numbers of vertices of the input polytopes minus 2. The number of facets is the sum of the numbers of facets of the input polytopes minus the dimension.

      The resulting polytope is described only combinatorially.

      Parameters
      PolytopeP1
      Intv1
      the index of the first vertex
      PolytopeP2
      Intv2
      the index of the second vertex
      Options
      Array<Int>permutation
      Boolrelabel
      copy vertex labels from the original polytope
      Returns
      Polytope
    •  
      cayley_embedding (P_0, P_1, t_0, t_1) → Polytope

      Create a Cayley embedding of two polytopes (one of them must be pointed). The vertices of the first polytope P_0 get embedded to (t_0,0) and the vertices of the second polytope P_1 to (0,t_1).

      Default values are t_0=t_1=1.

      The option relabel creates an additional section VERTEX_LABELS.

      Parameters
      PolytopeP_0
      the first polytope
      PolytopeP_1
      the second polytope
      Scalart_0
      the extra coordinate for the vertices of P_0
      Scalart_1
      the extra coordinate for the vertices of P_1
      Options
      Boolrelabel
      Returns
      Polytope
    •  
      cayley_embedding (A) → Polytope

      Create a Cayley embedding of an array (P1,...,Pm) of polytopes. All polytopes must have the same dimension, at least one of them must be pointed, and all must be defined over the same number type. Each vertex v of the i-th polytope is embedded to v|t_i e_i, where t_i is the i-th entry of the optional array t.

      The option relabel creates an additional section VERTEX_LABELS.

      Parameters
      PolytopeA
      the input polytopes
      Options
      Array<Scalar>factors
      array of scaling factors for the Cayley embedding; defaults to the all-1 vector
      Boolrelabel
      Returns
      Polytope
    •  
      cayley_polytope (P_Array) → Polytope

      Construct the cayley polytope of a set of pointed lattice polytopes contained in P_Array which is the convex hull of P1×e1, ..., Pk×ek where e1, ...,ek are the standard unit vectors in Rk. In this representation the last k coordinates always add up to 1. The option proj projects onto the complement of the last coordinate.

      Parameters
      Array<Polytope>P_Array
      an array containing the lattice polytopes P1,...,Pk
      Options
      Boolproj
      Returns
      Polytope
    •  
      cells_from_subdivision (P, cells) → Polytope<Scalar>

      Extract the given cells of the subdivision of a polyhedron and create a new polyhedron that has as vertices the vertices of the cells.

      Parameters
      Polytope<Scalar>P
      Set<Int>cells
      Options
      Boolrelabel
      copy the vertex labels from the original polytope
      Returns
      Polytope<Scalar>

      Example:
      • First we create a nice subdivision for a small polytope:> $p = new Polytope(VERTICES=>[[1,0,0],[1,0,1],[1,1,0],[1,1,1],[1,3/2,1/2]]);> $p->POLYTOPAL_SUBDIVISION(MAXIMAL_CELLS=>[[0,1,3],[1,2,3],[2,3,4]]); Then we create the polytope that has as vertices the vertices from cell 1 and 2, while keeping their labels.> $c = cells_from_subdivision($p,[1,2],relabel=>1);> print $c->VERTICES; 1 0 1 1 1 0 1 1 1 1 3/2 1/2> print $c->VERTEX_LABELS; 1 2 3 4
    •  
      cell_from_subdivision (P, cell) → Polytope

      Extract the given cell of the subdivision of a polyhedron and write it as a new polyhedron.

      Parameters
      PolytopeP
      Intcell
      Options
      Boolrelabel
      copy the vertex labels from the original polytope
      Returns
      Polytope

      Example:
      • First we create a nice subdivision for our favourite 2-polytope, the square:> $p = cube(2);> $p->POLYTOPAL_SUBDIVISION(MAXIMAL_CELLS=>[[0,1,3],[1,2,3]]); Then we extract the 0-th cell, copying the vertex labels.> $c = cell_from_subdivision($p,0,relabel=>1);> print $c->VERTICES; 1 1 -1 1 -1 1 1 1 1> print $c->VERTEX_LABELS; 1 2 3
    •  
      conv (P_Array) → PropagatedPolytope

      Construct a new polyhedron as the convex hull of the polyhedra given in P_Array.

      Parameters
      Array<Polytope>P_Array
      Returns
      PropagatedPolytope
    •  
      dual_linear_program (P, maximize) → Polytope

      Produces the dual linear program for a given linear program of the form min {cx | Ax >= b, Bx = d}. Here (A,b) are given by the FACETS (or the INEQAULITIES), and (B,d) are given by the AFFINE_HULL (or by the EQUATIONS) of the polytope P, while the objective function c comes from an LP subobject.

      Parameters
      PolytopeP
      = {x | Ax >= b, Bx = d}
      Boolmaximize
      tells if the primal lp is a maximization problem. Default value is 0 (= minimize)
      Returns
      Polytope
    •  
      edge_middle (P) → Polytope

      Produce the convex hull of all edge middle points of some polytope P. The polytope must be BOUNDED.

      Parameters
      PolytopeP
      Returns
      Polytope
    •  
      facet (P, facet) → Cone

      Extract the given facet of a polyhedron and write it as a new polyhedron.

      Parameters
      ConeP
      Intfacet
      Options
      Boolno_coordinates
      don't copy the coordinates, produce purely combinatorial description.
      Boolrelabel
      copy the vertex labels from the original polytope.
      Returns
      Cone

      Example:
      • To create a cone from the vertices of the zeroth facet of the 3-cube, type this:> $p = facet(cube(3),0);
    •  
      facet_to_infinity (P, i) → Polytope

      Make an affine transformation such that the i-th facet is transformed to infinity

      Parameters
      PolytopeP
      Inti
      the facet index
      Returns
      Polytope

      Example:
      • This generates the polytope that is the positive quadrant in 2-space:> $p = new Polytope(VERTICES=>[[1,-1,-1],[1,0,1],[1,1,0]]);> $pf = facet_to_infinity($q,2);> print $pf->VERTICES; 1 0 0 0 0 1 0 1 0
    •  
      free_sum (P1, P2) → Polytope

      Construct a new polyhedron as the free sum of two given bounded ones.

      Parameters
      PolytopeP1
      PolytopeP2
      Options
      Boolforce_centered
      if the input polytopes must be centered. Defaults to true.
      Boolno_coordinates
      produces a pure combinatorial description. Defaluts to false.
      Returns
      Polytope

      Example:
      • > $p = free_sum(cube(2),cube(2));> print $p->VERTICES; 1 -1 -1 0 0 1 1 -1 0 0 1 -1 1 0 0 1 1 1 0 0 1 0 0 -1 -1 1 0 0 1 -1 1 0 0 -1 1 1 0 0 1 1
    •  
      free_sum_decomposition (P) → Array<Polytope>

      Decompose a given polytope into the free sum of smaller ones

      Parameters
      PolytopeP
      Returns
      Array<Polytope>
    •  
      free_sum_decomposition_indices (P) → Array<Set>

      Decompose a given polytope into the free sum of smaller ones, and return the vertex indices of the summands

      Parameters
      PolytopeP
      Returns
      Array<Set>

      Example:
      • > $p = free_sum(cube(1),cube(1));> print $p->VERTICES; 1 -1 0 1 1 0 1 0 -1 1 0 1> print free_sum_decomposition_indices($p); {0 1} {2 3}
    •  
      gc_closure (P) → Polytope

      Produces the gomory-chvatal closure of a full dimensional polyhedron

      Parameters
      PolytopeP
      Returns
      Polytope
    •  
      integer_hull (P) → Polytope

      Produces the integer hull of a polyhedron

      Parameters
      PolytopeP
      Returns
      Polytope

      Example:
      • > $p = new Polytope(VERTICES=>[[1,1.3,0.5],[1,0.2,1.2],[1,0.1,-1.5],[1,-1.4,0.2]]);> $ih = integer_hull($p);> print $ih->VERTICES; 1 -1 0 1 0 -1 1 0 1 1 1 0
    •  
      intersection (C ...) → Cone

      Construct a new polyhedron or cone as the intersection of given polyhedra and/or cones. Works only if all CONE_AMBIENT_DIM values are equal. If the input contains both cones and polytopes, the output will be a polytope.

      Parameters
      ConeC ...
      polyhedra and cones to be intersected
      Returns
      Cone

      Example:
      • > $p = intersection(cube(2),cross(2,3/2));> print $p->VERTICES; 1 1 1/2 -1 1 1 1/2 1 1/2 1 1 1 -1/2 1 -1/2 1 1 -1 1/2 1 -1 -1/2 1 -1/2 -1
    •  
      join_polytopes (P1, P2) → Polytope

      Construct a new polyhedron as the join of two given bounded ones.

      Parameters
      PolytopeP1
      PolytopeP2
      Options
      Boolno_coordinates
      produces a pure combinatorial description.
      Returns
      Polytope

      Example:
      • To join two squares, use this:> $p = join_polytopes(cube(2),cube(2));> print $p->VERTICES; 1 -1 -1 -1 0 0 1 1 -1 -1 0 0 1 -1 1 -1 0 0 1 1 1 -1 0 0 1 0 0 1 -1 -1 1 0 0 1 1 -1 1 0 0 1 -1 1 1 0 0 1 1 1
    •  
      lattice_bipyramid (P, v, v_prime, z, z_prime) → Polytope

      Make a lattice bipyramid over a polyhedron. The bipyramid is the convex hull of the input polyhedron P and two points (v, z), (v_prime, z_prime) on both sides of the affine span of P.

      Parameters
      PolytopeP
      Vectorv
      basis point for the first apex
      Vectorv_prime
      basis for the second apex If v_prime is omitted, v will be used for both apices. If both v and v_prime are omitted, it tries to find two vertices which don't lie in a common facet. If no such vertices can be found or P is a simplex, it uses an interior lattice point as both v and v_prime.
      Rationalz
      height for the first apex, default value is 1
      Rationalz_prime
      height for the second apex, default value is -z
      Options
      Boolrelabel
      copy the vertex labels from the original polytope, label the new vertices with "Apex" and "Apex'".
      Returns
      Polytope

      Example:
      • To create the bipyramid over a square and keep the vertex labels, do this:> $p = lattice_bipyramid(cube(2),new Vector(1,0,0),relabel=>1);> print $p->VERTICES; 1 -1 -1 0 1 1 -1 0 1 -1 1 0 1 1 1 0 1 0 0 1 1 0 0 -1> print $p->VERTEX_LABELS; 0 1 2 3 Apex Apex'
    •  
      lattice_pyramid (P, z, v) → Polytope

      Make a lattice pyramid over a polyhedron. The pyramid is the convex hull of the input polyhedron P and a point v outside the affine span of P.

      Parameters
      PolytopeP
      Rationalz
      the height for the apex (v,z), default value is 1.
      Vectorv
      the lattice point to use as apex, default is the first vertex of P.
      Options
      Boolrelabel
      copy the original vertex labels, label the new top vertex with "Apex".
      Returns
      Polytope

      Example:
      • To create the pyramid of height 5 over a square and keep the vertex labels, do this:> $p = lattice_pyramid(cube(2),5,new Vector(1,0,0),relabel=>1);> print $p->VERTICES; 1 -1 -1 0 1 1 -1 0 1 -1 1 0 1 1 1 0 1 0 0 5> print $p->VERTEX_LABELS; 0 1 2 3 Apex
    •  
      lawrence (P) → Cone

      Create the Lawrence polytope Lambda(P) corresponding to P. Lambda(P) has the property that Gale(Lambda(P)) = Gale(P) union -Gale(P).

      Parameters
      ConeP
      an input cone or polytope
      Returns
      Cone
      the Lawrence cone or polytope to P
    •  
      make_totally_dual_integral (P) → Polytope

      Produces a polyhedron with an totally dual integral inequality formulation of a full dimensional polyhedron

      Parameters
      PolytopeP
      Returns
      Polytope
    •  
      mapping_polytope (P1, P2) → Polytope

      Construct a new polytope as the mapping polytope of two polytopes P1 and P2. The mapping polytope is the set of all affine maps from Rp to Rq, that map P1 into P2.

      The label of a new facet corresponding to v1 and h1 will have the form "v1*h1".

      Parameters
      PolytopeP1
      PolytopeP2
      Options
      Boolrelabel
      Returns
      Polytope
    •  
      minkowski_sum (P1, P2) → Polytope

      Produces the Minkowski sum of P1 and P2.

      Parameters
      PolytopeP1
      PolytopeP2
      Returns
      Polytope

      Example:
      • The following stores the minkowski sum of a square and a triangle in the variable $p and then prints its vertices.> $p = minkowski_sum(cube(2),simplex(2));> print $p->VERTICES; 1 -1 -1 1 2 -1 1 -1 2 1 2 1 1 1 2
    •  
      minkowski_sum (lambda, P1, mu, P2) → Polytope

      Produces the polytope lambda*P1+mu*P2, where * and + are scalar multiplication and Minkowski addition, respectively.

      Parameters
      Scalarlambda
      PolytopeP1
      Scalarmu
      PolytopeP2
      Returns
      Polytope

      Example:
      • The following stores the minkowski sum of a scaled square and a triangle in the variable $p and then prints its vertices.> $p = minkowski_sum(2,cube(2),1,simplex(2));> print $p->VERTICES; 1 -2 -2 1 3 -2 1 -2 3 1 3 2 1 2 3
    •  
      minkowski_sum_fukuda (summands) → Polytope<Scalar>

      Computes the (VERTICES of the) Minkowski sum of a list of polytopes using the algorithm by Fukuda described in

      Komei Fukuda, From the zonotope construction to the Minkowski addition of convex polytopes, J. Symbolic Comput., 38(4):1261-1272, 2004.

      Example:
      • > $p = minkowski_sum_fukuda([cube(2),simplex(2),cross(2)]);> print $p->VERTICES; 1 -2 -1 1 -1 -2 1 3 -1 1 3 1 1 2 -2 1 -2 2 1 -1 3 1 1 3
    •  
      mixed_integer_hull (P, int_coords) → Polytope

      Produces the mixed integer hull of a polyhedron

      Parameters
      PolytopeP
      Array<Int>int_coords
      the coordinates to be integral;
      Returns
      Polytope
    •  
      pointed_part (P) → Polytope

      Produces the pointed part of a polyhedron

      Parameters
      PolytopeP
      Returns
      Polytope

      Example:
      • > $p = new Polytope(POINTS=>[[1,0,0],[1,0,1],[1,1,0],[1,1,1],[0,1,0],[0,0,1]]);> $pp = pointed_part($p);> print $pp->VERTICES; 1 0 0 0 1 0 0 0 1
    •  
      prism (P, z1, z2) → Polytope

      Make a prism over a pointed polyhedron. The prism is the product of the input polytope P and the interval [z1, z2].

      Parameters
      PolytopeP
      the input polytope
      Scalarz1
      the left endpoint of the interval; default value: -1
      Scalarz2
      the right endpoint of the interval; default value: -z1
      Options
      Boolno_coordinates
      only combinatorial information is handled
      Boolrelabel
      creates an additional section VERTEX_LABELS; the bottom facet vertices get the labels from the original polytope; the labels of their clones in the top facet get a tick (') appended.
      Returns
      Polytope

      Example:
      • The following saves the prism over the square and the interval [-2,2] to the variable $p while relabeling, and then prints a nice representation of its vertices.> $p = prism(cube(2),-2,relabel=>1);> print labeled($p->VERTICES,$p->VERTEX_LABELS); 0:1 -1 -1 -2 1:1 1 -1 -2 2:1 -1 1 -2 3:1 1 1 -2 0':1 -1 -1 2 1':1 1 -1 2 2':1 -1 1 2 3':1 1 1 2
    •  
      product (P1, P2) → Polytope

      Construct a new polytope as the product of two given polytopes P1 and P2.

      Parameters
      PolytopeP1
      PolytopeP2
      Options
      Boolno_coordinates
      only combinatorial information is handled
      Boolrelabel
      creates an additional section VERTEX_LABELS; the label of a new vertex corresponding to v1 ⊕ v2 will have the form LABEL_1*LABEL_2.
      Returns
      Polytope

      Example:
      • The following builds the product of a square and an interval while relabeling, and then prints a nice representation of its vertices.> $p = product(cube(2),cube(1),relabel=>1);> print labeled($p->VERTICES,$p->VERTEX_LABELS); 0*0:1 -1 -1 -1 0*1:1 -1 -1 1 1*0:1 1 -1 -1 1*1:1 1 -1 1 2*0:1 -1 1 -1 2*1:1 -1 1 1 3*0:1 1 1 -1 3*1:1 1 1 1
    •  
      projection (P, indices) → Cone

      Orthogonally project a pointed polyhedron to a coordinate subspace.

      The subspace the polyhedron P is projected on is given by indices in the set indices. The option revert inverts the coordinate list. The client scans for all coordinate sections and produces proper output from each. If a description in terms of inequalities is found, the client performs Fourier-Motzkin elimination unless the nofm option is set. Setting the nofm option is useful if the corank of the projection is large; in this case the number of inequalities produced grows quickly.

      Parameters
      ConeP
      Array<Int>indices
      Options
      Boolrevert
      inverts the coordinate list
      Boolnofm
      suppresses Fourier-Motzkin elimination
      Returns
      Cone

      Example:
      • project the 3-cube along the first coordinate, i.e. to the subspace spanned by the second and third coordinate:> $p = projection(cube(3),[1],revert=>1);> print $p->VERTICES; 1 1 -1 1 1 1 1 -1 1 1 -1 -1
    •  
      projection_full (P) → Cone

      Orthogonally project a polyhedron to a coordinate subspace such that redundant columns are omitted, i.e., the projection becomes full-dimensional without changing the combinatorial type. The client scans for all coordinate sections and produces proper output from each. If a description in terms of inequalities is found, the client performs Fourier-Motzkin elimination unless the nofm option is set. Setting the nofm option is useful if the corank of the projection is large; in this case the number of inequalities produced grows quickly.

      Parameters
      ConeP
      Options
      Boolnofm
      suppresses Fourier-Motzkin elimination
      Boolrelabel
      copy labels to projection
      Returns
      Cone
    •  
      pyramid (P, z) → Polytope

      Make a pyramid over a polyhedron. The pyramid is the convex hull of the input polyhedron P and a point v outside the affine span of P. For bounded polyhedra, the projection of v to the affine span of P coincides with the vertex barycenter of P.

      Parameters
      PolytopeP
      Scalarz
      is the distance between the vertex barycenter and v, default value is 1.
      Options
      Boolno_coordinates
      don't compute new coordinates, produce purely combinatorial description.
      Boolrelabel
      copy vertex labels from the original polytope, label the new top vertex with "Apex".
      Returns
      Polytope

      Example:
      • The following saves the pyramid of height 2 over the square to the variable $p. The vertices are relabeled.> $p = pyramid(cube(2),2,relabel=>1); To print the vertices and vertex labels of the newly generated pyramid, do this:> print $p->VERTICES; 1 -1 -1 0 1 1 -1 0 1 -1 1 0 1 1 1 0 1 0 0 2> print $p->VERTEX_LABELS; 0 1 2 3 Apex
    •  
      rand_inner_points (P, n) → Polytope

      Produce a polytope with n random points from the input polytope P. Each generated point is a convex linear combination of the input vertices with uniformly distributed random coefficients. Thus, the output points can't in general be expected to be distributed uniformly within the input polytope; cf. unirand for this. The polytope must be BOUNDED.

      Parameters
      PolytopeP
      the input polytope
      Intn
      the number of random points
      Options
      Intseed
      controls the outcome of the random number generator; fixing a seed number guarantees the same outcome.
      Returns
      Polytope
    •  
      rand_vert (V, n) → Matrix

      Selects n random vertices from the set of vertices V. This can be used to produce random polytopes which are neither simple nor simplicial as follows: First produce a simple polytope (for instance at random, by using rand_sphere, rand, or unirand). Then use this client to choose among the vertices at random. Generalizes random 0/1-polytopes.

      Parameters
      MatrixV
      the vertices of a polytope
      Intn
      the number of random points
      Options
      Intseed
      controls the outcome of the random number generator; fixing a seed number guarantees the same outcome.
      Returns
      Matrix
    •  
      spherize (P) → Polytope

      Project all vertices of a polyhedron P on the unit sphere. P must be CENTERED and BOUNDED.

      Parameters
      PolytopeP
      Returns
      Polytope

      Example:
      • The following scales the 2-dimensional cross polytope by 23 and then projects it back onto the unit circle.> $p = scale(cross(2),23);> $s = spherize($p);> print $s->VERTICES; 1 1 0 1 -1 0 1 0 1 1 0 -1
    •  
      stack (P, stack_facets) → Polytope

      Stack a (simplicial or cubical) polytope over one or more of its facets.

      For each facet of the polytope P specified in stack_facets, the barycenter of its vertices is lifted along the normal vector of the facet. In the simplicial case, this point is directly added to the vertex set, thus building a pyramid over the facet. In the cubical case, this pyramid is truncated by a hyperplane parallel to the original facet at its half height. This way, the property of being simplicial or cubical is preserved in both cases.

      The option lift controls the exact coordinates of the new vertices. It should be a rational number between 0 and 1, which expresses the ratio of the distance between the new vertex and the stacked facet, to the maximal possible distance. When lift=0, the new vertex would lie on the original facet. lift=1 corresponds to the opposite extremal case, where the new vertex hit the hyperplane of some neighbor facet. As an additional restriction, the new vertex can't lie further from the facet as the vertex barycenter of the whole polytope. Alternatively, the option noc (no coordinates) can be specified to produce a pure combinatorial description of the resulting polytope.

      Parameters
      PolytopeP
      Set<Int>stack_facets
      the facets to be stacked; A single facet to be stacked is specified by its number. Several facets can be passed in a Set or in an anonymous array of indices: [n1,n2,...] Special keyword All means that all factes are to be stacked.
      Options
      Rationallift
      controls the exact coordinates of the new vertices; rational number between 0 and 1; default value: 1/2
      Boolno_coordinates
      produces a pure combinatorial description (in contrast to lift)
      Boolrelabel
      creates an additional section VERTEX_LABELS; New vertices get labels 'f(FACET_LABEL)' in the simplicial case, and 'f(FACET_LABEL)-NEIGHBOR_VERTEX_LABEL' in the cubical case.
      Returns
      Polytope

      Example:
      • To generate a cubical polytope by stacking all facets of the 3-cube to height 1/4, do this:> $p = stack(cube(3),All,lift=>1/4);
    •  
      stellar_all_faces (P, d) → Polytope

      Perform a stellar subdivision of all proper faces, starting with the facets.

      Parameter d specifies the lowest dimension of the faces to be divided. It can also be negative, then treated as the co-dimension. Default is 1, that is, the edges of the polytope.

      Parameters
      PolytopeP
      , must be bounded
      Intd
      the lowest dimension of the faces to be divided; negative values: treated as the co-dimension; default value: 1.
      Returns
      Polytope
    •  
      stellar_indep_faces (P, in_faces) → Polytope

      Perform a stellar subdivision of the faces in_faces of a polyhedron P.

      The faces must have the following property: The open vertex stars of any pair of faces must be disjoint.

      Parameters
      PolytopeP
      , must be bounded
      Array<Set<Int>>in_faces
      Returns
      Polytope
    •  
      tensor (P1, P2) → Polytope

      Construct a new polytope as the convex hull of the tensor products of the vertices of two polytopes P1 and P2. Unbounded polyhedra are not allowed. Does depend on the vertex coordinates of the input.

      Parameters
      PolytopeP1
      PolytopeP2
      Returns
      Polytope

      Example:
      • The following creates the tensor product polytope of two squares and then prints its vertices.> $p = tensor(cube(2),cube(2));> print $p->VERTICES; 1 1 1 1 1 1 -1 1 -1 1 1 1 -1 1 -1 1 -1 1 1 -1 1 1 1 -1 -1 1 1 -1 -1 1 1 -1 -1 1 1 1 -1 -1 -1 -1
    •  
      truncation (P, trunc_vertices) → Polytope

      Cut off one or more vertices of a polyhedron.

      The exact location of the cutting hyperplane(s) can be controlled by the option cutoff, a rational number between 0 and 1. When cutoff=0, the hyperplane would go through the chosen vertex, thus cutting off nothing. When cutoff=1, the hyperplane touches the nearest neighbor vertex of a polyhedron.

      Alternatively, the option no_coordinates can be specified to produce a pure combinatorial description of the resulting polytope, which corresponds to the cutoff factor 1/2.

      Parameters
      PolytopeP
      Set<Int>trunc_vertices
      the vertex/vertices to be cut off; A single vertex to be cut off is specified by its number. Several vertices can be passed in a Set or in an anonymous array of indices: [n1,n2,...] Special keyword All means that all vertices are to be cut off.
      Options
      Scalarcutoff
      controls the exact location of the cutting hyperplane(s); rational number between 0 and 1; default value: 1/2
      Boolno_coordinates
      produces a pure combinatorial description (in contrast to cutoff)
      Boolrelabel
      creates an additional section VERTEX_LABELS; New vertices get labels of the form 'LABEL1-LABEL2', where LABEL1 is the original label of the truncated vertex, and LABEL2 is the original label of its neighbor.
      Returns
      Polytope

      Example:
      • To truncate the second vertex of the square at 1/4, try this:> $p = truncation(cube(2),2,cutoff=>1/4);> print $p->VERTICES; 1 -1 -1 1 1 -1 1 1 1 1 -1 1/2 1 -1/2 1
    •  
      unirand (P, n) → Polytope

      Produce a polytope with n random points that are uniformly distributed within the given polytope P. P must be bounded and full-dimensional.

      Parameters
      PolytopeP
      Intn
      the number of random points
      Options
      Boolboundary
      forces the points to lie on the boundary of the given polytope
      Intseed
      controls the outcome of the random number generator; fixing a seed number guarantees the same outcome.
      Returns
      Polytope

      Examples:
      • This produces a polytope as the convex hull of 5 random points in the square with the origin as its center and side length 2:> $p = unirand(cube(2),5);
      • This produces a polytope as the convex hull of 5 random points on the boundary of the square with the origin as its center and side length 2:> $p = unirand(cube(2),5,boundary=>1);
    •  
      vertex_figure (p, n) → Polytope

      Construct the vertex figure of the vertex n of a polyhedron. The vertex figure is dual to a facet of the dual polytope.

      Parameters
      Polytopep
      Intn
      number of the chosen vertex
      Options
      Scalarcutoff
      controls the exact location of the cutting hyperplane. It should lie between 0 and 1. Value 0 would let the hyperplane go through the chosen vertex, thus degenerating the vertex figure to a single point. Value 1 would let the hyperplane touch the nearest neighbor vertex of a polyhedron. Default value is 1/2.
      Boolno_coordinates
      skip the coordinates computation, producing a pure combinatorial description.
      Boolrelabel
      inherit vertex labels from the corresponding neighbor vertices of the original polytope.
      Returns
      Polytope

      Example:
      • This produces a vertex figure of one vertex of a 3-dimensional cube with the origin as its center and side length 2. The result is a 2-simplex.> $p = vertex_figure(cube(3),5);> print $p->VERTICES; 1 1 -1 0 1 1 0 1
    •  
      wedge (P, facet, z, z_prime) → Polytope

      Make a wedge from a polytope over the given facet. The polytope must be bounded. The inclination of the bottom and top side facet is controlled by z and z_prime, which are heights of the projection of the old vertex barycenter on the bottom and top side facet respectively.

      Parameters
      PolytopeP
      , must be bounded
      Intfacet
      the `cutting edge'.
      Rationalz
      default value is 0.
      Rationalz_prime
      default value is -z, or 1 if z==0.
      Options
      Boolno_coordinates
      don't compute coordinates, pure combinatorial description is produced.
      Boolrelabel
      create vertex labels: The bottom facet vertices obtain the labels from the original polytope; the labels of their clones in the top facet get a tick (') appended.
      Returns
      Polytope

      Example:
      • This produces the wedge from a square (over the facet 0), which yields a prism over a triangle:> $p = wedge(cube(2),0);> print $p->VERTICES; 1 -1 -1 0 1 1 -1 0 1 -1 1 0 1 1 1 0 1 1 -1 2 1 1 1 2
    •  
      wreath (P1, P2) → Polytope

      Construct a new polytope as the wreath product of two input polytopes P1, P2. P1 and P2 have to be BOUNDED.

      Parameters
      PolytopeP1
      PolytopeP2
      Options
      Booldual
      invokes the computation of the dual wreath product
      Boolrelabel
      creates an additional section VERTEX_LABELS; the label of a new vertex corresponding to v1 ⊕ v2 will have the form LABEL_1*LABEL_2.
      Returns
      Polytope
  •  

    With these clients you can create polytopes belonging to various parameterized families which occur frequently in polytope theory, as well as several kinds of random polytopes. Regular polytopes and their friends are listed separately.

    •  
      associahedron (d) → Polytope

      Produce a d-dimensional associahedron (or Stasheff polytope). We use the facet description given in Ziegler's book on polytopes, section 9.2.

      Parameters
      Intd
      the dimension
      Returns
      Polytope
    •  
      binary_markov_graph (observation) → PropagatedPolytope

      Defines a very simple graph for a polytope propagation related to a Hidden Markov Model. The propagated polytope is always a polygon. For a detailed description see

      M. Joswig: Polytope propagation, in: Algebraic statistics and computational biology
      by L. Pachter and B. Sturmfels (eds.), Cambridge, 2005.
      Parameters
      Array<Bool>observation
      Returns
      PropagatedPolytope
    •  
      binary_markov_graph (observation)

      Parameters
      Stringobservation
      encoded as a string of "0" and "1".
    •  
      birkhoff (n, even) → Polytope

      Constructs the Birkhoff polytope of dimension n2. It is the polytope of nxn stochastic matrices (encoded as n2 row vectors), thus matrices with non-negative entries whose row and column entries sum up to one. Its vertices are the permutation matrices.

      Parameters
      Intn
      Booleven
      Defaults to '0'. Set this to '1' to get vertices only for even permutation matrices.
      Returns
      Polytope
    •  
      cyclic (d, n) → Polytope

      Produce a d-dimensional cyclic polytope with n points. Prototypical example of a neighborly polytope. Combinatorics completely known due to Gale's evenness criterion. Coordinates are chosen on the (spherical) moment curve at integer steps from start, or 0 if unspecified. If spherical is true the vertices lie on the sphere with center (1/2,0,...,0) and radius 1/2. In this case (the necessarily positive) parameter start defaults to 1.

      Parameters
      Intd
      the dimension
      Intn
      the number of points
      Options
      Intstart
      defaults to 0 (or to 1 if spherical)
      Boolspherical
      defaults to false
      Returns
      Polytope

      Example:
      • To create the 2-dimensional cyclic polytope with 6 points on the sphere, starting at 3:> $p = cyclic(2,6,start=>3,spherical=>1);> print $p->VERTICES; 1 1/10 3/10 1 1/26 5/26 1 1/37 6/37 1 1/50 7/50 1 1/65 8/65
    •  
      cyclic_caratheodory (d, n) → Polytope

      Produce a d-dimensional cyclic polytope with n points. Prototypical example of a neighborly polytope. Combinatorics completely known due to Gale's evenness criterion. Coordinates are chosen on the trigonometric moment curve. For cyclic polytopes from other curves, see polytope::cyclic.

      Parameters
      Intd
      the dimension. Required to be even.
      Intn
      the number of points
      Returns
      Polytope
    •  
      delpezzo (d, scale) → Polytope<Scalar>

      Produce a d-dimensional del-Pezzo polytope, which is the convex hull of the cross polytope together with the all-ones and minus all-ones vector.

      All coordinates are +/- scale or 0.

      Parameters
      Intd
      the dimension
      Scalarscale
      the absolute value of each non-zero vertex coordinate. Needs to be positive. The default value is 1.
      Returns
      Polytope<Scalar>
    •  
      dwarfed_cube (d) → Polytope

      Produce a d-dimensional dwarfed cube.

      Parameters
      Intd
      the dimension
      Returns
      Polytope
    •  
      dwarfed_product_polygons (d, s) → Polytope

      Produce a d-dimensional dwarfed product of polygons of size s.

      Parameters
      Intd
      the dimension
      Ints
      the size
      Returns
      Polytope
    •  
      explicit_zonotope (zones) → Polytope

      Produce the POINTS of a zonotope as the iterated Minkowski sum of all intervals [-x,x], where x ranges over the rows of the input matrix zones.

      Parameters
      Matrixzones
      the input vectors
      Options
      Boolrows_are_points
      the rows of the input matrix represent affine points(true, default) or linear vectors(false)
      Returns
      Polytope

      Example:
      • > $M = new Matrix([1,1],[1,-1]);> $p = explicit_zonotope($M,rows_are_points=>0);> print $p->VERTICES; 1 2 0 1 0 -2 1 0 2 1 -2 0
    •  
      fano_simplex (d) → Polytope

      Produce a Fano d-simplex.

      Parameters
      Intd
      the dimension
      Options
      Boolgroup
      Returns
      Polytope

      Example:
      • To create the 2-dimensional fano simplex and compute its symmetry group, type this: and print ints generators, do this:> fano_simplex(2,group=>1);> print $p->GROUP->GENERATORS; 1 0 2 2 0 1
    •  
      fractional_knapsack (b) → Polytope

      Produce a knapsack polytope defined by one linear inequality (and non-negativity constraints).

      Parameters
      Vector<Rational>b
      linear inequality
      Returns
      Polytope
    •  
      goldfarb (d, e, g) → Polytope

      Produces a d-dimensional Goldfarb cube if e<1/2 and g<=e/4. The Goldfarb cube is a combinatorial cube and yields a bad example for the Simplex Algorithm using the Shadow Vertex Pivoting Strategy. Here we use the description as a deformed product due to Amenta and Ziegler. For e<1/2 and g=0 we obtain the Klee-Minty cubes.

      Parameters
      Intd
      the dimension
      Scalare
      Scalarg
      Returns
      Polytope
    •  
      goldfarb_sit (d, eps, delta) → Polytope

      Produces a d-dimensional variation of the Klee-Minty cube if eps<1/2 and delta<=1/2. This Klee-Minty cube is scaled in direction x_(d-i) by (eps*delta)^i. This cube is a combinatorial cube and yields a bad example for the Simplex Algorithm using the 'steepest edge' Pivoting Strategy. Here we use a scaled description of the construction of Goldfarb and Sit.

      Parameters
      Intd
      the dimension
      Scalareps
      Scalardelta
      Returns
      Polytope
    •  
      hypersimplex (k, d) → Polytope

      Produce the hypersimplex Δ(k,d), that is the the convex hull of all 0/1-vector in Rd with exactly k 1s. Note that the output is never full-dimensional.

      Parameters
      Intk
      number of 1s
      Intd
      ambient dimension
      Options
      Boolgroup
      Boolno_vertices
      do not compute vertices
      Boolno_facets
      do not compute facets
      Boolno_vif
      do not compute vertices in facets
      Returns
      Polytope

      Example:
      • This creates the hypersimplex in dimension 4 with vertices with exactly two 1-entries and computes its symmetry group:> $h = hypersimplex(2,4,group=>1);
    •  
      hypertruncated_cube <Scalar> (d, k, lambda) → Polytope<Scalar>

      Produce a d-dimensional hypertruncated cube. With symmetric linear objective function (0,1,1,...,1).

      Type Parameters
      Scalar
      Coordinate type of the resulting polytope. Unless specified explicitly, deduced from the type of bound values, defaults to Rational.
      Parameters
      Intd
      the dimension
      Scalark
      cutoff parameter
      Scalarlambda
      scaling of extra vertex
      Returns
      Polytope<Scalar>
    •  
      klee_minty_cube (d, e) → Polytope

      Produces a d-dimensional Klee-Minty-cube if e<1/2. Uses the goldfarb client with g=0.

      Parameters
      Intd
      the dimension
      Scalare
      Returns
      Polytope
    •  
      k_cyclic (n, s) → Polytope

      Produce a (rounded) 2*k-dimensional k-cyclic polytope with n points, where k is the length of the input vector s. Special cases are the bicyclic (k=2) and tricyclic (k=3) polytopes. Only possible in even dimensions.

      The parameters s_i can be specified as integer, floating-point, or rational numbers. The coordinates of the i-th point are taken as follows:

      cos(s_1 * 2πi/n),
      sin(s_1 * 2πi/n),
      ...
      cos(s_k * 2πi/n),
      sin(s_k * 2πi/n)

      Warning: Some of the k-cyclic polytopes are not simplicial. Since the components are rounded, this function might output a polytope which is not a k-cyclic polytope!

      More information can be found in the following references:

      P. Schuchert: "Matroid-Polytope und Einbettungen kombinatorischer Mannigfaltigkeiten",
      PhD thesis, TU Darmstadt, 1995.
      Z. Smilansky: "Bi-cyclic 4-polytopes",
      Isr. J. Math. 70, 1990, 82-92
      Parameters
      Intn
      the number of points
      Vectors
      s=(s_1,...,s_k)
      Returns
      Polytope

      Example:
      • To produce a (not exactly) regular pentagon, type this:> $p = k_cyclic(5,[1]);
    •  
      lecture_hall_simplex (d) → Polytope

      Produce a lecture hall d-simplex.

      Parameters
      Intd
      the dimension
      Options
      Boolgroup
      Returns
      Polytope

      Example:
      • To create the 2-dimensional lecture hall simplex and compute its symmetry group, type this:> $p = lecture_hall_simplex(2,group=>1);> print $p->GROUP->GENERATORS; 1 0 2 2 0 1
    •  
      long_and_winding (r) → Polytope<PuiseuxFraction<Max, Rational, Rational> >

      Produce polytope in dimension 2r+2 with 3r+4 facets such that the total curvature of the central path is at least Omega(2^r). This establishes a counter-example to a continuous analog of the Hirsch conjecture by Deza, Terlaky and Zinchenko, Adv. Mech. Math. 17 (2009). The construction and its analysis can be found in Allamigeon, Benchimol, Gaubert and Joswig, arXiv: 1405.4161

      Parameters
      Intr
      defining parameter
      Options
      Rationaleval_ratio
      parameter for evaluating the puiseux rational functions
      Inteval_exp
      to evaluate at eval_ratio^eval_exp, default: 1
      Floateval_float
      parameter for evaluating the puiseux rational functions
      Returns
      Polytope<PuiseuxFraction<Max, Rational, Rational> >
    •  
      max_GC_rank (d) → Polytope

      Produce a d-dimensional polytope of maximal Gomory-Chvatal rank Omega(d/log(d)), integrally infeasible. With symmetric linear objective function (0,1,1..,1). Construction due to Pokutta and Schulz.

      Parameters
      Intd
      the dimension
      Returns
      Polytope
    •  
      multiplex (d, n) → Polytope

      Produce a combinatorial description of a multiplex with parameters d and n. This yields a self-dual d-dimensional polytope with n+1 vertices.

      They are introduced by

      T. Bisztriczky,
      On a class of generalized simplices, Mathematika 43:27-285, 1996,

      see also

      M.M. Bayer, A.M. Bruening, and J.D. Stewart,
      A combinatorial study of multiplexes and ordinary polytopes,
      Discrete Comput. Geom. 27(1):49--63, 2002.
      Parameters
      Intd
      the dimension
      Intn
      Returns
      Polytope
    •  
      neighborly_cubical (d, n) → Polytope

      Produce the combinatorial description of a neighborly cubical polytope. The facets are labelled in oriented matroid notation as in the cubical Gale evenness criterion.

      See Joswig and Ziegler, Discr. Comput. Geom. 24:315-344 (2000).
      Parameters
      Intd
      dimension of the polytope
      Intn
      dimension of the equivalent cube
      Returns
      Polytope
    •  
      newton (p) → Polytope<Rational>

      Produce the Newton polytope of a polynomial p.


      Example:
      • Create the newton polytope of 1+x^2+y like so:> $r=new Ring(qw(x y));> ($x,$y)=$r->variables;> $p=1+($x^2)+$y;> $n = newton($p);> print $n->VERTICES; 1 0 0 1 0 1 1 2 0
    •  
      n_gon (n, r) → Polytope

      Produce a regular n-gon. All vertices lie on a circle of radius r. The radius defaults to 1.

      Parameters
      Intn
      the number of vertices
      Rationalr
      the radius
      Options
      Boolgroup
      Returns
      Polytope

      Example:
      • To store the regular pentagon in the variable $p and calculate its symmetry group, do this:> $p = n_gon(5,group=>1);> print $p->GROUP->GENERATORS; 0 4 3 2 1 1 2 3 4 0
    •  
      perles_irrational_8_polytope () → Polytope

      Create an 8-dimensional polytope without rational realizations due to Perles

      Returns
      Polytope
    •  
      permutahedron (d) → Polytope

      Produce a d-dimensional permutahedron. The vertices correspond to the elements of the symmetric group of degree d+1.

      Parameters
      Intd
      the dimension
      Options
      Boolgroup
      Returns
      Polytope

      Example:
      • To create the 3-permutahedron and also compute its symmetry group, do this:> $p = permutahedron(3,group=>1);> print $p->GROUP->GENERATORS; 1 0 2 3 3 0 1 2
    •  
      pile (sizes) → Polytope

      Produce a (d+1)-dimensional polytope from a pile of cubes. Start with a d-dimensional pile of cubes. Take a generic convex function to lift this polytopal complex to the boundary of a (d+1)-polytope.

      Parameters
      Vector<Int>sizes
      a vector (s1,...,sd, where si specifies the number of boxes in the i-th dimension.
      Returns
      Polytope
    •  
      pseudo_delpezzo (d, scale) → Polytope<Scalar>

      Produce a d-dimensional del-Pezzo polytope, which is the convex hull of the cross polytope together with the all-ones vector.

      All coordinates are +/- scale or 0.

      Parameters
      Intd
      the dimension
      Scalarscale
      the absolute value of each non-zero vertex coordinate. Needs to be positive. The default value is 1.
      Returns
      Polytope<Scalar>
    •  
      rand01 (d, n) → Polytope

      Produce a d-dimensional 0/1-polytope with n random vertices. Uniform distribution.

      Parameters
      Intd
      the dimension
      Intn
      the number of random vertices
      Options
      Intseed
      controls the outcome of the random number generator; fixing a seed number guarantees the same outcome.
      Returns
      Polytope
    •  
      rand_box (d, n, b) → Polytope

      Computes the convex hull of n points sampled uniformly at random from the integer points in the cube [0,b]d.

      Parameters
      Intd
      the dimension of the box
      Intn
      the number of random points
      Intb
      the size of the box
      Options
      Intseed
      controls the outcome of the random number generator; fixing a seed number guarantees the same outcome.
      Returns
      Polytope
    •  
      rand_cyclic (d, n) → Polytope

      Computes a random instance of a cyclic polytope of dimension d on n vertices by randomly generating a Gale diagram whose cocircuits have alternating signs.

      Parameters
      Intd
      the dimension
      Intn
      the number of vertices
      Options
      Intseed
      controls the outcome of the random number generator; fixing a seed number guarantees the same outcome.
      Returns
      Polytope
    •  
      rand_metric <Scalar> (n) → Matrix

      Produce an n-point metric with random distances. The values are uniformily distributed in [1,2].

      Type Parameters
      Scalar
      element type of the result matrix
      Parameters
      Intn
      Options
      Intseed
      controls the outcome of the random number generator; fixing a seed number guarantees the same outcome.
      Returns
      Matrix
    •  
      rand_metric_int <Scalar> (n) → Matrix

      Produce an n-point metric with random distances. The values are uniformily distributed in [1,2].

      Type Parameters
      Scalar
      element type of the result matrix
      Parameters
      Intn
      Options
      Intseed
      controls the outcome of the random number generator; fixing a seed number guarantees the same outcome.
      Returns
      Matrix
    •  
      rand_sphere (d, n) → Polytope

      Produce a d-dimensional polytope with n random vertices uniformly distributed on the unit sphere.

      Parameters
      Intd
      the dimension
      Intn
      the number of random vertices
      Options
      Intseed
      controls the outcome of the random number generator; fixing a seed number guarantees the same outcome.
      Returns
      Polytope
    •  
      rss_associahedron (l) → Polytope

      Produce a polytope of constrained expansions in dimension l according to

      Rote, Santos, and Streinu: Expansive motions and the polytope of pointed pseudo-triangulations.
      Discrete and computational geometry, 699--736, Algorithms Combin., 25, Springer, Berlin, 2003.
      Parameters
      Intl
      ambient dimension
      Returns
      Polytope
    •  
      signed_permutahedron (d) → Polytope

      Produce a d-dimensional signed permutahedron.

      Parameters
      Intd
      the dimension
      Returns
      Polytope
    •  
      simplex (d, scale) → Polytope

      Produce the standard d-simplex. Combinatorially equivalent to a regular polytope corresponding to the Coxeter group of type Ad-1. Optionally, the simplex can be scaled by the parameter scale.

      Parameters
      Intd
      the dimension
      Scalarscale
      default value: 1
      Options
      Boolgroup
      Returns
      Polytope

      Examples:
      • To print the vertices (in homogeneous coordinates) of the standard 2-simplex, i.e. a right-angled isoceles triangle, type this:> print simplex(2)->VERTICES; (3) (0 1) 1 1 0 1 0 1 The first row vector is sparse and encodes the origin.
      • To create a 3-simplex and also calculate its symmetry group, type this:> simplex(3,group=>1);
    •  
      stable_set (G) → Polytope

      Produces the stable set polytope from an undirected graph G=(V,E). The stable set Polytope has the following inequalities: x_i + x_j <= 1 forall {i,j} in E x_i >= 0 forall i in V x_i <= 1 forall i in V with deg(i)=0

      Parameters
      GraphG
      Returns
      Polytope
    •  
      transportation (r, c) → Polytope

      Produce the transportation polytope from two vectors r of length m and c of length n, i.e. all positive m×n Matrizes with row sums equal to r and column sums equal to c.

      Parameters
      Vectorr
      Vectorc
      Returns
      Polytope
    •  
      upper_bound_theorem (d, n) → Polytope

      Produce combinatorial data common to all simplicial d-polytopes with n vertices with the maximal number of facets as given by McMullen's Upper-Bound-Theorem. Essentially this lets you read off all possible entries of the H_VECTOR and the F_VECTOR.

      Parameters
      Intd
      the dimension
      Intn
      the number of points
      Returns
      Polytope

      Example:
      • This produces the combinatorial data as mentioned above for 5 points in dimension 3 and prints the h-vector:> $p = upper_bound_theorem(3,5);> print $p->H_VECTOR; 1 2 2 1
    •  
      zonotope (M) → Polytope<Scalar>

      Create a zonotope from a matrix whose rows are input points or vectors.

      This method merely defines a Polytope object with the property ZONOTOPE_INPUT_POINTS.

      Parameters
      Matrix<Scalar>M
      input points or vectors
      Options
      Boolrows_are_points
      true if M are points instead of vectors; default true
      Boolcentered
      true if output should be centered; default true
      Returns
      Polytope<Scalar>
      the zonotope generated by the input points or vectors

      Examples:
      • The following produces a parallelogram with the origin as its vertex barycenter:> $M = new Matrix([[1,1,0],[1,1,1]]);> $p = zonotope($M);> print $p->VERTICES; 1 0 -1/2 1 0 1/2 1 -1 -1/2 1 1 1/2
      • The following produces a parallelogram with the origin being a vertex (not centered case):> $M = new Matrix([[1,1,0],[1,1,1]]);> $p = zonotope($M,centered=>0);> print $p->VERTICES; 1 0 0 1 1 1 1 1 0 1 2 1
    •  
      zonotope_vertices_fukuda (M) → Matrix<E>

      Create the vertices of a zonotope from a matrix whose rows are input points or vectors.

      Parameters
      Matrix<Scalar>M
      Options
      Boolcentered_zonotope
      default 1
      Returns
      Matrix<E>

      Example:
      • The following stores the vertices of a parallelogram with the origin as its vertex barycenter and prints them:> $M = new Matrix([[1,1,0],[1,1,1]]);> print zonotope_vertices_fukuda($M); 1 0 -1/2 1 0 1/2 1 -1 -1/2 1 1 1/2
  •  

    A way of constructing vector configurations is to modify an already existing vector configuration.

    •  
      projection (P, indices) → VectorConfiguration

      Orthogonally project a vector configuration to a coordinate subspace.

      The subspace the VectorConfiguration P is projected on is given by indices in the set indices. The option revert inverts the coordinate list.

      Parameters
      VectorConfigurationP
      Array<Int>indices
      Options
      Boolrevert
      inverts the coordinate list
      Returns
      VectorConfiguration
    •  
      projection_full (P) → VectorConfiguration

      Orthogonally project a vector configuration to a coordinate subspace such that redundant columns are omitted, i.e., the projection becomes full-dimensional without changing the combinatorial type.

      Parameters
      VectorConfigurationP
      Options
      Boolrelabel
      copy labels to projection
      Returns
      VectorConfiguration
  •  

    Functions producing big objects which are not contained in application polytope.

  •  

    This includes the Platonic solids and their generalizations into two directions. In dimension 3 there are the Archimedean, Catalan and Johnson solids. In higher dimensions there are the simplices, the cubes, the cross polytopes and three other regular 4-polytopes.

    •  
      archimedean_solid (s) → Polytope

      Create Archimedean solid of the given name. Some polytopes are realized with floating point numbers and thus not exact; Vertex-facet-incidences are correct in all cases.

      Parameters
      Strings
      the name of the desired Archimedean solid
      Possible values:
      'truncated_tetrahedron'
      Truncated tetrahedron. Regular polytope with four triangular and four hexagonal facets.
      'cuboctahedron'
      Cuboctahedron. Regular polytope with eight triangular and six square facets.
      'truncated_cube'
      Truncated cube. Regular polytope with eight triangular and six octagonal facets.
      'truncated_octahedron'
      Truncated Octahedron. Regular polytope with six square and eight hexagonal facets.
      'rhombicuboctahedron'
      Rhombicuboctahedron. Regular polytope with eight triangular and 18 square facets.
      'truncated_cuboctahedron'
      Truncated Cuboctahedron. Regular polytope with 12 square, eight hexagonal and six octagonal facets.
      'snub_cube'
      Snub Cube. Regular polytope with 32 triangular and six square facets. The vertices are realized as floating point numbers. This is a chiral polytope.
      'icosidodecahedron'
      Icosidodecahedon. Regular polytope with 20 triangular and 12 pentagonal facets.
      'truncated_dodecahedron'
      Truncated Dodecahedron. Regular polytope with 20 triangular and 12 decagonal facets.
      'truncated_icosahedron'
      Truncated Icosahedron. Regular polytope with 12 pentagonal and 20 hexagonal facets.
      'rhombicosidodecahedron'
      Rhombicosidodecahedron. Regular polytope with 20 triangular, 30 square and 12 pentagonal facets.
      'truncated_icosidodecahedron'
      Truncated Icosidodecahedron. Regular polytope with 30 square, 20 hexagonal and 12 decagonal facets.
      'snub_dodecahedron'
      Snub Dodecahedron. Regular polytope with 80 triangular and 12 pentagonal facets. The vertices are realized as floating point numbers. This is a chiral polytope.
      Returns
      Polytope

      Example:
      • To show the mirror image of the snub cube use:> scale(archimedean_solid('snub_cube'),-1)->VISUAL;
    •  
      catalan_solid (s) → Polytope

      Create Catalan solid of the given name. Some polytopes are realized with floating point numbers and thus not exact; Vertex-facet-incidences are correct in all cases.

      Parameters
      Strings
      the name of the desired Catalan solid
      Possible values:
      'triakis_tetrahedron'
      Triakis Tetrahedron. Dual polytope to the Truncated Tetrahedron, made of 12 isosceles triangular facets.
      'triakis_octahedron'
      Triakis Octahedron. Dual polytope to the Truncated Cube, made of 24 isosceles triangular facets.
      'rhombic_dodecahedron'
      Rhombic dodecahedron. Dual polytope to the cuboctahedron, made of 12 rhombic facets.
      'tetrakis_hexahedron'
      Tetrakis hexahedron. Dual polytope to the truncated octahedron, made of 24 isosceles triangluar facets.
      'disdyakis_dodecahedron'
      Disdyakis dodecahedron. Dual polytope to the truncated cuboctahedron, made of 48 scalene triangular facets.
      'pentagonal_icositetrahedron'
      Pentagonal Icositetrahedron. Dual polytope to the snub cube, made of 24 irregular pentagonal facets. The vertices are realized as floating point numbers.
      'pentagonal_hexecontahedron'
      Pentagonal Hexecontahedron. Dual polytope to the snub dodecahedron, made of 60 irregular pentagonal facets. The vertices are realized as floating point numbers.
      'rhombic_triacontahedron'
      Rhombic triacontahedron. Dual polytope to the icosidodecahedron, made of 30 rhombic facets.
      'triakis_icosahedron'
      Triakis icosahedron. Dual polytope to the icosidodecahedron, made of 30 rhombic facets.
      'deltoidal_icositetrahedron'
      Deltoidal Icositetrahedron. Dual polytope to the rhombicubaoctahedron, made of 24 kite facets.
      'pentakis_dodecahedron'
      Pentakis dodecahedron. Dual polytope to the truncated icosahedron, made of 60 isosceles triangular facets.
      'deltoidal_hexecontahedron'
      Deltoidal hexecontahedron. Dual polytope to the rhombicosidodecahedron, made of 60 kite facets.
      'disdyakis_triacontahedron'
      Disdyakis triacontahedron. Dual polytope to the truncated icosidodecahedron, made of 120 scalene triangular facets.
      Returns
      Polytope
    •  
      cross <Scalar> (d, scale) → Polytope<Scalar>

      Produce a d-dimensional cross polytope. Regular polytope corresponding to the Coxeter group of type Bd-1 = Cd-1.

      All coordinates are +/- scale or 0.

      Type Parameters
      Scalar
      Coordinate type of the resulting polytope. Unless specified explicitly, deduced from the type of bound values, defaults to Rational.
      Parameters
      Intd
      the dimension
      Scalarscale
      the absolute value of each non-zero vertex coordinate. Needs to be positive. The default value is 1.
      Options
      Boolgroup
      add a symmetry group description to the resulting polytope
      Returns
      Polytope<Scalar>

      Example:
      • To create the 3-dimensional cross polytope, type> $p = cross(3); Check out it's vertices and volume:> print $p->VERTICES; 1 1 0 0 1 -1 0 0 1 0 1 0 1 0 -1 0 1 0 0 1 1 0 0 -1> print cross(3)->VOLUME; 4/3 If you rather had a bigger one, type> $p_scaled = cross(3,2);> print $p_scaled->VOLUME; 32/3 To also calculate the symmetry group, do this:> $p = cross(3,group=>1); You can then print the generators of this group like this:> print $p->GROUP->GENERATORS; 1 0 2 3 4 5 2 3 0 1 4 5 0 1 4 5 2 3
    •  
      cube <Scalar> (d, x_up, x_low) → Polytope<Scalar>

      Produce a d-dimensional cube. Regular polytope corresponding to the Coxeter group of type Bd-1 = Cd-1.

      The bounding hyperplanes are xi <= x_up and xi >= x_low.

      Type Parameters
      Scalar
      Coordinate type of the resulting polytope. Unless specified explicitly, deduced from the type of bound values, defaults to Rational.
      Parameters
      Intd
      the dimension
      Scalarx_up
      upper bound in each dimension
      Scalarx_low
      lower bound in each dimension
      Options
      Boolgroup
      add a symmetry group description to the resulting polytope
      Returns
      Polytope<Scalar>

      Examples:
      • This yields a +/-1 cube of dimension 3 and stores it in the variable $c.> $c = cube(3);
      • This stores a standard unit cube of dimension 3 in the variable $c.> $c = cube(3,0);
      • This prints the area of a square with side length 4 translated to have its vertex barycenter at [5,5]:> print cube(2,7,3)->VOLUME; 16
    •  
      cuboctahedron () → Polytope

      Create cuboctahedron. An Archimedean solid.

      Returns
      Polytope
    •  
      dodecahedron () → Polytope

      Create exact regular dodecahedron in Q(sqrt{5}). A Platonic solid.

      Returns
      Polytope
    •  
      icosahedron () → Polytope

      Create exact regular icosahedron in Q(sqrt{5}). A Platonic solid.

      Returns
      Polytope
    •  
      icosidodecahedron () → Polytope

      Create exact icosidodecahedron in Q(sqrt{5}). An Archimedean solid.

      Returns
      Polytope
    •  
      johnson_solid (n) → Polytope

      Create Johnson solid number n.

      Parameters
      Intn
      the index of the desired Johnson polytope
      Returns
      Polytope
    •  
      johnson_solid (s) → Polytope

      Create Johnson solid with the given name. Some polytopes are realized with floating point numbers and thus not exact; Vertex-facet-incidences are correct in all cases.

      Parameters
      Strings
      the name of the desired Johnson polytope
      Possible values:
      'square_pyramid'
      Square pyramid with regular facets. Johnson solid J1.
      'pentagonal_pyramid'
      Pentagonal pyramid with regular facets. Johnson solid J2.
      'triangular_cupola'
      Triangular cupola with regular facets. Johnson solid J3.
      'square_cupola'
      Square cupola with regular facets. Johnson solid J4.
      'pentagonal_cupola'
      Pentagonal cupola with regular facets. Johnson solid J5.
      'pentagonal_rotunda'
      Pentagonal rotunda with regular facets. Johnson solid J6.
      'elongated_triangular_pyramid'
      Elongated triangular pyramid with regular facets. Johnson solid J7.
      'elongated_square_pyramid'
      Elongated square pyramid with regular facets. Johnson solid J8.
      'elongated_pentagonal_pyramid'
      Elongated pentagonal pyramid with regular facets. Johnson solid J9. The vertices are realized as floating point numbers.
      'gyroelongated_square_pyramid'
      Gyroelongated square pyramid with regular facets. Johnson solid J10. The vertices are realized as floating point numbers.
      'gyroelongated_pentagonal_pyramid'
      Gyroelongated pentagonal pyramid with regular facets. Johnson solid J11.
      'triangular_bipyramid'
      Triangular bipyramid with regular facets. Johnson solid J12.
      'pentagonal_bipyramid'
      Pentagonal bipyramid with regular facets. Johnson solid J13. The vertices are realized as floating point numbers.
      'elongated_triangular_bipyramid'
      Elongated triangular bipyramid with regular facets. Johnson solid J14.
      'elongated_square_bipyramid'
      Elongated square bipyramid with regular facets. Johnson solid J15.
      'elongated_pentagonal_bipyramid'
      Elongated pentagonal bipyramid with regular facets. Johnson solid J16. The vertices are realized as floating point numbers.
      'gyroelongated_square_bipyramid'
      Gyroelongted square bipyramid with regular facets. Johnson solid J17. The vertices are realized as floating point numbers.
      'elongated_triangular_cupola'
      Elongted triangular cupola with regular facets. Johnson solid J18. The vertices are realized as floating point numbers.
      'elongated_square_cupola'
      Elongted square cupola with regular facets. Johnson solid J19.
      'elongated_pentagonal_cupola'
      Elongted pentagonal cupola with regular facets. Johnson solid J20 The vertices are realized as floating point numbers.
      'elongated_pentagonal_rotunda'
      Elongated pentagonal rotunda with regular facets. Johnson solid J21. The vertices are realized as floating point numbers.
      'gyroelongated_triangular_cupola'
      Gyroelongted triangular cupola with regular facets. Johnson solid J22. The vertices are realized as floating point numbers.
      'gyroelongated_square_cupola'
      Gyroelongted square cupola with regular facets. Johnson solid J23. The vertices are realized as floating point numbers.
      'gyroelongated_pentagonal_cupola'
      Gyroelongted pentagonal cupola with regular facets. Johnson solid J24. The vertices are realized as floating point numbers.
      'gyroelongated_pentagonal_rotunda'
      Gyroelongted pentagonal rotunda with regular facets. Johnson solid J25. The vertices are realized as floating point numbers.
      'gyrobifastigium'
      Gyrobifastigium with regular facets. Johnson solid J26.
      'triangular_orthobicupola'
      Triangular orthobicupola with regular facets. Johnson solid J27.
      'square_orthobicupola'
      Square orthobicupola with regular facets. Johnson solid J28.
      'square_gyrobicupola'
      Square gyrobicupola with regular facets. Johnson solid J29.
      'pentagonal_orthobicupola'
      Pentagonal orthobicupola with regular facets. Johnson solid J30. The vertices are realized as floating point numbers.
      'pentagonal_gyrobicupola'
      Pentagonal gyrobicupola with regular facets. Johnson solid J31. The vertices are realized as floating point numbers.
      'pentagonal_orthocupolarotunda'
      Pentagonal orthocupolarotunda with regular facets. Johnson solid J32. The vertices are realized as floating point numbers.
      'pentagonal_gyrocupolarotunda'
      Pentagonal gyrocupolarotunda with regular facets. Johnson solid J33. The vertices are realized as floating point numbers.
      'pentagonal_orthobirotunda'
      Pentagonal orthobirotunda with regular facets. Johnson solid J32. The vertices are realized as floating point numbers.
      'elongated_triangular_orthbicupola'
      Elongated triangular orthobicupola with regular facets. Johnson solid J35. The vertices are realized as floating point numbers.
      'elongated_triangular_gyrobicupola'
      Elongated triangular gyrobicupola with regular facets. Johnson solid J36. The vertices are realized as floating point numbers.
      'elongated_square_gyrobicupola'
      Elongated square gyrobicupola with regular facets. Johnson solid J37.
      'elongated_pentagonal_orthobicupola'
      Elongated pentagonal orthobicupola with regular facets. Johnson solid J38. The vertices are realized as floating point numbers.
      'elongated_pentagonal_gyrobicupola'
      Elongated pentagonal gyrobicupola with regular facets. Johnson solid J39. The vertices are realized as floating point numbers.
      'elongated_pentagonal_orthocupolarotunda'
      Elongated pentagonal orthocupolarotunda with regular facets. Johnson solid J40. The vertices are realized as floating point numbers.
      'elongated_pentagonal_gyrocupolarotunda'
      Elongated pentagonal gyrocupolarotunda with regular facets. Johnson solid J41. The vertices are realized as floating point numbers.
      'elongated_pentagonal_orthobirotunda'
      Elongated pentagonal orthobirotunda with regular facets. Johnson solid J42. The vertices are realized as floating point numbers.
      'elongated_pentagonal_gyrobirotunda'
      Elongated pentagonal gyrobirotunda with regular facets. Johnson solid J43. The vertices are realized as floating point numbers.
      'gyroelongated_triangular_bicupola'
      Gyroelongated triangular bicupola with regular facets. Johnson solid J44. The vertices are realized as floating point numbers.
      'elongated_square_bicupola'
      Elongated square bicupola with regular facets. Johnson solid J45. The vertices are realized as floating point numbers.
      'gyroelongated_pentagonal_bicupola'
      Gyroelongated pentagonal bicupola with regular facets. Johnson solid J46. The vertices are realized as floating point numbers.
      'gyroelongated_pentagonal_cupolarotunda'
      Gyroelongated pentagonal cupolarotunda with regular facets. Johnson solid J47. The vertices are realized as floating point numbers.
      'gyroelongated_pentagonal_birotunda'
      Gyroelongated pentagonal birotunda with regular facets. Johnson solid J48. The vertices are realized as floating point numbers.
      'augmented_triangular_prism'
      Augmented triangular prism with regular facets. Johnson solid J49. The vertices are realized as floating point numbers.
      'biaugmented_triangular_prism'
      Biaugmented triangular prism with regular facets. Johnson solid J50. The vertices are realized as floating point numbers.
      'triaugmented_triangular_prism'
      Triaugmented triangular prism with regular facets. Johnson solid J51. The vertices are realized as floating point numbers.
      'augmented_pentagonal_prism'
      Augmented prantagonal prism with regular facets. Johnson solid J52. The vertices are realized as floating point numbers.
      'biaugmented_pentagonal_prism'
      Augmented pentagonal prism with regular facets. Johnson solid J53. The vertices are realized as floating point numbers.
      'augmented_hexagonal_prism'
      Augmented hexagonal prism with regular facets. Johnson solid J54. The vertices are realized as floating point numbers.
      'parabiaugmented_hexagonal_prism'
      Parabiaugmented hexagonal prism with regular facets. Johnson solid J55. The vertices are realized as floating point numbers.
      'metabiaugmented_hexagonal_prism'
      Metabiaugmented hexagonal prism with regular facets. Johnson solid J56. The vertices are realized as floating point numbers.
      'triaugmented_hexagonal_prism'
      triaugmented hexagonal prism with regular facets. Johnson solid J57. The vertices are realized as floating point numbers.
      'augmented_dodecahedron'
      Augmented dodecahedron with regular facets. Johnson solid J58. The vertices are realized as floating point numbers.
      'parabiaugmented_dodecahedron'
      Parabiaugmented dodecahedron with regular facets. Johnson solid J59. The vertices are realized as floating point numbers.
      'metabiaugmented_dodecahedron'
      Metabiaugmented dodecahedron with regular facets. Johnson solid J60. The vertices are realized as floating point numbers.
      'triaugmented_dodecahedron'
      Triaugmented dodecahedron with regular facets. Johnson solid J61. The vertices are realized as floating point numbers.
      'metabidiminished_icosahedron'
      Metabidiminished icosahedron with regular facets. Johnson solid J62.
      'tridiminished_icosahedron'
      Tridiminished icosahedron with regular facets. Johnson solid J63.
      'augmented_tridiminished_icosahedron'
      Augmented tridiminished icosahedron with regular facets. Johnson solid J64. The vertices are realized as floating point numbers.
      'augmented_truncated_tetrahedron'
      Augmented truncated tetrahedron with regular facets. Johnson solid J65.
      'augmented_truncated_cube'
      Augmented truncated cube with regular facets. Johnson solid J66.
      'biaugmented_truncated_cube'
      Biaugmented truncated cube with regular facets. Johnson solid J67.
      'augmented_truncated_dodecahedron'
      Augmented truncated dodecahedron with regular facets. Johnson solid J68. The vertices are realized as floating point numbers.
      'parabiaugmented_truncated_dodecahedron'
      Parabiaugmented truncated dodecahedron with regular facets. Johnson solid J69. The vertices are realized as floating point numbers.
      'metabiaugmented_truncated_dodecahedron'
      Metabiaugmented truncated dodecahedron with regular facets. Johnson solid J70. The vertices are realized as floating point numbers.
      'triaugmented_truncated_dodecahedron'
      Triaugmented truncated dodecahedron with regular facets. Johnson solid J71. The vertices are realized as floating point numbers.
      'gyrate_rhombicosidodecahedron'
      Gyrate rhombicosidodecahedron with regular facets. Johnson solid J72. The vertices are realized as floating point numbers.
      'parabigyrate_rhombicosidodecahedron'
      Parabigyrate rhombicosidodecahedron with regular facets. Johnson solid J73. The vertices are realized as floating point numbers.
      'metabigyrate_rhombicosidodecahedron'
      Metabigyrate rhombicosidodecahedron with regular facets. Johnson solid J74. The vertices are realized as floating point numbers.
      'trigyrate_rhombicosidodecahedron'
      Trigyrate rhombicosidodecahedron with regular facets. Johnson solid J75. The vertices are realized as floating point numbers.
      'diminished_rhombicosidodecahedron'
      Diminished rhombicosidodecahedron with regular facets. Johnson solid J76.
      'paragyrate_diminished_rhombicosidodecahedron'
      Paragyrate diminished rhombicosidodecahedron with regular facets. Johnson solid J77. The vertices are realized as floating point numbers.
      'metagyrate_diminished_rhombicosidodecahedron'
      Metagyrate diminished rhombicosidodecahedron with regular facets. Johnson solid J78. The vertices are realized as floating point numbers.
      'bigyrate_diminished_rhombicosidodecahedron'
      Bigyrate diminished rhombicosidodecahedron with regular facets. Johnson solid J79. The vertices are realized as floating point numbers.
      'parabidiminished_rhombicosidodecahedron'
      Parabidiminished rhombicosidodecahedron with regular facets. Johnson solid J80.
      'metabidiminished_rhombicosidodecahedron'
      Metabidiminished rhombicosidodecahedron with regular facets. Johnson solid J81.
      'gyrate_bidiminished_rhombicosidodecahedron'
      Gyrate bidiminished rhombicosidodecahedron with regular facets. Johnson solid J82. The vertices are realized as floating point numbers.
      'triminished_rhombicosidodecahedron'
      Tridiminished rhombicosidodecahedron with regular facets. Johnson solid J83.
      'snub_disphenoid'
      Snub disphenoid with regular facets. Johnson solid J84. The vertices are realized as floating point numbers.
      'snub_square_antisprim'
      Snub square antiprism with regular facets. Johnson solid J85. The vertices are realized as floating point numbers.
      'sphenocorona'
      Sphenocorona with regular facets. Johnson solid J86. The vertices are realized as floating point numbers.
      'augmented_sphenocorona'
      Augmented sphenocorona with regular facets. Johnson solid J87. The vertices are realized as floating point numbers.
      'sphenomegacorona'
      Sphenomegacorona with regular facets. Johnson solid J88. The vertices are realized as floating point numbers.
      'hebesphenomegacorona'
      Hebesphenomegacorona with regular facets. Johnson solid J89. The vertices are realized as floating point numbers.
      'disphenocingulum'
      Disphenocingulum with regular facets. Johnson solid J90. The vertices are realized as floating point numbers.
      'bilunabirotunda'
      Bilunabirotunda with regular facets. Johnson solid J91.
      'triangular_hebesphenorotunda'
      Triangular hebesphenorotunda with regular facets. Johnson solid J92.
      Returns
      Polytope
    •  
      platonic_solid (s) → Polytope

      Create Platonic solid of the given name.

      Parameters
      Strings
      the name of the desired Platonic solid
      Possible values:
      'tetrahedron'
      Tetrahedron. Regular polytope with four triangular facets.
      'cube'
      Cube. Regular polytope with six square facets.
      'octahedron'
      Octahedron. Regular polytope with eight triangular facets.
      'dodecahedron'
      Dodecahedron. Regular polytope with 12 pentagonal facets.
      'icosahedron'
      Icosahedron. Regular polytope with 20 triangular facets.
      Returns
      Polytope
    •  
      regular_120_cell () → Polytope

      Create exact regular 120-cell in Q(sqrt{5}).

      Returns
      Polytope
    •  
      regular_24_cell () → Polytope

      Create regular 24-cell.

      Returns
      Polytope
    •  
      regular_600_cell () → Polytope

      Create exact regular 600-cell in Q(sqrt{5}).

      Returns
      Polytope
    •  
      regular_simplex (d) → Polytope

      Produce a regular d-simplex embedded in R^d with edge length sqrt(2).

      Parameters
      Intd
      the dimension
      Options
      Boolgroup
      Returns
      Polytope

      Examples:
      • To print the vertices (in homogeneous coordinates) of the regular 2-simplex, i.e. an equilateral triangle, type this:> print regular_simplex(2)->VERTICES; 1 1 0 1 0 1 1 1/2-1/2r3 1/2-1/2r3 The polytopes cordinate type is QuadraticExtension<Rational>, thus numbers that can be represented as a + b*sqrt(c) with Rational numbers a, b and c. The last row vectors entrys thus represent the number 1/2*(1-sqrt(3)).
      • To store a regular 3-simplex in the variable $s and also calculate its symmetry group, type this:> $s = regular_simplex(3,group=>1); You can then print the groups generators like so:> print $s->GROUP->GENERATORS; 1 0 2 2 0 1
    •  
      rhombicosidodecahedron () → Polytope

      Create exact rhombicosidodecahedron in Q(sqrt{5}). An Archimedean solid.

      Returns
      Polytope
    •  
      rhombicuboctahedron () → Polytope

      Create rhombicuboctahedron. An Archimedean solid.

      Returns
      Polytope
    •  
      simple_roots_type_A (index) → SparseMatrix

      Produce the simple roots of the Coxeter arrangement of type A Indices are taken w.r.t. the Dynkin diagram 0 ---- 1 ---- ... ---- n-1 Note that the roots lie at infinity to facilitate reflecting in them, and are normalized to length sqrt{2}.

      Parameters
      Intindex
      of the arrangement (3, 4, etc)
      Returns
      SparseMatrix
    •  
      simple_roots_type_B (index) → SparseMatrix

      Produce the simple roots of the Coxeter arrangement of type B Indices are taken w.r.t. the Dynkin diagram 0 ---- 1 ---- ... ---- n-2 --(4)--> n-1 Note that the roots lie at infinity to facilitate reflecting in them, and are normalized to length sqrt{2}.

      Parameters
      Intindex
      of the arrangement (3, 4, etc)
      Returns
      SparseMatrix
    •  
      simple_roots_type_C (index) → SparseMatrix

      Produce the simple roots of the Coxeter arrangement of type C Indices are taken w.r.t. the Dynkin diagram 0 ---- 1 ---- ... ---- n-2 <--(4)-- n-1 Note that the roots lie at infinity to facilitate reflecting in them, and are normalized to length sqrt{2}.

      Parameters
      Intindex
      of the arrangement (3, 4, etc)
      Returns
      SparseMatrix
    •  
      simple_roots_type_D (index) → SparseMatrix

      Produce the simple roots of the Coxeter arrangement of type D Indices are taken w.r.t. the Dynkin diagram n-2 / 0 - 1 - ... - n-3

      n-1 Note that the roots lie at infinity to facilitate reflecting in them, and are normalized to length sqrt{2}.

      Parameters
      Intindex
      of the arrangement (3, 4, etc)
      Returns
      SparseMatrix
    •  
      simple_roots_type_E6 () → SparseMatrix

      Produce the simple roots of the Coxeter arrangement of type E6 Indices are taken w.r.t. the Dynkin diagram 3 | | 0 ---- 1 ---- 2 ---- 4 ---- 5 Note that the roots lie at infinity to facilitate reflecting in them.

    •  
      simple_roots_type_E7 () → SparseMatrix

      Produce the simple roots of the Coxeter arrangement of type E7 Indices are taken w.r.t. the Dynkin diagram 4 | | 0 ---- 1 ---- 2 ---- 3 ---- 5 ---- 6 Note that the roots lie at infinity to facilitate reflecting in them.

    •  
      simple_roots_type_E8 () → SparseMatrix

      Produce the simple roots of the Coxeter arrangement of type E8 Indices are taken w.r.t. the Dynkin diagram 5 | | 0 ---- 1 ---- 2 ---- 3 ---- 4 ---- 6 ---- 7 Note that the roots lie at infinity to facilitate reflecting in them.

    •  
      simple_roots_type_F4 () → SparseMatrix

      Produce the simple roots of the Coxeter arrangement of type F4 Indices are taken w.r.t. the Dynkin diagram 0 ---- 1 --(4)--> 2 ---- 3

    •  
      simple_roots_type_G2 () → SparseMatrix

      Produce the simple roots of the Coxeter arrangement of type G2 Indices are taken w.r.t. the Dynkin diagram 0 <--(6)-- 1

    •  
      simple_roots_type_H3 () → SparseMatrix

      Produce the simple roots of the Coxeter arrangement of type H3 Indices are taken w.r.t. the Dynkin diagram 0 --(5)-- 1 ---- 2 Note that the roots lie at infinity to facilitate reflecting in them, and are normalized to length 2

    •  
      simple_roots_type_H4 () → SparseMatrix

      Produce the simple roots of the Coxeter arrangement of type H4 Indices are taken w.r.t. the Dynkin diagram 0 --(5)-- 1 ---- 2 ---- 3 Note that the roots lie at infinity to facilitate reflecting in them, and are normalized to length sqrt{2}

    •  
      tetrahedron () → Polytope

      Create regular tetrahedron. A Platonic solid.

      Returns
      Polytope
    •  
      truncated_cube () → Polytope

      Create truncated cube. An Archimedean solid.

      Returns
      Polytope
    •  
      truncated_cuboctahedron () → Polytope

      Create truncated cuboctahedron. An Archimedean solid. This is actually a misnomer. The actual truncation of a cuboctahedron is normally equivalent to this construction, but has two different edge lengths. This construction has regular 2-faces.

      Returns
      Polytope
    •  
      truncated_dodecahedron () → Polytope

      Create exact truncated dodecahedron in Q(sqrt{5}). An Archimedean solid.

      Returns
      Polytope
    •  
      truncated_icosahedron () → Polytope

      Create exact truncated icosahedron in Q(sqrt{5}). An Archimedean solid. Also known as the soccer ball.

      Returns
      Polytope
    •  
      truncated_icosidodecahedron () → Polytope

      Create exact truncated icosidodecahedron in Q(sqrt{5}). An Archimedean solid.

      Returns
      Polytope
    •  
      truncated_octahedron () → Polytope

      Create truncated octahedron. An Archimedean solid. Also known as the 3-permutahedron.

      Returns
      Polytope
    •  
      wythoff (type, rings) → Polytope

      Produce the orbit polytope of a point under a Coxeter arrangement with exact coordinates, possibly in a qudratic extension field of the rationals

      Parameters
      Stringtype
      single letter followed by rank representing the type of the arrangement
      Set<Int>rings
      indices of the hyperplanes corresponding to simple roots of the arrangement that the initial point should NOT lie on
      Returns
      Polytope
  •  

    Topologic cell complexes defined as quotients over polytopes modulo a discrete group.

    •  
      cs_quotient (P)

      For a centrally symmetric polytope, divide out the central symmetry, i.e, identify diametrically opposite faces.

      Contained in extension bundled:group.
      Parameters
      PolytopeP
      , centrally symmetric
    •  
      cylinder_2 () → Polytope

      Return a 2-dimensional cylinder obtained by identifying two opposite sides of a square.

      Contained in extension bundled:group.
      Returns
      Polytope
    •  
      quarter_turn_manifold () → Polytope

      Return the 3-dimensional Euclidean manifold obtained by identifying opposite faces of a 3-dimensional cube by a quarter turn. After identification, two classes of vertices remain.

      Contained in extension bundled:group.
      Returns
      Polytope
    •  
      write_quotient_space_simplexity_ilp ()

      outputs a linear program whose optimal value is a lower bound for the number of simplices necessary to triangulate the polytope in such a way that its symmetries respect the triangulation of the boundary.

      Contained in extension bundled:group.
  •  

    These functions capture information of the object that is concerned with the action of permutation groups.

    •  
      alternating_group (degree, domain) → group::GroupOfPolytope

      Constructs an alternating group of given degree. (See also group::alternating_group.)

      Contained in extension bundled:group.
      Parameters
      Intdegree
      Intdomain
      of the polytope's symmetry group
      Returns
      group::GroupOfPolytope
    •  
      combinatorial_symmetries (poly, on_vertices) → group::GroupOfPolytope

      Compute the combinatorial symmetries (i.e., automorphisms of the face lattice) of a given polytope poly. If on_vertices is set to 1, the function returns a GroupOfPolytope which acts on the vertices. If on_vertices is set to any other number, the function returns a GroupOfPolytope which acts on the facets of the polytope. If on_vertices is unspecified, both groups are returned.

      Parameters
      Polytopepoly
      Inton_vertices
      specifies whether the returned group should act on vertices (1) or on facets (2)
      Returns
      group::GroupOfPolytope
      the combinatorial symmetry group acting on the vertices or the facets or (group::GroupOfPolytope, group::GroupOfPolytope) = (group on vertices, group on facets) if on_vertices is undefined

      Example:
      • To get the vertex and facet symmetry groups of the square and print their generators, type the following:> ($gv,$gf) = combinatorial_symmetries(cube(2));> print $gv->GENERATORS; 2 3 0 1 1 0 2 3> print $gf->GENERATORS; 0 2 1 3 1 0 3 2
    •  
      convert_coord_action (group, mat, dom_out) → group::Group

      Converts the generators of a group acting on coordinates to generators of the corresponding group which acts on the rows of the given matrix mat. The parameter dom_out specifies whether mat describes vertices or facets.

      Contained in extension bundled:group.
      Parameters
      group::Groupgroup
      input group acting on coordinates
      Matrixmat
      vertices or facets of a polytope
      Intdom_out
      OnRays(1) or OnFacets(2)
      Options
      Stringname
      an optional name for the output group
      Returns
      group::Group
      a new group object with the generators induced on the new domain
    •  
      convert_group_domain (group, VIF) → group::Group

      Converts the generators of the input group from the domain onRays to generators on the domain onFacets, and vice versa.

      Contained in extension bundled:group.
      Parameters
      group::Groupgroup
      IncidenceMatrixVIF
      the vertex-facet incidence matrix of the cone or polytope
      Options
      Stringname
      an optional name for the output group
      Returns
      group::Group
      a new group object with the generators induced on the new domain
    •  
      cyclic_group (degree, domain) → group::GroupOfPolytope

      Constructs a cyclic group of given degree. (See also group::cyclic_group.)

      Contained in extension bundled:group.
      Parameters
      Intdegree
      Intdomain
      of the polytope's symmetry group
      Returns
      group::GroupOfPolytope
    •  
      group_from_cyclic_notation0 (group, domain) → group::GroupOfPolytope

      Constructs a group from a string with generators in cyclic notation. All numbers in the string are 0-based, meaning that 0 is the smallest number allowed.

      Contained in extension bundled:group.
      Parameters
      Stringgroup
      generators in cyclic notation
      Intdomain
      of the polytope symmetry group. 1 for action on vertex indices, 2 for action" on facet indices, 3 for action on coordinates
      Returns
      group::GroupOfPolytope

      Example:
      • > $g = group_from_cyclic_notation0("(0,2)(1,3)",0);> print $g->GENERATORS; 2 3 0 1
    •  
      group_from_cyclic_notation1 (group, domain) → group::GroupOfPolytope

      Constructs a group from a string with generators in cyclic notation. All numbers in the string are 1-based, meaning that 1 is the smallest number allowed. Example: "(1,3)(2,4)"

      Contained in extension bundled:group.
      Parameters
      Stringgroup
      generators in cyclic notation
      Intdomain
      of the polytope symmetry group. 1 for action on vertex indices, 2 for action" on facet indices, 3 for action on coordinates
      Returns
      group::GroupOfPolytope
      # @example > $g = group_from_cyclic_notation1("(1,3)(2,4)",0); > print $g->GENERATORS; | 2 3 0 1
    •  
      lattice_automorphisms_smooth_polytope (P) → Array<Array<Int>>

      Returns a generating set for the lattice automorphism group of a smooth polytope P by comparing lattice distances between vertices and facets.

      Parameters
      PolytopeP
      the given polytope
      Returns
      Array<Array<Int>>
      the generating set for the lattice automorphism group

      Example:
      • > print lattice_automorphisms_smooth_polytope(cube(2)); 2 3 0 1 1 0 3 2 0 2 1 3
    •  
      linear_symmetries (m) → group::Group

      Computes the linear symmetries of a matrix m whose rows describe a point configuration via 'sympol'.

      Contained in extension bundled:group.
      Parameters
      Matrixm
      holds the points as rows whose linear symmetry group is to be computed
      Returns
      group::Group
      the linear symmetry group of m

      Example:
      • > $ls = linear_symmetries(cube(2)->VERTICES);> print $ls->GENERATORS; 0 2 1 3 3 1 2 0 2 3 0 1
    •  
      linear_symmetries (c, dual) → group::GroupOfCone

      Computes the linear symmetries of a given polytope p via 'sympol'. If the input is a cone, it may compute only a subgroup of the linear symmetry group.

      Contained in extension bundled:group.
      Parameters
      Conec
      the cone (or polytope) whose linear symmetry group is to be computed
      Booldual
      true if group action on vertices, false if action on facets
      Returns
      group::GroupOfCone
      the linear symmetry group of p (or a subgroup if p is a cone)
    •  
      nestedOPGraph (gen_point, points, lattice_points, group, verbose) → ARRAY

      Constructs the NOP-graph of an orbit polytope. It is used by the rule for the NOP_GRAPH.

      Parameters
      Vectorgen_point
      the generating point
      Matrixpoints
      the vertices of the orbit polytope
      Matrixlattice_points
      the lattice points of the orbit polytope
      group::GroupOfPolytopegroup
      the generating group
      Boolverbose
      print out additional information
      Returns
      ARRAY
      ($Graph, $lp_reps, $minInStartOrbit, \@core_point_reps, $CPindices)
    •  
      orbit_polytope (gen_point, group) → OrbitPolytope

      Constructs the orbit polytope of a given point gen_point with respect to a given permutation group group.

      Parameters
      Vector<Rational>gen_point
      the basis point of the orbit polytope
      group::GroupOfPolytopegroup
      a group acting on coordinates
      Returns
      OrbitPolytope
      the orbit polytope of gen_point w.r.t. group
    •  
      ortho_project (p) → Polytope

      Projects a symmetric polytope in R4 cap H1,k to R3. (See also the polymake extension 'tropmat' by S. Horn.)

      Parameters
      Polytopep
      the symmetric polytope to be projected
      Returns
      Polytope
      the image of p in R3
    •  
      representation_conversion_up_to_symmetry (c, a, dual, rayCompMethod) → List

      Computes the dual description of a polytope up to its linear symmetry group.

      Contained in extension bundled:group.
      Parameters
      Conec
      the cone (or polytope) whose dual description is to be computed
      group::Groupa
      symmetry group of the cone c (group::GroupOfCone or group::GroupOfPolytope)
      Booldual
      true if V to H, false if H to V
      IntrayCompMethod
      specifies sympol's method of ray computation via lrs(0), cdd(1), beneath_and_beyond(2), ppl(3)
      Returns
      List
      (Bool success indicator, Matrix<Rational> vertices/inequalities, Matrix<Rational> lineality/equations)
    •  
      symmetric_group (degree, domain) → group::GroupOfPolytope

      Constructs a symmetric group of given degree. (See also group::symmetric_group.)

      Contained in extension bundled:group.
      Parameters
      Intdegree
      Intdomain
      of the polytope's symmetry group. 1 for action on vertex indices, 2 for action" on facet indices, 3 for action on coordinates
      Returns
      group::GroupOfPolytope

      Example:
      • > $g = symmetric_group(5,0);> print $g->GENERATORS; 1 0 2 3 4 0 2 1 3 4 0 1 3 2 4 0 1 2 4 3
    •  
      truncated_orbit_polytope (v, group, eps) → SymmetricPolytope

      Constructs an orbit polytope of a given point v with respect to a given group group, in which all vertices are cut off by hyperplanes in distance eps

      Contained in extension bundled:group.
      Parameters
      Vectorv
      point of which orbit polytope is to be constructed
      group::GroupOfPolytopegroup
      group for which orbit polytope is to be constructed
      Rationaleps
      scaled distance by which the vertices of the orbit polytope are to be cut off
      Returns
      SymmetricPolytope
      the truncated orbit polytope
    •  
      visualizeNOP (orb, colors_ref, trans_ref)

      Visualizes all (nested) orbit polytopes contained in orb in one picture.

      Parameters
      OrbitPolytopeorb
      the orbit polytope
      ARRAYcolors_ref
      the reference to an array of colors
      ARRAYtrans_ref
      the reference to an array of transparency values
    •  
      visualizeNOPGraph (orb, filename)

      Visualizes the NOP-graph of an orbit polytope. Requires 'graphviz' and a Postscript viewer. Produces a file which is to be processed with the program 'dot' from the graphviz package. If 'dot' is installed, the NOP-graph is visualized by the Postscript viewer.

      Parameters
      OrbitPolytopeorb
      the orbit polytope
      Stringfilename
      the filename for the 'dot' file
  •  

    These functions take a realized polytope and produce a new one by applying a suitable affine or projective transformation in order to obtain some special coordinate description but preserve the combinatorial type.

    For example, before you can polarize an arbitrary polyhedron, it must be transformed to a combinatorially equivalent bounded polytope with the origin as a relatively interior point. It is achieved with the sequence orthantify - bound - center - polarize.

    •  
      ambient_lattice_normalization (p) → Polytope

      Transform to a full-dimensional polytope while preserving the ambient lattice Z^n

      Parameters
      Polytopep
      the input polytope,
      Options
      Boolstore_transform
      store the reverse transformation as an attachement
      Returns
      Polytope
      - the transformed polytope defined by its vertices. Facets are only written if available in p.

      Examples:
      • Consider a line segment embedded in 2-space containing three lattice points:> $p = new Polytope(VERTICES=>[[1,0,0],[1,2,2]]);> print ambient_lattice_normalization($p)->VERTICES; 1 0 1 2 The ambient lattice of the projection equals the intersection of the affine hull of $p with Z^2.
      • Another line segment containing only two lattice points:> $p = new Polytope(VERTICES=>[[1,0,0],[1,1,2]]);> $P = ambient_lattice_normalization($p,store_transform=>1);> print $P->VERTICES; 1 0 1 1 To get the transformation, do the following:> print $M = $P->get_attachment(REVERSE_LATTICE_PROJECTION); 1 0 0 0 1 2> print $P->VERTICES * $M; 1 0 0 1 1 2
    •  
      bound (P) → Polytope

      Make a positive polyhedron bounded. Apply a projective linear transformation to a polyhedron mapping the far hyperplane to the hyperplane spanned by the unit vectors. The origin (1,0,...,0) is fixed.

      The input polyhedron should be POSITIVE; i.e. no negative coordinates.

      Parameters
      PolytopeP
      a positive polyhedron
      Returns
      Polytope

      Example:
      • Observe the transformation of a simple unbounded 2-polyhedron:> $P = new Polytope(VERTICES=>[[1,0,0],[0,1,1],[0,0,1]]);> print bound($P)->VERTICES; 1 0 0 1 1/2 1/2 1 0 1 As you can see, the far points are mapped to the hyperplane spanned by (1,1,0) and (1,0,1).
    •  
      center (P) → Polytope

      Make a polyhedron centered. Apply a linear transformation to a polyhedron P such that a relatively interior point (preferably the vertex barycenter) is moved to the origin (1,0,...,0).

      Parameters
      PolytopeP
      Returns
      Polytope

      Example:
      • Consider this triangle not containing the origin:> $P = new Polytope(VERTICES => [[1,1,1],[1,2,1],[1,1,2]]);> $origin = new Vector([1,0,0]);> print $PC->contains_in_interior($origin); To create a translate that contains the origin, do this:> $PC = center($P);> print $PC->contains_in_interior($origin); 1 This is what happened to the vertices:> print $PC->VERTICES; 1 -1/3 -1/3 1 2/3 -1/3 1 -1/3 2/3 There also exists a property to check whether a polytope is centered:> print $PC->CENTERED; 1
    •  
      orthantify (P, v) → Polytope

      Make a polyhedron POSITIVE. Apply an affine transformation to a polyhedron such that the vertex v is mapped to the origin (1,0,...,0) and as many facets through this vertex as possible are mapped to the bounding facets of the first orthant.

      Parameters
      PolytopeP
      Intv
      vertex to be moved to the origin. By default it is the first affine vertex of the polyhedron.
      Returns
      Polytope

      Example:
      • To orthantify the square, moving its first vertex to the origin, do this:> $p = orthantify(cube(2),1);> print $p->VERTICES; 1 2 0 1 0 0 1 2 2 1 0 2
    •  
      polarize (C) → Cone

      Given a bounded, centered, not necessarily full-dimensional polytope P, produce its polar with respect to the standard Euclidean scalar product. Note that the definition of the polar has changed after version 2.10: the polar is reflected in the origin to conform with cone polarization If P is not full-dimensional, the output will contain lineality orthogonal to the affine span of P. In particular, polarize() of a pointed polytope will always produce a full-dimensional polytope. If you want to compute the polar inside the affine hull you may use the pointed_part client afterwards.

      Parameters
      ConeC
      Options
      Boolno_coordinates
      only combinatorial information is handled
      Returns
      Cone

      Example:
      • To save the polar of the square in the variable $p and then print its vertices, do this:> $p = polarize(cube(2));> print $p->VERTICES; 1 1 0 1 -1 0 1 0 1 1 0 -1
    •  
      revert (P) → Polytope

      Apply a reverse transformation to a given polyhedron P. All transformation clients keep track of the polytope's history. They write or update the attachment REVERSE_TRANSFORMATION.

      Applying revert to the transformed polytope reconstructs the original polytope.

      Parameters
      PolytopeP
      a (transformed) polytope
      Returns
      Polytope
      the original polytope

      Example:
      • The following translates the square and then reverts the transformation:> $v = new Vector(1,2);> $p = translate(cube(2),$v);> print $p->VERTICES; 1 0 1 1 2 1 1 0 3 1 2 3> $q = revert($p);> print $q->VERTICES; 1 -1 -1 1 1 -1 1 -1 1 1 1 1
    •  
      scale (P, factor, store) → Polytope

      Scale a polyhedron P by a given scaling parameter factor.

      Parameters
      PolytopeP
      the polyhedron to be scaled
      Scalarfactor
      the scaling factor
      Boolstore
      stores the reverse transformation as an attachment (REVERSE_TRANSFORMATION); default value: 1.
      Returns
      Polytope

      Example:
      • To sacle the square by 23, do this:> $p = scale(cube(2),23);> print $p->VERTICES; 1 -23 -23 1 23 -23 1 -23 23 1 23 23 The transformation matrix is stored in an attachment:> print $p->get_attachment('REVERSE_TRANSFORMATION'); 1 0 0 0 1/23 0 0 0 1/23 To reverse the transformation, you can use the revert function.> $q = revert($p);> print $q->VERTICES; 1 -1 -1 1 1 -1 1 -1 1 1 1 1
    •  
      transform (P, trans, store) → Polytope

      Transform a polyhedron P according to the linear transformation trans.

      Parameters
      PolytopeP
      the polyhedron to be transformed
      Matrixtrans
      the transformation matrix
      Boolstore
      stores the reverse transformation as an attachment (REVERSE_TRANSFORMATION); default value: 1.
      Returns
      Polytope

      Example:
      • This translates the square by (23,23) and stores the transformation:> $M = new Matrix([1,23,23],[0,1,0],[0,0,1]);> $p = transform(cube(2),$M,1);> print $p->VERTICES; 1 22 22 1 24 22 1 22 24 1 24 24 To retrieve the attached transformation, use this:> print $p->get_attachment('REVERSE_TRANSFORMATION'); 1 -23 -23 0 1 0 0 0 1 Check out the revert function to learn how to undo the transformation. It might have been more comfortable to use the translate function to achieve the above result.
    •  
      translate (P, trans, store) → Polytope

      Translate a polyhedron P by a given translation vector trans.

      Parameters
      PolytopeP
      the polyhedron to be translated
      Vectortrans
      the translation vector
      Boolstore
      stores the reverse transformation as an attachment (REVERSE_TRANSFORMATION); default value: 1.
      Returns
      Polytope

      Example:
      • This translates the square by (23,23) and stores the transformation:> $t = new Vector(23,23);> $p = translate(cube(2),$t);> print $p->VERTICES; 1 22 22 1 24 22 1 22 24 1 24 24 To retrieve the attached transformation, use this:> print $p->get_attachment('REVERSE_TRANSFORMATION'); 1 -23 -23 0 1 0 0 0 1 Check out the revert function to learn how to undo the transformation.
    •  
      vertex_lattice_normalization (p) → Polytope

      Transform to a full-dimensional polytope while preserving the lattice spanned by vertices induced lattice of new vertices = Z^dim

      Parameters
      Polytopep
      the input polytope,
      Options
      Boolstore_transform
      store the reverse transformation as an attachement
      Returns
      Polytope
      - the transformed polytope defined by its vertices. Facets are only written if available in p.
  •  

    These functions collect information about triangulations and other subdivisions of the object and properties usually computed from such, as the volume.

    •  
      barycentric_subdivision (c) → topaz::SimplicialComplex

      Create a simplicial complex as a barycentric subdivision of a given cone or polytope. Each vertex in the new complex corresponds to a face in the old complex.

      Parameters
      Conec
      input cone or polytope
      Options
      Boolrelabel
      generate vertex labels from the faces of the original complex; default true
      Boolgeometric_realization
      create a topaz::GeometricSimplicialComplex; default is true
      Returns
      topaz::SimplicialComplex
    •  
      barycentric_subdivision (pc) → PointConfiguration

      Create a simplicial complex as the barycentric subdivision of a given point configuration. Each vertex in the new complex corresponds to a face in the old complex.

      Parameters
      PointConfigurationpc
      input point configuration
      Options
      Boolrelabel
      generate vertex labels from the faces of the original complex; default true
      Boolgeometric_realization
      read POINTS of the input complex, compute the coordinates of the new vertices and store them as POINTS of the produced complex; default false
      Returns
      PointConfiguration
    •  
      coherency_index (p1, p2, points, w1, w2)

      DOC_FIXME: Incomprehensible description! Computes the coherency index of w1 w.r.t. w2

      Contained in extension bundled:local.
      Parameters
      Polytopep1
      Polytopep2
      Matrixpoints
      Vectorw1
      Vectorw2
    •  
      coherency_index (points, w1, w2)

      DOC_FIXME: Incomprehensible description! Computes the coherency index of w1 w.r.t. w2

      Contained in extension bundled:local.
      Parameters
      Matrixpoints
      Vectorw1
      Vectorw2
    •  
      coherency_index (p1, p2)

      DOC_FIXME: Erroneous description! w1 is not a parameter here! Computes the coherency index of p1 w.r.t. p2

      Contained in extension bundled:local.
      Parameters
      Polytopep1
      Polytopep2
    •  
      common_refinement (points, sub1, sub2, dim) → IncidenceMatrix

      Computes the common refinement of two subdivisions of points. It is assumed that there exists a common refinement of the two subdivisions.

      Parameters
      Matrixpoints
      IncidenceMatrixsub1
      first subdivision
      IncidenceMatrixsub2
      second subdivision
      Intdim
      dimension of the point configuration
      Returns
      IncidenceMatrix
      the common refinement

      Example:
      • A simple 2-dimensional set of points:> $points = new Matrix<Rational>([[1,0,0],[1,1,0],[1,0,1],[1,1,1],[1,2,1]]); Two different subdivisions...> $sub1 = new IncidenceMatrix([[0,1,2],[1,2,3,4]]);> $sub2 = new IncidenceMatrix([[1,3,4],[0,1,2,3]]); ...and their common refinement:> print common_refinement($points,$sub1,$sub2,2); {0 1 2} {1 3 4} {1 2 3}
    •  
      common_refinement (p1, p2) → Polytope

      Computes the common refinement of two subdivisions of the same polytope p1, p2. It is assumed that there exists a common refinement of the two subdivisions. It is not checked if p1 and p2 are indeed the same!

      Parameters
      Polytopep1
      Polytopep2
      Returns
      Polytope
    •  
      delaunay_triangulation (V) → Array<Set<Int>>

      Compute the Delaunay triangulation of the given SITES of a VoronoiDiagram V. If the sites are not in general position, the non-triangular facets of the Delaunay subdivision are triangulated (by applying the beneath-beyond algorithm).


      Example:
      • > $VD = new VoronoiDiagram(SITES=>[[1,1,1],[1,0,1],[1,-1,1],[1,1,-1],[1,0,-1],[1,-1,-1]]);> $D = delaunay_triangulation($VD);> print $D; {1 2 4} {2 4 5} {0 1 3} {1 3 4}
    •  
      foldable_max_signature_ilp (d, points, volume, cocircuit_equations) → LinearProgram<Rational>

      Set up an ILP whose MAXIMAL_VALUE is the maximal signature of a foldable triangulation of a polytope, point configuration or quotient manifold

      Contained in extension bundled:group.
      Parameters
      Intd
      the dimension of the input polytope, point configuration or quotient manifold
      Matrixpoints
      the input points or vertices
      Rationalvolume
      the volume of the convex hull
      SparseMatrixcocircuit_equations
      the matrix of cocircuit equations
      Options
      Stringfilename
      a name for a file in .lp format to store the linear program
      Returns
      LinearProgram<Rational>
      an ILP that provides the result
    •  
      foldable_max_signature_upper_bound (d, points, volume, cocircuit_equations) → Integer

      Calculate the LP relaxation upper bound to the maximal signature of a foldable triangulation of polytope, point configuration or quotient manifold

      Contained in extension bundled:group.
      Parameters
      Intd
      the dimension of the input polytope, point configuration or quotient manifold
      Matrixpoints
      the input points or vertices
      Rationalvolume
      the volume of the convex hull
      SparseMatrixcocircuit_equations
      the matrix of cocircuit equations
      Returns
      Integer
      the optimal value of an LP that provides a bound
    •  
      interior_and_boundary_ridges (P) → Pair<Array<Set>,Array<Set>>

      Find the (d-1)-dimensional simplices in the interior and in the boundary of a d-dimensional polytope or cone

      Contained in extension bundled:group.
      Parameters
      PolytopeP
      the input polytope or cone
      Returns
      Pair<Array<Set>,Array<Set>>

      Example:
      • > print interior_and_boundary_ridges(cube(2)); <{0 3} {1 2} > <{0 1} {0 2} {1 3} {2 3} >
    •  
      is_regular (points, subdiv) → Pair<Bool,Vector>

      For a given subdivision subdiv of points tests if the subdivision is regular and if yes computes a weight vector inducing this subdivsion. The output is a pair of Bool and the weight vector. Options can be used to ensure properties of the resulting vector. The default is having 0 on all vertices of the first face of subdiv.

      Parameters
      Matrixpoints
      in homogeneous coordinates
      Array<Set<Int> >subdiv
      Options
      Matrix<Scalar>equations
      system of linear equation the cone is cut with.
      Set<Int>lift_to_zero
      gives only lifting functions lifting the designated vertices to 0
      Intlift_face_to_zero
      gives only lifting functions lifting all vertices of the designated face to 0
      Returns
      Pair<Bool,Vector>

      Example:
      • A regular subdivision of the square, with the first cell lifted to zero:> $points = cube(2)->VERTICES;> print is_regular($points,[[0,1,3],[1,2,3]],lift_to_zero=>[0,1,3]); 1 <0 0 1 0>
    •  
      is_subdivision (points, faces)

      Checks whether faces forms a valid subdivision of points, where points is a set of points, and faces is a collection of subsets of (indices of) points. If the set of interior points of points is known, this set can be passed by assigning it to the option interior_points. If points are in convex position (i.e., if they are vertices of a polytope), the option interior_points should be set to [ ] (the empty set).

      Parameters
      Matrixpoints
      Array<Set<Int>>faces
      Options
      Set<Int>interior_points

      Example:
      • Two potential subdivisions of the square without innter points:> $points = cube(2)->VERTICES;> print is_subdivision($points,[[0,1,3],[1,2,3]],interior_points=>[ ]); 1> print is_subdivision($points,[[0,1,2],[1,2]],interior_points=>[ ]);
    •  
      iterated_barycentric_subdivision (c, n) → topaz::SimplicialComplex

      Create a simplicial complex as an iterated barycentric subdivision of a given cone or polytope.

      Parameters
      Conec
      input cone or polytope
      Intn
      how many times to subdivide
      Options
      Boolrelabel
      write labels of new points; default is false
      Boolgeometric_realization
      create a topaz::GeometricSimplicialComplex; default is false
      Returns
      topaz::SimplicialComplex
    •  
      max_interior_simplices (P) → Array<Set>

      Find the maximal interior simplices of a polytope P. Symmetries of P are NOT taken into account.

      Contained in extension bundled:group.
      Parameters
      PolytopeP
      the input polytope
      Returns
      Array<Set>

      Example:
      • > print max_interior_simplices(cube(2)); {0 1 2} {0 1 3} {0 2 3} {1 2 3}
    •  
      max_interior_simplices (P)

      find the maximal interior simplices of a point configuration that DO NOT contain any point in their closure, except for the vertices. Symmetries of the configuration are NOT taken into account.

      Contained in extension bundled:group.
      Parameters
      PointConfigurationP
      the input point configuration
    •  
      metric2hyp_triang (FMS) → Polytope

      Given a generic finite metric space FMS, construct the associated (i.e. dual) triangulation of the hypersimplex.

      Parameters
      TightSpanFMS
      Returns
      Polytope
    •  
      metric2splits (D) → Array<Pair<Set>>

      Computes all non-trivial splits of a metric space D (encoded as a symmetric distance matrix).

      Parameters
      MatrixD
      Returns
      Array<Pair<Set>>
      each split is encoded as a pair of two sets.
    •  
      mixed_volume (P1, P2, Pn) → Scalar

      Produces the mixed volume of polytopes P1,P2,...,Pn.

      Parameters
      Polytope<Scalar>P1
      first polytope
      Polytope<Scalar>P2
      second polytope
      Polytope<Scalar>Pn
      last polytope
      Returns
      Scalar
      mixed volume

      Example:
      • > print mixed_volume(cube(2),simplex(2)); 4
    •  
      n_triangulations (M, optimization) → Integer

      Calculates the number of triangulations of the input points given as rows of a matrix. This can be space intensive.

      Parameters
      MatrixM
      points in the projective plane
      Booloptimization
      defaults to 1, where 1 includes optimization and 0 excludes it
      Returns
      Integer
      number of triangulations

      Example:
      • To print the number of possible triangulations of a square, do this:> print n_triangulations(cube(2)->VERTICES); 2
    •  
      placing_triangulation (Points) → Array<Set<Int>>

      Compute the placing triangulation of the given point set using the beneath-beyond algorithm.

      Parameters
      MatrixPoints
      the given point set
      Options
      Boolnon_redundant
      whether it's already known that Points are non-redundant
      Array<Int>permutation
      placing order of Points, must be a valid permutation of (0..Points.rows()-1)
      Returns
      Array<Set<Int>>

      Example:
      • To compute the placing triangulation of the square (of whose vertices we know that they're non-redundant), do this:> $t = placing_triangulation(cube(2)->VERTICES,non_redundant=>1);> print $t; {0 1 2} {1 2 3}
    •  
      points2metric (points) → Matrix

      Define a metric by restricting the Euclidean distance function to a given set of points. Due to floating point computations (sqrt is used) the metric defined may not be exact. If the option max or l1 is set to true the max-norm or l1-norm is used instead (with exact computation).

      Parameters
      Matrixpoints
      Options
      Boolmax
      triggers the usage of the max-norm (exact computation)
      Booll1
      triggers the usage of the l1-norm (exact computation)
      Returns
      Matrix

      Example:
      • > print points2metric(cube(2),max=>1); 0 2 2 2 2 0 2 2 2 2 0 2 2 2 2 0
    •  
      poly2metric (P) → Matrix

      Define a metric by restricting the Euclidean distance function to the vertex set of a given polytope P. Due to floating point computations (sqrt is used) the metric defined may not be exact. If the option max or l1 is set to true the max-norm or l1-norm is used instead (with exact computation).

      Parameters
      PolytopeP
      Options
      Boolmax
      triggers the usage of the max-norm (exact computation)
      Returns
      Matrix

      Example:
      • > print points2metric(cube(2)->VERTICES,max=>1); 0 2 2 2 2 0 2 2 2 2 0 2 2 2 2 0
    •  
      quotient_space_simplexity_ilp (d, V, volume, cocircuit_equations) → LinearProgram

      Set up an LP whose MINIMAL_VALUE is a lower bound for the minimal number of simplices needed to triangulate a polytope, point configuration or quotient manifold

      Contained in extension bundled:group.
      Parameters
      Intd
      the dimension of the input polytope, point configuration or quotient manifold
      MatrixV
      the input points or vertices
      Scalarvolume
      the volume of the convex hull
      SparseMatrixcocircuit_equations
      the matrix of cocircuit equations
      Options
      Stringfilename
      a name for a file in .lp format to store the linear program
      Returns
      LinearProgram
      an LP that provides a lower bound
    •  
      quotient_space_simplexity_lower_bound (d, V, volume, cocircuit_equations) → Integer

      Calculate a lower bound for the minimal number of simplices needed to triangulate a polytope, point configuration or quotient manifold

      Contained in extension bundled:group.
      Parameters
      Intd
      the dimension of the input polytope, point configuration or quotient manifold
      MatrixV
      the input points or vertices
      Scalarvolume
      the volume of the convex hull
      SparseMatrixcocircuit_equations
      the matrix of cocircuit equations
      Returns
      Integer
      the optimal value of an LP that provides a lower bound
    •  
      regularity_lp (points, subdiv) → Polytope<Scalar>

      For a given subdivision subdiv of points determines a LinearProgram to decide whether the subdivision is regular. The output a Polytope with an attached LP. Options can be used to ensure properties of the resulting LP. The default is having 0 on all vertices of the first face of subdiv.

      Parameters
      Matrixpoints
      in homogeneous coordinates
      Array<Set<Int> >subdiv
      Options
      Matrix<Scalar>equations
      system of linear equation the cone is cut with.
      Set<Int>lift_to_zero
      gives only lifting functions lifting the designated vertices to 0
      Intlift_face_to_zero
      gives only lifting functions lifting all vertices of the designated face to 0
      Scalarepsilon
      minimum distance from all inequalities
      Returns
      Polytope<Scalar>
    •  
      regular_subdivision (points, weights) → Array<Set<Int>>

      Compute a regular subdivision of the polytope obtained by lifting points to weights and taking the lower complex of the resulting polytope. If the weight is generic the output is a triangulation.

      Parameters
      Matrixpoints
      Vectorweights
      Returns
      Array<Set<Int>>

      Example:
      • The following generates a regular subdivision of the square.> $w = new Vector(2,23,2,2);> $r = regular_subdivision(cube(2)->VERTICES,$w);> print $r; {0 1 3} {0 2 3}
    •  
      secondary_cone (points, subdiv) → Cone

      For a given subdivision subdiv of points tests computes the corresponding secondary cone. If the subdivision is not regular, the cone will be the secondary cone of the finest regular coarsening of subdiv. (See option test_regularity) Options can be used to make the Cone POINTED.

      Parameters
      Matrixpoints
      in homogeneous coordinates
      Array<Set<Int> >subdiv
      Options
      Matrix<Scalar>equations
      system of linear equation the cone is cut with.
      Set<Int>lift_to_zero
      gives only lifting functions lifting the designated vertices to 0
      Intlift_face_to_zero
      gives only lifting functions lifting all vertices of the designated face to 0
      Booltest_regularity
      throws an exception if the subdivision is not regular
      Returns
      Cone
    •  
      simplexity_ilp (d, points, the, volume, cocircuit_equations) → LinearProgram

      Set up an ILP whose MINIMAL_VALUE is the minimal number of simplices needed to triangulate a polytope, point configuration or quotient manifold

      Contained in extension bundled:group.
      Parameters
      Intd
      the dimension of the input polytope, point configuration or quotient manifold
      Matrixpoints
      the input points or vertices
      Array<Set>the
      representatives of maximal interior simplices
      Scalarvolume
      the volume of the convex hull
      SparseMatrixcocircuit_equations
      the matrix of cocircuit equations
      Options
      Stringfilename
      a name for a file in .lp format to store the linear program
      Returns
      LinearProgram
      an LP that provides a lower bound
    •  
      simplexity_ilp_with_angles (d, points, the, volume, cocircuit_equations) → LinearProgram

      Set up an ILP whose MINIMAL_VALUE is the minimal number of simplices needed to triangulate a polytope, point configuration or quotient manifold

      Contained in extension bundled:group.
      Parameters
      Intd
      the dimension of the input polytope, point configuration or quotient manifold
      Matrixpoints
      the input points or vertices
      Array<Set>the
      (representative) maximal interior simplices
      Scalarvolume
      the volume of the convex hull
      SparseMatrixcocircuit_equations
      the matrix of cocircuit equations
      Options
      Stringfilename
      a name for a file in .lp format to store the linear program
      Returns
      LinearProgram
      an LP that provides a lower bound
    •  
      simplexity_lower_bound (d, points, volume, cocircuit_equations) → Integer

      Calculate the LP relaxation lower bound for the minimal number of simplices needed to triangulate a polytope, point configuration or quotient manifold

      Contained in extension bundled:group.
      Parameters
      Intd
      the dimension of the input polytope, point configuration or quotient manifold
      Matrixpoints
      the input points or vertices
      Scalarvolume
      the volume of the convex hull
      SparseMatrixcocircuit_equations
      the matrix of cocircuit equations
      Returns
      Integer
      the optimal value of an LP that provides a lower bound
    •  
      splits (V, G, F, dimension) → Matrix

      Computes the SPLITS of a polytope. The splits are normalized by dividing by the first non-zero entry. If the polytope is not fulldimensional the first entries are set to zero unless coords are specified.

      Parameters
      MatrixV
      vertices of the polytope
      GraphG
      graph of the polytope
      MatrixF
      facets of the polytope
      Intdimension
      of the polytope
      Options
      Set<Int>coords
      entries that should be set to zero
      Returns
      Matrix
    •  
      splits_in_subdivision (vertices, subdivision, splits) → Set<Int>

      Tests which of the splits of a polyhedron are coarsenings of the given subdivision.

      Parameters
      Matrixvertices
      the vertices of the polyhedron
      Array<Set<Int>>subdivision
      a subdivision of the polyhedron
      Matrixsplits
      the splits of the polyhedron
      Returns
      Set<Int>
    •  
      split_compatibility_graph (splits, P) → Graph

      DOC_FIXME: Incomprehensible description! Computes the compatibility graph among the splits of a polytope P.

      Parameters
      Matrixsplits
      the splits given by split equations
      PolytopeP
      the input polytope
      Returns
      Graph
    •  
      split_polyhedron (P) → Polytope

      Computes the split polyhedron of a full-dimensional polyhdron P.

      Parameters
      PolytopeP
      Returns
      Polytope
    •  
      staircase_weight (k, l) → Vector<Rational>

      Gives a weight vector for the staircase triangulation of the product of a k-1- and an l-1-dimensional simplex.

      Parameters
      Intk
      the number of vertices of the first simplex
      Intl
      the number of vertices of the second simplex
      Returns
      Vector<Rational>

      Example:
      • The following creates the staircase triangulation of the product of the 2- and the 1-simplex.> $w = staircase_weight(3,2);> $p = product(simplex(2),simplex(1));> $p->POLYTOPAL_SUBDIVISION(WEIGHTS=>$w);> print $p->POLYTOPAL_SUBDIVISION->MAXIMAL_CELLS; {0 2 4 5} {0 1 3 5} {0 2 3 5}
    •  
      stellar_subdivision (pc, faces) → PointConfiguration

      Computes the complex obtained by stellar subdivision of all faces of the TRIANGULATION of the PointConfiguration.

      Parameters
      PointConfigurationpc
      input point configuration
      Array<Set<Int>>faces
      list of faces to subdivide
      Options
      Boolno_labels
      : do not write any labels
      Returns
      PointConfiguration
    •  
      symmetrized_foldable_max_signature_ilp (d, points, volume, generators, symmetrized_foldable_cocircuit_equations) → LinearProgram<Rational>

      Set up an ILP whose MAXIMAL_VALUE is the maximal signature of a foldable triangulation of a polytope, point configuration or quotient manifold

      Contained in extension bundled:group.
      Parameters
      Intd
      the dimension of the input polytope, point configuration or quotient manifold
      Matrixpoints
      the input points or vertices
      Rationalvolume
      the volume of the convex hull
      Array<Array<Int>>generators
      the generators of the symmetry group
      SparseMatrixsymmetrized_foldable_cocircuit_equations
      the matrix of symmetrized cocircuit equations
      Options
      Stringfilename
      a name for a file in .lp format to store the linear program
      Returns
      LinearProgram<Rational>
      an ILP that provides the result
    •  
      symmetrized_foldable_max_signature_upper_bound (d, points, volume, cocircuit_equations) → Integer

      Calculate the LP relaxation upper bound to the maximal signature of a foldable triangulation of polytope, point configuration or quotient manifold

      Contained in extension bundled:group.
      Parameters
      Intd
      the dimension of the input polytope, point configuration or quotient manifold
      Matrixpoints
      the input points or vertices
      Rationalvolume
      the volume of the convex hull
      SparseMatrixcocircuit_equations
      the matrix of cocircuit equations
      Returns
      Integer
      the optimal value of an LP that provides a bound
    •  
      universal_polytope (P) → Polytope

      Calculate the universal polytope of a polytope

      Contained in extension bundled:group.
      Parameters
      PolytopeP
      the input polytope
      Returns
      Polytope
    •  
      universal_polytope (P, reps, cocircuit_equations) → Polytope

      Calculate the universal polytope of a polytope, point configuration or quotient manifold

      Contained in extension bundled:group.
      Parameters
      PolytopeP
      the input polytope
      Array<Set>reps
      the representatives of maximal interior simplices
      SparseMatrixcocircuit_equations
      the matrix of cocircuit equations
      Returns
      Polytope
    •  
      universal_polytope (PC) → Polytope

      Calculate the universal polytope of a point configuration

      Contained in extension bundled:group.
      Parameters
      PointConfiguration<Scalar>PC
      the point configuration
      Returns
      Polytope
  •  

    These functions are for visualization.

    •  
      bounding_box (V, surplus_k, voronoi) → Matrix

      Introduce artificial boundary facets (which are always vertical, i.e., the last coordinate is zero) to allow for bounded images of unbounded polyhedra (e.g. Voronoi polyhedra). If the voronoi flag is set, the last direction is left unbounded.

      Parameters
      MatrixV
      vertices that should be in the box
      Scalarsurplus_k
      size of the bounding box relative to the box spanned by V
      Boolvoronoi
      useful for visualizations of Voronoi diagrams that do not have enough vertices default value is 0.
      Returns
      Matrix
    •  
      vlabels (vertices, wo_zero) → ARRAY

      Creates vertex labels for visualization from the vertices of the polytope. The parameter wo_zero decides whether the entry at position 0 (homogenizing coordinate) is omitted (1) or included (0) in the label string."

      Parameters
      Matrixvertices
      the vertices of the polytope
      Boolwo_zero
      includes (0) or omits (1) the entry at position 0
      Returns
      ARRAY
      a reference to an array of vertex label strings

      Example:
      • This prints the vertex labels for the square with the origin as its center and side length 2, where we omit the leading 1:> $l = vlabels(cube(2)->VERTICES,1);> print join(', ', @{$v}); (-1,-1), (1,-1), (-1,1), (1,1)

Common Option Lists