From 6c47f6d2dc281f8058d7b04b0f109ddc783c5121 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sat, 18 May 2024 16:56:55 -0400 Subject: [PATCH] mjo/cone/nonnegative_orthant.py: bye, use cones.nonnegative_orthant() instead --- mjo/cone/all.py | 1 - mjo/cone/nonnegative_orthant.py | 80 --------------------------------- 2 files changed, 81 deletions(-) delete mode 100644 mjo/cone/nonnegative_orthant.py diff --git a/mjo/cone/all.py b/mjo/cone/all.py index 18fb052..a8d0eb3 100644 --- a/mjo/cone/all.py +++ b/mjo/cone/all.py @@ -6,7 +6,6 @@ from mjo.cone.cone import * from mjo.cone.completely_positive import * from mjo.cone.doubly_nonnegative import * from mjo.cone.faces import * -from mjo.cone.nonnegative_orthant import * from mjo.cone.permutation_invariant import * from mjo.cone.rearrangement import * from mjo.cone.symmetric_pd import * diff --git a/mjo/cone/nonnegative_orthant.py b/mjo/cone/nonnegative_orthant.py deleted file mode 100644 index 2bd1b3c..0000000 --- a/mjo/cone/nonnegative_orthant.py +++ /dev/null @@ -1,80 +0,0 @@ -r""" -The nonnegative orthant in `\mathbb{Z}^{n}`. I'm sick and tired of -typing it. -""" - -from sage.all import * - -def nonnegative_orthant(n, lattice=None): - r""" - The nonnegative orthant in ``n`` dimensions. - - INPUT: - - - ``n`` -- the dimension of the ambient space. - - - ``lattice`` -- (default: ``None``) an ambient lattice of rank ``n`` - to be passed to the :func:`Cone` constructor. - - OUTPUT: - - The convex cone having ``n`` standard basis vectors as its - generators. Each generating ray will have the integer ring as its - base ring. - - If a ``lattice`` was specified, then the resulting cone will live in - that lattice unless its rank is incompatible with the dimension - ``n`` (in which case a ``ValueError`` is raised). - - SETUP:: - - sage: from mjo.cone.nonnegative_orthant import nonnegative_orthant - - EXAMPLES:: - - sage: nonnegative_orthant(3).rays() - N(1, 0, 0), - N(0, 1, 0), - N(0, 0, 1) - in 3-d lattice N - - TESTS: - - We can construct the trivial cone as the nonnegative orthant in a - trivial vector space:: - - sage: nonnegative_orthant(0) - 0-d cone in 0-d lattice N - - The nonnegative orthant is a proper cone:: - - sage: n = ZZ.random_element(10) - sage: K = nonnegative_orthant(n) - sage: K.is_proper() - True - - If a ``lattice`` was given, it is actually used:: - - sage: L = ToricLattice(3, 'M') - sage: nonnegative_orthant(3, lattice=L) - 3-d cone in 3-d lattice M - - Unless the rank of the lattice disagrees with ``n``:: - - sage: L = ToricLattice(1, 'M') - sage: nonnegative_orthant(3, lattice=L) - Traceback (most recent call last): - ... - ValueError: lattice rank=1 and dimension n=3 are incompatible - - """ - if lattice is None: - lattice = ToricLattice(n) - - if lattice.rank() != n: - raise ValueError('lattice rank=%d and dimension n=%d are incompatible' - % - (lattice.rank(), n)) - - I = identity_matrix(ZZ,n) - return Cone(I.rows(), lattice) -- 2.44.2