+
+ def test_lyapunov_orthant(self):
+ """
+ Test that a Lyapunov game on the nonnegative orthant works.
+ """
+ (_, K, e1, e2) = _random_orthant_params()
+
+ # Ignore that L, we need a diagonal (Lyapunov-like) one.
+ L = _random_diagonal_matrix(K.dimension())
+ game = SymmetricLinearGame(L, K, e1, e2)
+ soln = game.solution()
+
+ # We only check for positive/negative stability if the game
+ # value is not basically zero. If the value is that close to
+ # zero, we just won't check any assertions.
+ L = matrix(L).trans()
+ if soln.game_value() > options.ABS_TOL:
+ # L should be positive stable
+ ps = all([eig > -options.ABS_TOL for eig in eigenvalues_re(L)])
+ self.assertTrue(ps)
+ elif soln.game_value() < -options.ABS_TOL:
+ # L should be negative stable
+ ns = all([eig < options.ABS_TOL for eig in eigenvalues_re(L)])
+ self.assertTrue(ns)