From: Michael Orlitzky Date: Mon, 12 Oct 2015 16:00:14 +0000 (-0400) Subject: Remove _basically_the_same from cone.py. X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=9bab3c89cc7d669e7b99295900c9f590e5525079;p=sage.d.git Remove _basically_the_same from cone.py. --- diff --git a/mjo/cone/cone.py b/mjo/cone/cone.py index c1b7ffd..5f058ca 100644 --- a/mjo/cone/cone.py +++ b/mjo/cone/cone.py @@ -8,89 +8,6 @@ addsitedir(abspath('../../')) from sage.all import * -def _basically_the_same(K1, K2): - r""" - Test whether or not ``K1`` and ``K2`` are "basically the same." - - This is a hack to get around the fact that it's difficult to tell - when two cones are linearly isomorphic. We have a proposition that - equates two cones, but represented over `\mathbb{Q}`, they are - merely linearly isomorphic (not equal). So rather than test for - equality, we test a list of properties that should be preserved - under an invertible linear transformation. - - OUTPUT: - - ``True`` if ``K1`` and ``K2`` are basically the same, and ``False`` - otherwise. - - EXAMPLES: - - Any proper cone with three generators in `\mathbb{R}^{3}` is - basically the same as the nonnegative orthant:: - - sage: K1 = Cone([(1,0,0), (0,1,0), (0,0,1)]) - sage: K2 = Cone([(1,2,3), (3, 18, 4), (66, 51, 0)]) - sage: _basically_the_same(K1, K2) - True - - Negating a cone gives you another cone that is basically the same:: - - sage: K = Cone([(0,2,-5), (-6, 2, 4), (0, 51, 0)]) - sage: _basically_the_same(K, -K) - True - - TESTS: - - Any cone is basically the same as itself:: - - 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_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) - True - - """ - if K1.lattice_dim() != K2.lattice_dim(): - return False - - if K1.nrays() != K2.nrays(): - return False - - if K1.dim() != K2.dim(): - return False - - if K1.lineality() != K2.lineality(): - return False - - if K1.is_solid() != K2.is_solid(): - return False - - if K1.is_strictly_convex() != K2.is_strictly_convex(): - return False - - if len(K1.lyapunov_like_basis()) != len(K2.lyapunov_like_basis()): - return False - - C_of_K1 = K1.discrete_complementarity_set() - C_of_K2 = K2.discrete_complementarity_set() - if len(C_of_K1) != len(C_of_K2): - return False - - if len(K1.facets()) != len(K2.facets()): - return False - - return True - - - def _restrict_to_space(K, W): r""" Restrict this cone a subspace of its ambient space.