]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
Use check=False when constructing pi/Z cones.
authorMichael Orlitzky <michael@orlitzky.com>
Sat, 9 Jan 2016 23:05:06 +0000 (18:05 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Sat, 9 Jan 2016 23:05:06 +0000 (18:05 -0500)
mjo/cone/cone.py

index d0b5b6fc494d5b1dff88266a2b17883c77578952..eac86b374c131f4cad05dc27c7ec0eb7060deca2 100644 (file)
@@ -267,7 +267,9 @@ def positive_operator_gens(K):
         sage: K = random_cone(max_ambient_dim=4)
         sage: pi_of_K = positive_operator_gens(K)
         sage: L = ToricLattice(K.lattice_dim()**2)
-        sage: pi_cone = Cone([ g.list() for g in pi_of_K ], lattice=L)
+        sage: pi_cone = Cone([ g.list() for g in pi_of_K ],
+        ....:                lattice=L,
+        ....:                check=False)
         sage: P = matrix(K.lattice_dim(), pi_cone.random_element(QQ).list())
         sage: all([ K.contains(P*x) for x in K ])
         True
@@ -279,7 +281,9 @@ def positive_operator_gens(K):
         sage: K = random_cone(max_ambient_dim=4)
         sage: pi_of_K = positive_operator_gens(K)
         sage: L = ToricLattice(K.lattice_dim()**2)
-        sage: pi_cone = Cone([ g.list() for g in pi_of_K ], lattice=L)
+        sage: pi_cone = Cone([ g.list() for g in pi_of_K ],
+        ....:                lattice=L,
+        ....:                check=False)
         sage: P = matrix(K.lattice_dim(), pi_cone.random_element(QQ).list())
         sage: K.contains(P*K.random_element(ring=QQ))
         True
@@ -291,7 +295,9 @@ def positive_operator_gens(K):
         sage: K = random_cone(max_ambient_dim=4)
         sage: pi_of_K = positive_operator_gens(K)
         sage: L = ToricLattice(K.lattice_dim()**2)
-        sage: pi_cone = Cone([ g.list() for g in pi_of_K ], lattice=L)
+        sage: pi_cone = Cone([ g.list() for g in pi_of_K ],
+        ....:                lattice=L,
+        ....:                check=False)
         sage: actual = pi_cone.dual().linear_subspace()
         sage: U1 = [ vector((s.tensor_product(x)).list())
         ....:        for x in K.lines()
@@ -313,7 +319,9 @@ def positive_operator_gens(K):
         sage: l = K.lineality()
         sage: pi_of_K = positive_operator_gens(K)
         sage: L = ToricLattice(n**2)
-        sage: pi_cone = Cone([p.list() for p in pi_of_K], lattice=L)
+        sage: pi_cone = Cone([p.list() for p in pi_of_K],
+        ....:                 lattice=L,
+        ....:                 check=False)
         sage: actual = pi_cone.dual().lineality()
         sage: expected = l*(m - l) + m*(n - m)
         sage: actual == expected
@@ -329,7 +337,10 @@ def positive_operator_gens(K):
         sage: l = K.lineality()
         sage: pi_of_K = positive_operator_gens(K)
         sage: L = ToricLattice(n**2)
-        sage: actual = Cone([p.list() for p in pi_of_K], lattice=L).dim()
+        sage: pi_cone = Cone([p.list() for p in pi_of_K],
+        ....:                lattice=L,
+        ....:                check=False)
+        sage: actual = pi_cone.dim()
         sage: expected = n**2 - l*(m - l) - (n - m)*m
         sage: actual == expected
         True
@@ -343,19 +354,25 @@ def positive_operator_gens(K):
         True
         sage: L = ToricLattice(n^2)
         sage: pi_of_K = positive_operator_gens(K)
-        sage: actual = Cone([p.list() for p in pi_of_K], lattice=L).dim()
+        sage: pi_cone = Cone([p.list() for p in pi_of_K],
+        ....:                lattice=L,
+        ....:                check=False)
+        sage: actual = pi_cone.dim()
         sage: actual == n^2
         True
         sage: K = K.dual()
         sage: K.is_full_space()
         True
         sage: pi_of_K = positive_operator_gens(K)
-        sage: actual = Cone([p.list() for p in pi_of_K], lattice=L).dim()
+        sage: pi_cone = Cone([p.list() for p in pi_of_K],
+        ....:                lattice=L,
+        ....:                check=False)
+        sage: actual = pi_cone.dim()
         sage: actual == n^2
         True
         sage: K = Cone([(1,0),(0,1),(0,-1)])
         sage: pi_of_K = positive_operator_gens(K)
-        sage: actual = Cone([p.list() for p in pi_of_K]).dim()
+        sage: actual = Cone([p.list() for p in pi_of_K], check=False).dim()
         sage: actual == 3
         True
 
@@ -367,7 +384,10 @@ def positive_operator_gens(K):
         sage: n = K.lattice_dim()
         sage: pi_of_K = positive_operator_gens(K)
         sage: L = ToricLattice(n**2)
-        sage: actual = Cone([p.list() for p in pi_of_K], lattice=L).lineality()
+        sage: pi_cone = Cone([p.list() for p in pi_of_K],
+        ....:                lattice=L,
+        ....:                check=False)
+        sage: actual = pi_cone.lineality()
         sage: expected = n**2 - K.dim()*K.dual().dim()
         sage: actual == expected
         True
@@ -381,7 +401,10 @@ def positive_operator_gens(K):
         True
         sage: L = ToricLattice(n^2)
         sage: pi_of_K = positive_operator_gens(K)
-        sage: actual = Cone([p.list() for p in pi_of_K], lattice=L).lineality()
+        sage: pi_cone = Cone([p.list() for p in pi_of_K],
+        ....:                lattice=L,
+        ....:                check=False)
+        sage: actual = pi_cone.lineality()
         sage: actual == n^2
         True
         sage: K = K.dual()
@@ -393,7 +416,8 @@ def positive_operator_gens(K):
         True
         sage: K = Cone([(1,0),(0,1),(0,-1)])
         sage: pi_of_K = positive_operator_gens(K)
-        sage: actual = Cone([p.list() for p in pi_of_K]).lineality()
+        sage: pi_cone = Cone([p.list() for p in pi_of_K], check=False)
+        sage: actual = pi_cone.lineality()
         sage: actual == 2
         True
 
@@ -404,7 +428,9 @@ def positive_operator_gens(K):
         sage: K = random_cone(max_ambient_dim=4)
         sage: pi_of_K = positive_operator_gens(K)
         sage: L = ToricLattice(K.lattice_dim()**2)
-        sage: pi_cone = Cone([p.list() for p in pi_of_K], lattice=L)
+        sage: pi_cone = Cone([p.list() for p in pi_of_K],
+        ....:                lattice=L,
+        ....:                check=False)
         sage: K.is_proper() == pi_cone.is_proper()
         True
     """
@@ -495,9 +521,13 @@ def Z_transformation_gens(K):
     The lineality space of Z is LL::
 
         sage: set_random_seed()
-        sage: K = random_cone(min_ambient_dim=1, max_ambient_dim=4)
-        sage: lls = span([ vector(l.list()) for l in K.lyapunov_like_basis() ])
-        sage: z_cone  = Cone([ z.list() for z in Z_transformation_gens(K) ])
+        sage: K = random_cone(max_ambient_dim=4)
+        sage: L = ToricLattice(K.lattice_dim()**2)
+        sage: z_cone = Cone([ z.list() for z in Z_transformation_gens(K) ],
+        ....:               lattice=L,
+        ....:               check=False)
+        sage: ll_basis = [ vector(l.list()) for l in K.lyapunov_like_basis() ]
+        sage: lls = L.vector_space().span(ll_basis)
         sage: z_cone.linear_subspace() == lls
         True
 
@@ -507,7 +537,9 @@ def Z_transformation_gens(K):
         sage: K = random_cone(max_ambient_dim=4)
         sage: Z_of_K = Z_transformation_gens(K)
         sage: L = ToricLattice(K.lattice_dim()**2)
-        sage: z_cone  = Cone([ z.list() for z in Z_of_K ], lattice=L)
+        sage: z_cone  = Cone([ z.list() for z in Z_of_K ],
+        ....:                lattice=L,
+        ....:                check=False)
         sage: z_cone.lineality() == K.lyapunov_rank()
         True
 
@@ -518,8 +550,14 @@ def Z_transformation_gens(K):
         sage: pi_of_K = positive_operator_gens(K)
         sage: Z_of_K = Z_transformation_gens(K)
         sage: L = ToricLattice(K.lattice_dim()**2)
-        sage: pi_star = Cone([p.list() for p in pi_of_K], lattice=L).dual()
-        sage: z_star  = Cone([ z.list() for z in Z_of_K], lattice=L).dual()
+        sage: pi_cone = Cone([p.list() for p in pi_of_K],
+        ....:                lattice=L,
+        ....:                check=False)
+        sage: pi_star = pi_cone.dual()
+        sage: z_cone = Cone([ z.list() for z in Z_of_K],
+        ....:               lattice=L,
+        ....:               check=False)
+        sage: z_star = z_cone.dual()
         sage: pi_star.linear_subspace() == z_star.linear_subspace()
         True
     """
@@ -556,14 +594,10 @@ def Z_transformation_gens(K):
 
 def Z_cone(K):
     gens = Z_transformation_gens(K)
-    L = None
-    if len(gens) == 0:
-        L = ToricLattice(0)
-    return Cone([ g.list() for g in gens ], lattice=L)
+    L = ToricLattice(K.lattice_dim()**2)
+    return Cone([ g.list() for g in gens ], lattice=L, check=False)
 
 def pi_cone(K):
     gens = positive_operator_gens(K)
-    L = None
-    if len(gens) == 0:
-        L = ToricLattice(0)
-    return Cone([ g.list() for g in gens ], lattice=L)
+    L = ToricLattice(K.lattice_dim()**2)
+    return Cone([ g.list() for g in gens ], lattice=L, check=False)