@@ -150,10 +150,6 @@ def solve_discrete_riccati(A, B, Q, R, N=None, tolerance=1e-10, max_iter=500,
150150 msg = "Check your method input. Should be {} or {}" .format (* methods )
151151 raise ValueError (msg )
152152
153- # == Set up == #
154- error = tolerance + 1
155- fail_msg = "Convergence failed after {} iterations."
156-
157153 # == Make sure that all array_likes are np arrays, two-dimensional == #
158154 A , B , Q , R = np .atleast_2d (A , B , Q , R )
159155 n , k = R .shape [0 ], Q .shape [0 ]
@@ -164,10 +160,15 @@ def solve_discrete_riccati(A, B, Q, R, N=None, tolerance=1e-10, max_iter=500,
164160 N = np .atleast_2d (N )
165161
166162 if method == 'qz' :
167- X = sp_solve_discrete_are (A , B , Q , R , s = N .T )
163+ X = sp_solve_discrete_are (A , B , Q , R , e = I , s = N .T )
168164 return X
169165
170166 # if method == 'doubling'
167+
168+ # == Set up == #
169+ error = tolerance + 1
170+ fail_msg = "Convergence failed after {} iterations."
171+
171172 # == Choose optimal value of gamma in R_hat = R + gamma B'B == #
172173 current_min = np .inf
173174 candidates = (0.01 , 0.1 , 0.25 , 0.5 , 1.0 , 2.0 , 10.0 , 100.0 , 10e5 )
0 commit comments