Skip to content

Support interface coercion polymake(X) for Polyhedron #22658

@mkoeppe

Description

@mkoeppe

Following up on the Polymake pexpect interface (#22452), we make it easy to make a polymake object corresponding to a given Polyhedron.

We use the standard interface coercion protocol by defining SageObject._polymake_ and a default method SageObject._polymake_init_, which is overridden for Polyhedron_base and for several rings.

Basic example (see Polyhedron_base._polymake_init_ for more):

            sage: P = polytopes.cube()
            sage: PP = polymake(P)         # optional - polymake
            sage: PP.N_VERTICES            # optional - polymake
            8

Example of an algebraic polyhedron:

            sage: P = polytopes.dodecahedron(); P
            A 3-dimensional polyhedron in (Number Field in sqrt5 with defining polynomial x^2 - 5)^3 defined as the convex hull of 20 vertices
            sage: print("There may be a recompilation warning"); PP = polymake(P); PP
            There may be a recompilation warning...
            Polytope<QuadraticExtension<Rational>>[...]
            sage: sorted(PP.VERTICES[:])[0]
            1 1-1r5 4-2r5 0

The branch is on top of #22452; and it also contains a quick fix for the polymake interface regarding the way that files are used to send long commands.

Depends on #22452

CC: @simon-king-jena @jplab @videlec @tscrim @yuan-zhou @dimpase

Component: geometry

Keywords: days84

Author: Matthias Koeppe, Simon King

Branch/Commit: d7d4234

Reviewer: Jean-Philippe Labbé, Travis Scrimshaw

Issue created by migration from https://trac.sagemath.org/ticket/22658

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions