-
-
Notifications
You must be signed in to change notification settings - Fork 654
Closed
Milestone
Description
Currently, the hypercube is set up with the vertices. This is slow, as the vertices grow exponentially with dimension:
sage: %time _ = polytopes.hypercube(8)
CPU times: user 58.6 ms, sys: 0 ns, total: 58.6 ms
Wall time: 58.2 ms
sage: %time _ = polytopes.hypercube(14)
CPU times: user 2.74 s, sys: 19.1 ms, total: 2.76 s
Wall time: 2.76 s
With #28880 at hand, we can set up the hypercube with both Vrep and Hrep. If the backend supports it (as in backend='field'
), then the double description does not need to be computed. If the backend does not support it (as in backend='ppl'
), then the hypercube is set up from the inequalities, which is much faster:
sage: %time _ = polytopes.hypercube(8) # uses ppl
CPU times: user 47.8 ms, sys: 3.19 ms, total: 51 ms
Wall time: 50 ms
sage: %time _ = polytopes.hypercube(14) # uses ppl
CPU times: user 421 ms, sys: 4.7 ms, total: 426 ms
Wall time: 425 ms
sage: %time _ = polytopes.hypercube(14, backend='field') # uses both descriptions
CPU times: user 168 ms, sys: 124 µs, total: 169 ms
Wall time: 168 ms
Component: geometry
Keywords: hypercube, polyhedron, double description
Author: Jonathan Kliem
Branch/Commit: 91ae9ba
Reviewer: Jean-Philippe Labbé, Sébastien Labbé
Issue created by migration from https://trac.sagemath.org/ticket/29198