From a9af5fd329a524faba3071c52fcc52122e8cf631 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sun, 10 Jan 2016 22:20:55 -0500 Subject: [PATCH] Don't check the pi/Z cone for when K is solid or pointed. --- mjo/cone/cone.py | 42 ++++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/mjo/cone/cone.py b/mjo/cone/cone.py index eac86b3..adba809 100644 --- a/mjo/cone/cone.py +++ b/mjo/cone/cone.py @@ -446,18 +446,27 @@ def positive_operator_gens(K): W = VectorSpace(F, n**2) vectors = [ W(tp.list()) for tp in tensor_products ] - # Create the *dual* cone of the positive operators, expressed as - # long vectors. WARNING: check=True is necessary even though it - # makes Cone() take forever. For an example take - # K = Cone([(1,0,0),(0,0,1),(0,0,-1)]). - pi_dual = Cone(vectors, ToricLattice(W.dimension())) + check = True + if K.is_solid() or K.is_strictly_convex(): + # The lineality space of either ``K`` or ``K.dual()`` is + # trivial and it's easy to show that our generating set is + # minimal. I would love a proof that this works when ``K`` is + # neither pointed nor solid. + # + # Note that in that case we can get *duplicates*, since the + # tensor product of (x,s) is the same as that of (-x,-s). + check = False + + # Create the dual cone of the positive operators, expressed as + # long vectors. + pi_dual = Cone(vectors, ToricLattice(W.dimension()), check=check) # Now compute the desired cone from its dual... pi_cone = pi_dual.dual() # And finally convert its rays back to matrix representations. M = MatrixSpace(F, n) - return [ M(v.list()) for v in pi_cone.rays() ] + return [ M(v.list()) for v in pi_cone ] def Z_transformation_gens(K): @@ -576,11 +585,20 @@ def Z_transformation_gens(K): W = VectorSpace(F, n**2) vectors = [ W(m.list()) for m in tensor_products ] - # Create the *dual* cone of the cross-positive operators, - # expressed as long vectors. WARNING: check=True is necessary - # even though it makes Cone() take forever. For an example take - # K = Cone([(1,0,0),(0,0,1),(0,0,-1)]). - Sigma_dual = Cone(vectors, lattice=ToricLattice(W.dimension())) + check = True + if K.is_solid() or K.is_strictly_convex(): + # The lineality space of either ``K`` or ``K.dual()`` is + # trivial and it's easy to show that our generating set is + # minimal. I would love a proof that this works when ``K`` is + # neither pointed nor solid. + # + # Note that in that case we can get *duplicates*, since the + # tensor product of (x,s) is the same as that of (-x,-s). + check = False + + # Create the dual cone of the cross-positive operators, + # expressed as long vectors. + Sigma_dual = Cone(vectors, lattice=ToricLattice(W.dimension()), check=check) # Now compute the desired cone from its dual... Sigma_cone = Sigma_dual.dual() @@ -589,7 +607,7 @@ def Z_transformation_gens(K): # But first, make them negative, so we get Z-transformations and # not cross-positive ones. M = MatrixSpace(F, n) - return [ -M(v.list()) for v in Sigma_cone.rays() ] + return [ -M(v.list()) for v in Sigma_cone ] def Z_cone(K): -- 2.44.2