]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
Add tests for the dual/adjoint relationship of pi/Z.
authorMichael Orlitzky <michael@orlitzky.com>
Mon, 11 Jan 2016 18:31:14 +0000 (13:31 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Mon, 11 Jan 2016 18:31:14 +0000 (13:31 -0500)
mjo/cone/cone.py

index 21f9862c24a9e9e3d9cffc52a1e789018f59a153..9358585c2fea0397c87b82726c2d01a6c8960509 100644 (file)
@@ -460,6 +460,33 @@ def positive_operator_gens(K):
         ....:                   check=False)
         sage: actual.is_equivalent(expected)
         True
+
+    A transformation is positive on a cone if and only if its adjoint is
+    positive on the dual of that cone::
+
+        sage: set_random_seed()
+        sage: K = random_cone(max_ambient_dim=4)
+        sage: F = K.lattice().vector_space().base_field()
+        sage: n = K.lattice_dim()
+        sage: L = ToricLattice(n**2)
+        sage: W = VectorSpace(F, n**2)
+        sage: pi_of_K = positive_operator_gens(K)
+        sage: pi_of_K_star = positive_operator_gens(K.dual())
+        sage: pi_cone = Cone([p.list() for p in pi_of_K],
+        ....:                lattice=L,
+        ....:                check=False)
+        sage: pi_star = Cone([p.list() for p in pi_of_K_star],
+        ....:                lattice=L,
+        ....:                check=False)
+        sage: M = MatrixSpace(F, n)
+        sage: L = M(pi_cone.random_element(ring=QQ).list())
+        sage: pi_star.contains(W(L.transpose().list()))
+        True
+
+        sage: L = W.random_element()
+        sage: L_star = W(M(L.list()).transpose().list())
+        sage: pi_cone.contains(L) ==  pi_star.contains(L_star)
+        True
     """
     # Matrices are not vectors in Sage, so we have to convert them
     # to vectors explicitly before we can find a basis. We need these
@@ -680,6 +707,33 @@ def Z_transformation_gens(K):
         ....:                   check=False)
         sage: actual.is_equivalent(expected)
         True
+
+    A transformation is a Z-transformation on a cone if and only if its
+    adjoint is a Z-transformation on the dual of that cone::
+
+        sage: set_random_seed()
+        sage: K = random_cone(max_ambient_dim=4)
+        sage: F = K.lattice().vector_space().base_field()
+        sage: n = K.lattice_dim()
+        sage: L = ToricLattice(n**2)
+        sage: W = VectorSpace(F, n**2)
+        sage: Z_of_K = Z_transformation_gens(K)
+        sage: Z_of_K_star = Z_transformation_gens(K.dual())
+        sage: Z_cone = Cone([p.list() for p in Z_of_K],
+        ....:               lattice=L,
+        ....:               check=False)
+        sage: Z_star = Cone([p.list() for p in Z_of_K_star],
+        ....:               lattice=L,
+        ....:               check=False)
+        sage: M = MatrixSpace(F, n)
+        sage: L = M(Z_cone.random_element(ring=QQ).list())
+        sage: Z_star.contains(W(L.transpose().list()))
+        True
+
+        sage: L = W.random_element()
+        sage: L_star = W(M(L.list()).transpose().list())
+        sage: Z_cone.contains(L) ==  Z_star.contains(L_star)
+        True
     """
     # Matrices are not vectors in Sage, so we have to convert them
     # to vectors explicitly before we can find a basis. We need these