Skip to content

Improve obtaining combinatorial polyhedron #29841

@kliem

Description

@kliem

This ticket improves obtaining the CombinatorialPolyhedron from an incidence matrix.

Along the way we also improve the method CombinatorialPolyhedron.incidence_matrix that reobtains the incidence matrix.

Note that #29837 greatly speeds up obtainment of incidence matrices in Polyhedron_base.

Without this ticket:

sage: P = polytopes.permutahedron(7)
sage: _ = P.incidence_matrix()
sage: %time C = CombinatorialPolyhedron(P)
CPU times: user 821 ms, sys: 19.4 ms, total: 840 ms
Wall time: 842 ms
sage: C.incidence_matrix.clear_cache()
sage: %time _ = C.incidence_matrix()
CPU times: user 24.8 ms, sys: 22 µs, total: 24.8 ms
Wall time: 24.6 ms

sage: P = polytopes.associahedron(['A', 9])
sage: _ = P.incidence_matrix()
sage: %time C = CombinatorialPolyhedron(P)
CPU times: user 1.08 s, sys: 36.1 ms, total: 1.11 s
Wall time: 1.11 s
sage: C.incidence_matrix.clear_cache()
sage: %time _ = C.incidence_matrix()
CPU times: user 94.2 ms, sys: 0 ns, total: 94.2 ms
Wall time: 93.8 ms

With this ticket:

sage: P = polytopes.permutahedron(7)
sage: _ = P.incidence_matrix()
sage: %time C = CombinatorialPolyhedron(P)
CPU times: user 77.6 ms, sys: 12 ms, total: 89.6 ms
Wall time: 88 ms
sage: C.incidence_matrix.clear_cache()
sage: %time _ = C.incidence_matrix()
CPU times: user 17 ms, sys: 14 µs, total: 17 ms
Wall time: 16.7 ms

sage: P = polytopes.associahedron(['A', 9])
sage: _ = P.incidence_matrix()
sage: %time C = CombinatorialPolyhedron(P)
CPU times: user 110 ms, sys: 0 ns, total: 110 ms
Wall time: 109 ms
sage: C.incidence_matrix.clear_cache()
sage: %time _ = C.incidence_matrix()
CPU times: user 65.3 ms, sys: 18 µs, total: 65.3 ms
Wall time: 64.3 ms

Depends on #29837

CC: @jplab @LaisRast

Component: geometry

Keywords: combinatorial polyhedron

Author: Jonathan Kliem

Branch/Commit: 2db3a70

Reviewer: Travis Scrimshaw

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions