Opened 11 months ago

Last modified 11 months ago

#30946 closed enhancement

Add "minimal=True" option to affine_hull_projection — at Version 2

Reported by: jipilab Owned by:
Priority: major Milestone: sage-9.3
Component: geometry Keywords: affine_hull, polytope
Cc: gh-kliem Merged in:
Authors: Jean-Philippe Labbé Reviewers:
Report Upstream: N/A Work issues:
Branch: u/jipilab/min_affhull (Commits, GitHub, GitLab) Commit: ff5aebf80861db9ddb6a88d3c457e6217b5ef8bd
Dependencies: Stopgaps:

Status badges

Description (last modified by jipilab)

Currently, the computation of the affine_hull_projection is done by default in AA which is not optimal sometimes.

Currently:

sage: A=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1],[1/4,1/4,1/4,1/4]]
sage: n=len(A)
sage: A=[vector(v) for v in A]
sage: AP = Polyhedron(vertices=A)
sage: M,b=AP.affine_hull_projection(orthonormal=True,extend=True,as_affine_map=True)
sage: V=[] 
....: for i in range(n):
....:     for j in range(i+1,n):
....:             V.append((A[i]-A[j])/2)
sage: Z=polytopes.zonotope(V)
sage: T = M.matrix().transpose()
sage: timeit('T*Z')
5 loops, best of 3: 78.5 ms per loop

With this ticket:

sage: A=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1],[1/4,1/4,1/4,1/4]]
sage: n=len(A)
sage: A=[vector(v) for v in A]
sage: AP = Polyhedron(vertices=A)
sage: M,b=AP.affine_hull_projection(orthonormal=True,extend=True,as_affine_map=True,minimal=True)
sage: V=[]
....: for i in range(n): 
....:     for j in range(i+1,n): 
....:             V.append((A[i]-A[j])/2) 
sage: Z=polytopes.zonotope(V)
sage: T = M.matrix().transpose()
sage: timeit('T*Z')
25 loops, best of 3: 18 ms per loop

Change History (2)

comment:1 Changed 11 months ago by jipilab

  • Status changed from new to needs_review

comment:2 Changed 11 months ago by jipilab

  • Description modified (diff)
Note: See TracTickets for help on using tickets.