]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
Update max_ambient_dim parameter name for random_cone().
authorMichael Orlitzky <michael@orlitzky.com>
Tue, 4 Aug 2015 15:56:25 +0000 (11:56 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Tue, 4 Aug 2015 15:56:25 +0000 (11:56 -0400)
mjo/cone/cone.py

index baff1a7bbea4943206bc323040ef5d554d40ead4..e40579fa634dc51afc8eaf83ff5b3e68025180b5 100644 (file)
@@ -44,14 +44,14 @@ def _basically_the_same(K1, K2):
 
     Any cone is basically the same as itself::
 
-        sage: K = random_cone(max_dim = 8)
+        sage: K = random_cone(max_ambient_dim = 8)
         sage: _basically_the_same(K, K)
         True
 
     After applying an invertible matrix to the rows of a cone, the
     result should be basically the same as the cone we started with::
 
-        sage: K1 = random_cone(max_dim = 8)
+        sage: K1 = random_cone(max_ambient_dim = 8)
         sage: A = random_matrix(QQ, K1.lattice_dim(), algorithm='unimodular')
         sage: K2 = Cone( [ A*r for r in K1.rays() ], lattice=K1.lattice())
         sage: _basically_the_same(K1, K2)
@@ -126,7 +126,7 @@ def _rho(K, K2=None):
     The projected cone should always be solid::
 
         sage: set_random_seed()
-        sage: K = random_cone(max_dim = 8)
+        sage: K = random_cone(max_ambient_dim = 8)
         sage: K_S = _rho(K)
         sage: K_S.is_solid()
         True
@@ -135,7 +135,7 @@ def _rho(K, K2=None):
     dimension as the space we restricted it to::
 
         sage: set_random_seed()
-        sage: K = random_cone(max_dim = 8)
+        sage: K = random_cone(max_ambient_dim = 8)
         sage: K_S = _rho(K, K.dual() )
         sage: K_S.lattice_dim() == K.dual().dim()
         True
@@ -143,14 +143,14 @@ def _rho(K, K2=None):
     This function should not affect the dimension of a cone::
 
         sage: set_random_seed()
-        sage: K = random_cone(max_dim = 8)
+        sage: K = random_cone(max_ambient_dim = 8)
         sage: K.dim() == _rho(K).dim()
         True
 
     Nor should it affect the lineality of a cone::
 
         sage: set_random_seed()
-        sage: K = random_cone(max_dim = 8)
+        sage: K = random_cone(max_ambient_dim = 8)
         sage: K.lineality() == _rho(K).lineality()
         True
 
@@ -158,7 +158,7 @@ def _rho(K, K2=None):
     increase::
 
         sage: set_random_seed()
-        sage: K = random_cone(max_dim = 8)
+        sage: K = random_cone(max_ambient_dim = 8)
         sage: K.lineality() >= _rho(K).lineality()
         True
         sage: K.lineality() >= _rho(K, K.dual()).lineality()
@@ -167,7 +167,9 @@ 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_dim = 8, strictly_convex=False, solid=False)
+        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()
@@ -179,7 +181,9 @@ def _rho(K, K2=None):
     ::
 
         sage: set_random_seed()
-        sage: K = random_cone(max_dim = 8, strictly_convex=True, solid=False)
+        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()
@@ -191,7 +195,9 @@ def _rho(K, K2=None):
     ::
 
         sage: set_random_seed()
-        sage: K = random_cone(max_dim = 8, strictly_convex=False, solid=True)
+        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()
@@ -203,7 +209,9 @@ def _rho(K, K2=None):
     ::
 
         sage: set_random_seed()
-        sage: K = random_cone(max_dim = 8, strictly_convex=True, solid=True)
+        sage: K = random_cone(max_ambient_dim = 8,
+        ....:                 strictly_convex=True,
+        ....:                 solid=True)
         sage: K_S = _rho(K)
         sage: K_SP = _rho(K_S.dual()).dual()
         sage: K_SP.is_proper()
@@ -217,7 +225,9 @@ def _rho(K, K2=None):
     it. The operation of dual-taking should then commute with rho::
 
         sage: set_random_seed()
-        sage: J = random_cone(max_dim = 8, solid=False, strictly_convex=False)
+        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)
@@ -227,7 +237,9 @@ def _rho(K, K2=None):
     ::
 
         sage: set_random_seed()
-        sage: J = random_cone(max_dim = 8, solid=True, strictly_convex=False)
+        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)
@@ -237,7 +249,9 @@ def _rho(K, K2=None):
     ::
 
         sage: set_random_seed()
-        sage: J = random_cone(max_dim = 8, solid=False, strictly_convex=True)
+        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)
@@ -247,7 +261,9 @@ def _rho(K, K2=None):
     ::
 
         sage: set_random_seed()
-        sage: J = random_cone(max_dim = 8, solid=True, strictly_convex=True)
+        sage: J = random_cone(max_ambient_dim = 8,
+        ....:                 solid=True,
+        ....:                 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)
@@ -348,7 +364,7 @@ def discrete_complementarity_set(K):
     components of the complementarity set of the original cone::
 
         sage: set_random_seed()
-        sage: K1 = random_cone(max_dim=6)
+        sage: K1 = random_cone(max_ambient_dim=6)
         sage: K2 = K1.dual()
         sage: expected = [(x,s) for (s,x) in discrete_complementarity_set(K2)]
         sage: actual = discrete_complementarity_set(K1)
@@ -359,7 +375,7 @@ def discrete_complementarity_set(K):
     complementary::
 
         sage: set_random_seed()
-        sage: K = random_cone(max_dim=6)
+        sage: K = random_cone(max_ambient_dim=6)
         sage: dcs = discrete_complementarity_set(K)
         sage: sum([x.inner_product(s).abs() for (x,s) in dcs])
         0
@@ -452,7 +468,7 @@ def LL(K):
     of the cone::
 
         sage: set_random_seed()
-        sage: K = random_cone(max_dim=8)
+        sage: K = random_cone(max_ambient_dim=8)
         sage: C_of_K = discrete_complementarity_set(K)
         sage: l = [ (L*x).inner_product(s) for (x,s) in C_of_K for L in LL(K) ]
         sage: sum(map(abs, l))
@@ -464,7 +480,7 @@ def LL(K):
     \right)`
 
         sage: set_random_seed()
-        sage: K = random_cone(max_dim=8)
+        sage: K = random_cone(max_ambient_dim=8)
         sage: LL2 = [ L.transpose() for L in LL(K.dual()) ]
         sage: V = VectorSpace( K.lattice().base_field(), K.lattice_dim()^2)
         sage: LL1_vecs = [ V(m.list()) for m in LL(K) ]
@@ -650,8 +666,12 @@ def lyapunov_rank(K):
     [Rudolf et al.]_::
 
         sage: set_random_seed()
-        sage: K1 = random_cone(max_dim=8, strictly_convex=True, solid=True)
-        sage: K2 = random_cone(max_dim=8, strictly_convex=True, solid=True)
+        sage: K1 = random_cone(max_ambient_dim=8,
+        ....:                  strictly_convex=True,
+        ....:                  solid=True)
+        sage: K2 = random_cone(max_ambient_dim=8,
+        ....:                  strictly_convex=True,
+        ....:                  solid=True)
         sage: K = K1.cartesian_product(K2)
         sage: lyapunov_rank(K) == lyapunov_rank(K1) + lyapunov_rank(K2)
         True
@@ -659,7 +679,7 @@ def lyapunov_rank(K):
     The Lyapunov rank is invariant under a linear isomorphism
     [Orlitzky/Gowda]_::
 
-        sage: K1 = random_cone(max_dim = 8)
+        sage: K1 = random_cone(max_ambient_dim = 8)
         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)
@@ -667,7 +687,9 @@ def lyapunov_rank(K):
 
     Just to be sure, test a few more::
 
-        sage: K1 = random_cone(max_dim=8, strictly_convex=True, solid=True)
+        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)
@@ -675,7 +697,9 @@ def lyapunov_rank(K):
 
     ::
 
-        sage: K1 = random_cone(max_dim=8, strictly_convex=True, solid=False)
+        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)
@@ -683,7 +707,9 @@ def lyapunov_rank(K):
 
     ::
 
-        sage: K1 = random_cone(max_dim=8, strictly_convex=False, solid=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)
@@ -691,7 +717,9 @@ def lyapunov_rank(K):
 
     ::
 
-        sage: K1 = random_cone(max_dim=8, strictly_convex=False, solid=False)
+        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)
@@ -701,35 +729,43 @@ def lyapunov_rank(K):
     itself [Rudolf et al.]_::
 
         sage: set_random_seed()
-        sage: K = random_cone(max_dim=8)
+        sage: K = random_cone(max_ambient_dim=8)
         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_dim=8, strictly_convex=False, solid=False)
+        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_dim=8, strictly_convex=False, solid=True)
+        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_dim=8, strictly_convex=True, solid=False)
+        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_dim=8, strictly_convex=True, solid=True)
+        sage: K = random_cone(max_ambient_dim=8,
+        ....:                 strictly_convex=True,
+        ....:                 solid=True)
         sage: lyapunov_rank(K) == lyapunov_rank(K.dual())
         True
 
@@ -740,7 +776,9 @@ def lyapunov_rank(K):
     the Lyapunov rank of the trivial cone will be zero::
 
         sage: set_random_seed()
-        sage: K = random_cone(max_dim=8, strictly_convex=True, solid=True)
+        sage: K = random_cone(max_ambient_dim=8,
+        ....:                 strictly_convex=True,
+        ....:                 solid=True)
         sage: b = lyapunov_rank(K)
         sage: n = K.lattice_dim()
         sage: (n == 0 or 1 <= b) and b <= n
@@ -752,7 +790,7 @@ def lyapunov_rank(K):
     Lyapunov rank `n-1` in `n` dimensions::
 
         sage: set_random_seed()
-        sage: K = random_cone(max_dim=8)
+        sage: K = random_cone(max_ambient_dim=8)
         sage: b = lyapunov_rank(K)
         sage: n = K.lattice_dim()
         sage: b == n-1
@@ -762,7 +800,7 @@ def lyapunov_rank(K):
     reduced to that of a proper cone [Orlitzky/Gowda]_::
 
         sage: set_random_seed()
-        sage: K = random_cone(max_dim=8)
+        sage: K = random_cone(max_ambient_dim=8)
         sage: actual = lyapunov_rank(K)
         sage: K_S = _rho(K)
         sage: K_SP = _rho(K_S.dual()).dual()
@@ -775,7 +813,9 @@ def lyapunov_rank(K):
     The Lyapunov rank of a proper cone is just the dimension of ``LL(K)``::
 
         sage: set_random_seed()
-        sage: K = random_cone(max_dim=8, strictly_convex=True, solid=True)
+        sage: K = random_cone(max_ambient_dim=8,
+        ....:                 strictly_convex=True,
+        ....:                 solid=True)
         sage: lyapunov_rank(K) == len(LL(K))
         True
 
@@ -783,28 +823,36 @@ def lyapunov_rank(K):
     just increase our confidence that the reduction scheme works::
 
         sage: set_random_seed()
-        sage: K = random_cone(max_dim=8, strictly_convex=True, solid=False)
+        sage: K = random_cone(max_ambient_dim=8,
+        ....:                 strictly_convex=True,
+        ....:                 solid=False)
         sage: lyapunov_rank(K) == len(LL(K))
         True
 
     ::
 
         sage: set_random_seed()
-        sage: K = random_cone(max_dim=8, strictly_convex=False, solid=True)
+        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_dim=8, strictly_convex=False, solid=False)
+        sage: K = random_cone(max_ambient_dim=8,
+        ....:                 strictly_convex=False,
+        ....:                 solid=False)
         sage: lyapunov_rank(K) == len(LL(K))
         True
 
     Test Theorem 3 in [Orlitzky/Gowda]_::
 
         sage: set_random_seed()
-        sage: K = random_cone(max_dim=8, strictly_convex=True, solid=True)
+        sage: K = random_cone(max_ambient_dim=8,
+        ....:                 strictly_convex=True,
+        ....:                 solid=True)
         sage: L = ToricLattice(K.lattice_dim() + 1)
         sage: K = Cone([ r.list() + [0] for r in K.rays() ], lattice=L)
         sage: lyapunov_rank(K) >= K.lattice_dim()