From 86955bb8a74e81a37d2e44be271f9f76f79ad114 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Mon, 11 Jan 2016 13:31:14 -0500 Subject: [PATCH] Add tests for the dual/adjoint relationship of pi/Z. --- mjo/cone/cone.py | 54 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/mjo/cone/cone.py b/mjo/cone/cone.py index 21f9862..9358585 100644 --- a/mjo/cone/cone.py +++ b/mjo/cone/cone.py @@ -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 -- 2.43.2