From: Michael Orlitzky Date: Wed, 6 Jan 2016 03:32:22 +0000 (-0500) Subject: More minor cleanup of motzkin_decomposition(). X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=263ce239a456e5e073a9a8835cdf6cf7e0dfaa98;p=sage.d.git More minor cleanup of motzkin_decomposition(). --- diff --git a/mjo/cone/cone.py b/mjo/cone/cone.py index 84c3adb..eb53163 100644 --- a/mjo/cone/cone.py +++ b/mjo/cone/cone.py @@ -83,7 +83,7 @@ def motzkin_decomposition(K): REFERENCES: .. [Stoer-Witzgall] J. Stoer and C. Witzgall. Convexity and - Optimization in Finite Dimensions I. Springer-Verlag, New + Optimization in Finite Dimensions I. Springer-Verlag, New York, 1970. EXAMPLES: @@ -152,18 +152,17 @@ def motzkin_decomposition(K): sage: S.is_equivalent(expected_S) True """ - linspace_gens = [ copy(b) for b in K.linear_subspace().basis() ] - linspace_gens += [ -b for b in linspace_gens ] + # The lines() method only gives us one generator for each line, + # so we negate the result and combine everything for the full set. + S = Cone([p*l for p in [1,-1] for l in K.lines()], K.lattice()) - S = Cone(linspace_gens, K.lattice()) - - # Since ``S`` is a subspace, its dual is its orthogonal complement - # (albeit in the wrong lattice). - S_perp = Cone(S.dual(), K.lattice()) - P = K.intersection(S_perp) + # Since ``S`` is a subspace, the rays of its dual generate its + # orthogonal complement. + P = K.intersection( Cone(S.dual(), K.lattice()) ) return (P,S) + def positive_operator_gens(K): r""" Compute generators of the cone of positive operators on this cone.