-
-
Notifications
You must be signed in to change notification settings - Fork 655
Closed
Milestone
Description
We set up translation of polyhedra with both Vrepresentation and Hrepresentation, if the backend supports it.
This might be faster, when the Hrepresentation is shorter (previously translation was computed from Vrepresentation). Also this is much faster, when the backend supports precomputed data (currently field
).
Before this ticket:
sage: P = polytopes.hypercube(14, 'zero_one')
sage: %time Q = P - P.center()
CPU times: user 3.42 s, sys: 2 µs, total: 3.42 s
Wall time: 3.42 s
sage: P = polytopes.hypercube(8, 'zero_one', backend='field')
sage: %time Q = P - P.center()
CPU times: user 13.8 s, sys: 8 µs, total: 13.8 s
Wall time: 13.8 s
sage: P = polytopes.cross_polytope(12)
sage: %timeit Q = P - P.vertices()[0].vector()
10 loops, best of 5: 149 ms per loop
sage: P = polytopes.cross_polytope(6, backend='field')
sage: %time Q = P - P.vertices()[0].vector()
CPU times: user 744 ms, sys: 4 µs, total: 744 ms
Wall time: 744 ms
With this ticket:
# Hrep is shorter.
sage: P = polytopes.hypercube(14)
sage: %time Q = P - P.center()
CPU times: user 1.01 s, sys: 16 ms, total: 1.02 s
Wall time: 1.02 s
# Completely precomputed.
sage: P = polytopes.hypercube(8, 'zero_one', backend='field')
sage: %time Q = P - P.center()
CPU times: user 16.9 ms, sys: 0 ns, total: 16.9 ms
Wall time: 16.8 ms
# A bit slower (precomputed data is discarded).
sage: P = polytopes.cross_polytope(12)
sage: %timeit Q = P - P.vertices()[0].vector()
10 loops, best of 5: 172 ms per loop
# Completely precomputed.
sage: P = polytopes.cross_polytope(6, backend='field')
sage: %time Q = P - P.vertices()[0].vector()
CPU times: user 2.12 ms, sys: 30 µs, total: 2.15 ms
Wall time: 2.15 ms
# With precomputed data translations are what they should be -- trivial.
sage: P = polytopes.hypercube(14, 'zero_one', backend='field')
sage: %time Q = P - P.center()
CPU times: user 404 ms, sys: 3.97 ms, total: 408 ms
Wall time: 408 ms
Component: geometry
Keywords: polyhedra, translation
Author: Jonathan Kliem
Branch: ffda483
Reviewer: Laith Rastanawi
Issue created by migration from https://trac.sagemath.org/ticket/29324