From b97553aaaf9734644bee13bf484014f817456b26 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sun, 24 May 2015 12:42:59 -0400 Subject: [PATCH] First attempt at implementing LL(K); it doesn't work. --- mjo/cone/cone.py | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/mjo/cone/cone.py b/mjo/cone/cone.py index dbe369a..a5482b3 100644 --- a/mjo/cone/cone.py +++ b/mjo/cone/cone.py @@ -91,7 +91,37 @@ def LL(K): Lyapunov-like on this cone. """ - pass # implement me lol + V = K.lattice().vector_space() + + C_of_K = discrete_complementarity_set(K) + + matrices = [x.tensor_product(s) for (x,s) in C_of_K] + + # Sage doesn't think matrices are vectors, so we have to convert + # our matrices to vectors explicitly before we can figure out how + # many are linearly-indepenedent. + # + # The space W has the same base ring as V, but dimension + # dim(V)^2. So it has the same dimension as the space of linear + # transformations on V. In other words, it's just the right size + # to create an isomorphism between it and our matrices. + W = VectorSpace(V.base_ring(), V.dimension()**2) + + # Turn our matrices into long vectors... + vectors = [ W(m.list()) for m in matrices ] + + # Vector space representation of Lyapunov-like matrices + # (i.e. vec(L) where L is Luapunov-like). + LL_vector = W.span(vectors).complement() + + # Now construct an ambient MatrixSpace in which to stick our + # transformations. + M = MatrixSpace(V.base_ring(), V.dimension()) + + matrices = [ M(v.list()) for v in LL_vector.basis() ] + + return matrices + def lyapunov_rank(K): -- 2.44.2