<s> """<STR_LIT>""" <EOL> from __future__ import division <EOL> from collections import Counter <EOL> import unittest <EOL> import numpy as np <EOL> from numpy . testing import assert_allclose <EOL> from nose . plugins . attrib import attr <EOL> import pandas as pd <EOL> from quantecon import matrix_eqn as qme <EOL> def test_solve_discrete_lyapunov_zero ( ) : <EOL> '<STR_LIT>' <EOL> A = np . eye ( <NUM_LIT:4> ) * <NUM_LIT> <EOL> B = np . zeros ( ( <NUM_LIT:4> , <NUM_LIT:4> ) ) <EOL> X = qme . solve_discrete_lyapunov ( A , B ) <EOL> assert_allclose ( X , np . zeros ( ( <NUM_LIT:4> , <NUM_LIT:4> ) ) ) <EOL> def test_solve_discrete_lyapunov_B ( ) : <EOL> '<STR_LIT>' <EOL> A = np . ones ( ( <NUM_LIT:2> , <NUM_LIT:2> ) ) * <NUM_LIT> <EOL> B = np . array ( [ [ <NUM_LIT> , - <NUM_LIT> ] , [ - <NUM_LIT> , <NUM_LIT> ] ] ) <EOL> X = qme . solve_discrete_lyapunov ( A , B ) <EOL> assert_allclose ( B , X ) <EOL> def test_solve_discrete_lyapunov_complex ( ) : <EOL> '<STR_LIT>' <EOL> A = np . array ( [ [ <NUM_LIT:0.5> + <NUM_LIT> , <NUM_LIT:0.1> + <NUM_LIT> ] , <EOL> [ <NUM_LIT:1> , <NUM_LIT:0> ] ] ) <EOL> B = np . eye ( <NUM_LIT:2> ) <EOL> X = qme . solve_discrete_lyapunov ( A , B ) <EOL> assert_allclose ( np . dot ( np . dot ( A , X ) , A . conj ( ) . transpose ( ) ) - X , - B , <EOL> atol = <NUM_LIT> ) </s>
