Skip to content

Improve Polyhedron.is_simple() #27533

@kliem

Description

@kliem

The method Polyhedron.is_simple is pretty slow for large polytopes at the moment. There is no need for that, as the information can be directly retrieved from the Vrepresentation.

Current timings:

sage: P = polytopes.hypercube(6)
sage: %time P.is_simple()
CPU times: user 360 ms, sys: 8 ms, total: 368 ms
Wall time: 364 ms
True
sage: P = polytopes.hypercube(7)
sage: %time P.is_simple()
CPU times: user 1.78 s, sys: 48 ms, total: 1.83 s
Wall time: 1.74 s
True
sage: P = polytopes.cross_polytope(7)
sage: %time P.is_simple()
CPU times: user 996 ms, sys: 0 ns, total: 996 ms
Wall time: 992 ms
False

Timings with this ticket:

sage: P = polytopes.hypercube(6)
sage: %time P.is_simple()
CPU times: user 4 ms, sys: 4 ms, total: 8 ms
Wall time: 3.53 ms
True
sage: P = polytopes.hypercube(7)
sage: %time P.is_simple()
CPU times: user 4 ms, sys: 4 ms, total: 8 ms
Wall time: 5.39 ms
True
sage: P = polytopes.cross_polytope(7)
sage: %time P.is_simple()
CPU times: user 8 ms, sys: 0 ns, total: 8 ms
Wall time: 5.63 ms
False
sage: P = polytopes.permutahedron(4)
sage: %time P.is_simple()
CPU times: user 0 ns, sys: 0 ns, total: 0 ns
Wall time: 1.03 ms
True

Component: geometry

Author: Jonathan Kliem

Branch/Commit: cd714a1

Reviewer: Laith Rastanawi

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions