Opened 3 months ago

Closed 2 months ago

#32152 closed enhancement (fixed)

Set up pyramid with both Vrep and Hrep

Reported by: gh-kliem Owned by:
Priority: major Milestone: sage-9.4
Component: geometry Keywords: polyhedron, double description, precomputed, pyramid
Cc: Merged in:
Authors: Jonathan Kliem Reviewers: Travis Scrimshaw
Report Upstream: N/A Work issues:
Branch: 2b1c64b (Commits, GitHub, GitLab) Commit: 2b1c64b047628dfd5179cb98f637da57bb74452f
Dependencies: Stopgaps:

Status badges

Description

We set up the pyramid over a polyhedron with the double description.

Before:

sage: P = polytopes.permutahedron(6)                                                                                                                                                
sage: %time Q = P.pyramid()                                                                                                                                                         
CPU times: user 99.4 ms, sys: 0 ns, total: 99.4 ms
Wall time: 98 ms
sage: P = polytopes.hypercube(8)                                                                                                                                                    
sage: %time Q = P.pyramid()                                                                                                                                                         
CPU times: user 34.2 ms, sys: 24 µs, total: 34.2 ms
Wall time: 33.3 ms
sage: P = polytopes.cross_polytope(8)                                                                                                                                               
sage: %time Q = P.pyramid()                                                                                                                                                         
CPU times: user 40.5 ms, sys: 3.96 ms, total: 44.5 ms
Wall time: 43.3 ms
sage: P = polytopes.hypercube(6, backend='field')                                                                                                                                   
sage: %time Q = P.pyramid()                                                                                                                                                         
CPU times: user 974 ms, sys: 0 ns, total: 974 ms
Wall time: 973 ms

After:

sage: P = polytopes.permutahedron(6)                                                                                                                                                                                                                                           
sage: %time Q = P.pyramid()                                                                                                                                                                                                                                                    
CPU times: user 119 ms, sys: 197 µs, total: 120 ms
Wall time: 118 ms
sage: P = polytopes.hypercube(8)                                                                                                                                                                                                                                               
sage: %time Q = P.pyramid()                                                                                                                                                                                                                                                    
CPU times: user 30.5 ms, sys: 3.92 ms, total: 34.4 ms
Wall time: 33.4 ms
sage: P = polytopes.cross_polytope(8)                                                                                                                                                                                                                                          
sage: %time Q = P.pyramid()                                                                                                                                                                                                                                                    
CPU times: user 40.4 ms, sys: 0 ns, total: 40.4 ms
Wall time: 39.7 ms
sage: P = polytopes.hypercube(6, backend='field')                                                                                                                                                                                                                              
sage: %time Q = P.pyramid()                                                                                                                                                                                                                                                    
CPU times: user 8.04 ms, sys: 0 ns, total: 8.04 ms
Wall time: 7.99 ms
sage: P = polytopes.hypercube(10, backend='field')                                                                                                                                                                                                                             
sage: %time Q = P.pyramid()                                                                                                                                                                                                                                                    
CPU times: user 46.4 ms, sys: 98 µs, total: 46.5 ms
Wall time: 45.6 ms

Change History (6)

comment:1 Changed 3 months ago by gh-kliem

  • Status changed from new to needs_review

comment:2 Changed 3 months ago by tscrim

Could there be a slowdown if we need to compute the number of inequalities, say if a polytope was given in terms of its vertices? Do we even want to bother checking if one or both of the representations have been done (and then choose accordingly)?

I will have the same comment on #32150 and #32151.

comment:3 Changed 3 months ago by gh-kliem

Yes, there could be a slowdown and especially for something as simple as the pyramid, but not at the moment.

Currently, all polyhedra are immutable and non-interactive and the Vrepresentation and Hrepresentation is always already computed.

With mutable polyhedra (theoretically makes sense with ppl, normaliz and polymake) things will be a bit different. But then just embedding in higher dimension and adding a vertex would be the better approach anyway. So I would propose overwriting the pyramid method in the mutable case anyway.

comment:4 Changed 3 months ago by tscrim

  • Reviewers set to Travis Scrimshaw
  • Status changed from needs_review to positive_review

Okay, I understand. Thank you for the explanation. LGTM.

comment:5 Changed 3 months ago by gh-kliem

Thank you.

comment:6 Changed 2 months ago by vbraun

  • Branch changed from u/gh-kliem/double_description_pyramid to 2b1c64b047628dfd5179cb98f637da57bb74452f
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.