]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
Add some more reduction theorem test cases.
authorMichael Orlitzky <michael@orlitzky.com>
Mon, 1 Jun 2015 15:20:01 +0000 (11:20 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Mon, 1 Jun 2015 15:20:01 +0000 (11:20 -0400)
mjo/cone/cone.py

index 48e6f4363aadcf3f668603fa2e8019fdb9e107d2..7597cd66ab5275ec914df0c4929152b2937bacf0 100644 (file)
@@ -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))