X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=mjo%2Fcone%2Fcone.py;h=eb5316330f6afefdc3b452482bfbd6d59deabbd2;hb=263ce239a456e5e073a9a8835cdf6cf7e0dfaa98;hp=84c3adb57d8396735460f5aefe5d669416e18ff1;hpb=2c784c920c6fcd0e15d1061b8ef04f67d9ade0c7;p=sage.d.git 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.