From b60f53acc5d274d07d836fc473ebeec77a3a953f Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 6 Jan 2016 08:38:30 -0500 Subject: [PATCH] More minor tweaks to motzkin_decomposition(). --- mjo/cone/cone.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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) -- 2.44.2