]> gitweb.michael.orlitzky.com - sage.d.git/blobdiff - mjo/cone/cone.py
Update some comments for lyapunov_rank().
[sage.d.git] / mjo / cone / cone.py
index e40579fa634dc51afc8eaf83ff5b3e68025180b5..02d525859b90aa0eb5c80acdcbeebd867c3cd628 100644 (file)
@@ -167,51 +167,7 @@ def _rho(K, K2=None):
     If we do this according to our paper, then the result is proper::
 
         sage: set_random_seed()
-        sage: K = random_cone(max_ambient_dim = 8,
-        ....:                 strictly_convex=False,
-        ....:                 solid=False)
-        sage: K_S = _rho(K)
-        sage: K_SP = _rho(K_S.dual()).dual()
-        sage: K_SP.is_proper()
-        True
-        sage: K_SP = _rho(K_S, K_S.dual())
-        sage: K_SP.is_proper()
-        True
-
-    ::
-
-        sage: set_random_seed()
-        sage: K = random_cone(max_ambient_dim = 8,
-        ....:                 strictly_convex=True,
-        ....:                 solid=False)
-        sage: K_S = _rho(K)
-        sage: K_SP = _rho(K_S.dual()).dual()
-        sage: K_SP.is_proper()
-        True
-        sage: K_SP = _rho(K_S, K_S.dual())
-        sage: K_SP.is_proper()
-        True
-
-    ::
-
-        sage: set_random_seed()
-        sage: K = random_cone(max_ambient_dim = 8,
-        ....:                 strictly_convex=False,
-        ....:                 solid=True)
-        sage: K_S = _rho(K)
-        sage: K_SP = _rho(K_S.dual()).dual()
-        sage: K_SP.is_proper()
-        True
-        sage: K_SP = _rho(K_S, K_S.dual())
-        sage: K_SP.is_proper()
-        True
-
-    ::
-
-        sage: set_random_seed()
-        sage: K = random_cone(max_ambient_dim = 8,
-        ....:                 strictly_convex=True,
-        ....:                 solid=True)
+        sage: K = random_cone(max_ambient_dim = 8)
         sage: K_S = _rho(K)
         sage: K_SP = _rho(K_S.dual()).dual()
         sage: K_SP.is_proper()
@@ -220,50 +176,12 @@ def _rho(K, K2=None):
         sage: K_SP.is_proper()
         True
 
-    Test Proposition 7 in our paper concerning the duals and
+    Test the proposition in our paper concerning the duals and
     restrictions. Generate a random cone, then create a subcone of
     it. The operation of dual-taking should then commute with rho::
 
         sage: set_random_seed()
-        sage: J = random_cone(max_ambient_dim = 8,
-        ....:                 solid=False,
-        ....:                 strictly_convex=False)
-        sage: K = Cone(random_sublist(J.rays(), 0.5), lattice=J.lattice())
-        sage: K_W_star = _rho(K, J).dual()
-        sage: K_star_W = _rho(K.dual(), J)
-        sage: _basically_the_same(K_W_star, K_star_W)
-        True
-
-    ::
-
-        sage: set_random_seed()
-        sage: J = random_cone(max_ambient_dim = 8,
-        ....:                 solid=True,
-        ....:                 strictly_convex=False)
-        sage: K = Cone(random_sublist(J.rays(), 0.5), lattice=J.lattice())
-        sage: K_W_star = _rho(K, J).dual()
-        sage: K_star_W = _rho(K.dual(), J)
-        sage: _basically_the_same(K_W_star, K_star_W)
-        True
-
-    ::
-
-        sage: set_random_seed()
-        sage: J = random_cone(max_ambient_dim = 8,
-        ....:                 solid=False,
-        ....:                 strictly_convex=True)
-        sage: K = Cone(random_sublist(J.rays(), 0.5), lattice=J.lattice())
-        sage: K_W_star = _rho(K, J).dual()
-        sage: K_star_W = _rho(K.dual(), J)
-        sage: _basically_the_same(K_W_star, K_star_W)
-        True
-
-    ::
-
-        sage: set_random_seed()
-        sage: J = random_cone(max_ambient_dim = 8,
-        ....:                 solid=True,
-        ....:                 strictly_convex=True)
+        sage: J = random_cone(max_ambient_dim = 8)
         sage: K = Cone(random_sublist(J.rays(), 0.5), lattice=J.lattice())
         sage: K_W_star = _rho(K, J).dual()
         sage: K_star_W = _rho(K.dual(), J)
@@ -524,7 +442,7 @@ def LL(K):
 
 def lyapunov_rank(K):
     r"""
-    Compute the Lyapunov (or bilinearity) rank of this cone.
+    Compute the Lyapunov rank (or bilinearity rank) of this cone.
 
     The Lyapunov rank of a cone can be thought of in (mainly) two ways:
 
@@ -543,16 +461,7 @@ def lyapunov_rank(K):
     An integer representing the Lyapunov rank of the cone. If the
     dimension of the ambient vector space is `n`, then the Lyapunov rank
     will be between `1` and `n` inclusive; however a rank of `n-1` is
-    not possible (see the first reference).
-
-    .. note::
-
-        In the references, the cones are always assumed to be proper. We
-        do not impose this restriction.
-
-    .. seealso::
-
-        :meth:`is_proper`
+    not possible (see [Orlitzky/Gowda]_).
 
     ALGORITHM:
 
@@ -685,46 +594,6 @@ def lyapunov_rank(K):
         sage: lyapunov_rank(K1) == lyapunov_rank(K2)
         True
 
-    Just to be sure, test a few more::
-
-        sage: K1 = random_cone(max_ambient_dim=8,
-        ....:                  strictly_convex=True,
-        ....:                  solid=True)
-        sage: A = random_matrix(QQ, K1.lattice_dim(), algorithm='unimodular')
-        sage: K2 = Cone( [ A*r for r in K1.rays() ], lattice=K1.lattice())
-        sage: lyapunov_rank(K1) == lyapunov_rank(K2)
-        True
-
-    ::
-
-        sage: K1 = random_cone(max_ambient_dim=8,
-        ....:                  strictly_convex=True,
-        ....:                  solid=False)
-        sage: A = random_matrix(QQ, K1.lattice_dim(), algorithm='unimodular')
-        sage: K2 = Cone( [ A*r for r in K1.rays() ], lattice=K1.lattice())
-        sage: lyapunov_rank(K1) == lyapunov_rank(K2)
-        True
-
-    ::
-
-        sage: K1 = random_cone(max_ambient_dim=8,
-        ....:                  strictly_convex=False,
-        ....:                  solid=True)
-        sage: A = random_matrix(QQ, K1.lattice_dim(), algorithm='unimodular')
-        sage: K2 = Cone( [ A*r for r in K1.rays() ], lattice=K1.lattice())
-        sage: lyapunov_rank(K1) == lyapunov_rank(K2)
-        True
-
-    ::
-
-        sage: K1 = random_cone(max_ambient_dim=8,
-        ....:                  strictly_convex=False,
-        ....:                  solid=False)
-        sage: A = random_matrix(QQ, K1.lattice_dim(), algorithm='unimodular')
-        sage: K2 = Cone( [ A*r for r in K1.rays() ], lattice=K1.lattice())
-        sage: lyapunov_rank(K1) == lyapunov_rank(K2)
-        True
-
     The dual cone `K^{*}` of ``K`` should have the same Lyapunov rank as ``K``
     itself [Rudolf et al.]_::
 
@@ -733,42 +602,6 @@ def lyapunov_rank(K):
         sage: lyapunov_rank(K) == lyapunov_rank(K.dual())
         True
 
-    Make sure we exercise the non-strictly-convex/non-solid case::
-
-        sage: set_random_seed()
-        sage: K = random_cone(max_ambient_dim=8,
-        ....:                 strictly_convex=False,
-        ....:                 solid=False)
-        sage: lyapunov_rank(K) == lyapunov_rank(K.dual())
-        True
-
-    Let's check the other permutations as well, just to be sure::
-
-        sage: set_random_seed()
-        sage: K = random_cone(max_ambient_dim=8,
-        ....:                 strictly_convex=False,
-        ....:                 solid=True)
-        sage: lyapunov_rank(K) == lyapunov_rank(K.dual())
-        True
-
-    ::
-
-        sage: set_random_seed()
-        sage: K = random_cone(max_ambient_dim=8,
-        ....:                 strictly_convex=True,
-        ....:                 solid=False)
-        sage: lyapunov_rank(K) == lyapunov_rank(K.dual())
-        True
-
-    ::
-
-        sage: set_random_seed()
-        sage: K = random_cone(max_ambient_dim=8,
-        ....:                 strictly_convex=True,
-        ....:                 solid=True)
-        sage: lyapunov_rank(K) == lyapunov_rank(K.dual())
-        True
-
     The Lyapunov rank of a proper polyhedral cone in `n` dimensions can
     be any number between `1` and `n` inclusive, excluding `n-1`
     [Gowda/Tao]_. By accident, the `n-1` restriction will hold for the
@@ -810,44 +643,15 @@ def lyapunov_rank(K):
         sage: actual == expected
         True
 
-    The Lyapunov rank of a proper cone is just the dimension of ``LL(K)``::
-
-        sage: set_random_seed()
-        sage: K = random_cone(max_ambient_dim=8,
-        ....:                 strictly_convex=True,
-        ....:                 solid=True)
-        sage: lyapunov_rank(K) == len(LL(K))
-        True
-
-    In fact the same can be said of any cone. These additional tests
-    just increase our confidence that the reduction scheme works::
-
-        sage: set_random_seed()
-        sage: K = random_cone(max_ambient_dim=8,
-        ....:                 strictly_convex=True,
-        ....:                 solid=False)
-        sage: lyapunov_rank(K) == len(LL(K))
-        True
-
-    ::
+    The Lyapunov rank of any cone is just the dimension of ``LL(K)``::
 
         sage: set_random_seed()
-        sage: K = random_cone(max_ambient_dim=8,
-        ....:                 strictly_convex=False,
-        ....:                 solid=True)
-        sage: lyapunov_rank(K) == len(LL(K))
-        True
-
-    ::
-
-        sage: set_random_seed()
-        sage: K = random_cone(max_ambient_dim=8,
-        ....:                 strictly_convex=False,
-        ....:                 solid=False)
+        sage: K = random_cone(max_ambient_dim=8)
         sage: lyapunov_rank(K) == len(LL(K))
         True
 
-    Test Theorem 3 in [Orlitzky/Gowda]_::
+    We can make an imperfect cone perfect by adding a slack variable
+    (a Theorem in [Orlitzky/Gowda]_)::
 
         sage: set_random_seed()
         sage: K = random_cone(max_ambient_dim=8,