From: Michael Orlitzky Date: Mon, 1 Jun 2015 15:20:01 +0000 (-0400) Subject: Add some more reduction theorem test cases. X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=4db39eafe3de3ddc479b9c2d9352d0b2138bf1fe;p=sage.d.git Add some more reduction theorem test cases. --- diff --git a/mjo/cone/cone.py b/mjo/cone/cone.py index 48e6f43..7597cd6 100644 --- a/mjo/cone/cone.py +++ b/mjo/cone/cone.py @@ -408,5 +408,55 @@ def lyapunov_rank(K): sage: actual == expected True + Repeat the previous test with different ``random_cone()`` params:: + + sage: K = random_cone(max_dim=15, solid=False, strictly_convex=True) + sage: actual = lyapunov_rank(K) + sage: (phi1, _) = span_iso(K) + sage: K_S = phi1(K) + sage: (phi2, _) = span_iso(K_S.dual()) + sage: J_T = phi2(K_S.dual()).dual() + sage: l = K.linear_subspace().dimension() + sage: codim = K.lattice_dim() - K.dim() + sage: expected = lyapunov_rank(J_T) + K.dim()*(l + codim) + codim**2 + sage: actual == expected + True + + sage: K = random_cone(max_dim=15, solid=True, strictly_convex=False) + sage: actual = lyapunov_rank(K) + sage: (phi1, _) = span_iso(K) + sage: K_S = phi1(K) + sage: (phi2, _) = span_iso(K_S.dual()) + sage: J_T = phi2(K_S.dual()).dual() + sage: l = K.linear_subspace().dimension() + sage: codim = K.lattice_dim() - K.dim() + sage: expected = lyapunov_rank(J_T) + K.dim()*(l + codim) + codim**2 + sage: actual == expected + True + + sage: K = random_cone(max_dim=15, solid=True, strictly_convex=True) + sage: actual = lyapunov_rank(K) + sage: (phi1, _) = span_iso(K) + sage: K_S = phi1(K) + sage: (phi2, _) = span_iso(K_S.dual()) + sage: J_T = phi2(K_S.dual()).dual() + sage: l = K.linear_subspace().dimension() + sage: codim = K.lattice_dim() - K.dim() + sage: expected = lyapunov_rank(J_T) + K.dim()*(l + codim) + codim**2 + sage: actual == expected + True + + sage: K = random_cone(max_dim=15) + sage: actual = lyapunov_rank(K) + sage: (phi1, _) = span_iso(K) + sage: K_S = phi1(K) + sage: (phi2, _) = span_iso(K_S.dual()) + sage: J_T = phi2(K_S.dual()).dual() + sage: l = K.linear_subspace().dimension() + sage: codim = K.lattice_dim() - K.dim() + sage: expected = lyapunov_rank(J_T) + K.dim()*(l + codim) + codim**2 + sage: actual == expected + True + """ return len(LL(K))