From: Michael Orlitzky Date: Sun, 24 May 2015 16:42:59 +0000 (-0400) Subject: First attempt at implementing LL(K); it doesn't work. X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=b97553aaaf9734644bee13bf484014f817456b26;p=sage.d.git First attempt at implementing LL(K); it doesn't work. --- 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):