From: Michael Orlitzky Date: Mon, 12 Nov 2018 03:22:06 +0000 (-0500) Subject: cone/rearrangement.py: simplify the implementation. X-Git-Url: http://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=6e240259a6453b592c136242b4c1738c24c35aed;p=sage.d.git cone/rearrangement.py: simplify the implementation. Use matrix tricks instead of a local function to construct the generators. --- diff --git a/mjo/cone/rearrangement.py b/mjo/cone/rearrangement.py index da6c595..3e09c8a 100644 --- a/mjo/cone/rearrangement.py +++ b/mjo/cone/rearrangement.py @@ -169,10 +169,7 @@ def rearrangement_cone(p,n,lattice=None): % (lattice.rank(), n)) - def d(j): - v = [1]*n # Create the list of all ones... - v[j] = 1 - p # Now "fix" the ``j``th entry. - return v - - G = identity_matrix(ZZ,n).rows() + [ d(j) for j in xrange(n) ] + I = identity_matrix(ZZ,n) + M = matrix.ones(ZZ,n) - p*I + G = identity_matrix(ZZ,n).rows() + M.rows() return Cone(G, lattice=lattice)