From: Michael Orlitzky Date: Wed, 6 Jan 2016 13:38:30 +0000 (-0500) Subject: More minor tweaks to motzkin_decomposition(). X-Git-Url: http://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=b60f53acc5d274d07d836fc473ebeec77a3a953f;p=sage.d.git More minor tweaks to motzkin_decomposition(). --- diff --git a/mjo/cone/cone.py b/mjo/cone/cone.py index eb53163..28a8423 100644 --- a/mjo/cone/cone.py +++ b/mjo/cone/cone.py @@ -152,13 +152,15 @@ def motzkin_decomposition(K): sage: S.is_equivalent(expected_S) True """ - # 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()) + # The lines() method only returns one generator per line. For a true + # line, we also need a generator pointing in the opposite direction. + S_gens = [ direction*gen for direction in [1,-1] for gen in K.lines() ] + S = Cone(S_gens, K.lattice()) # Since ``S`` is a subspace, the rays of its dual generate its # orthogonal complement. - P = K.intersection( Cone(S.dual(), K.lattice()) ) + S_perp = Cone(S.dual(), K.lattice()) + P = K.intersection(S_perp) return (P,S)