Skip to content

Commit

Permalink
FIX: Remove 0.0 from candidates in solve_discrete_riccati (#364)
Browse files Browse the repository at this point in the history
* FIX: Remove 0.0 from `candidates` in `solve_discrete_riccati`

Fix #356

* TEST: Set atol in `test_robust_rule_vs_simple`
  • Loading branch information
oyamad authored and mmcky committed Oct 25, 2017
1 parent ea900c4 commit f7a7c69
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion quantecon/matrix_eqn.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def solve_discrete_riccati(A, B, Q, R, N=None, tolerance=1e-10, max_iter=500):

# == Choose optimal value of gamma in R_hat = R + gamma B'B == #
current_min = np.inf
candidates = (0.0, 0.01, 0.1, 0.25, 0.5, 1.0, 2.0, 10.0, 100.0, 10e5)
candidates = (0.01, 0.1, 0.25, 0.5, 1.0, 2.0, 10.0, 100.0, 10e5)
BB = dot(B.T, B)
BTA = dot(B.T, A)
for gamma in candidates:
Expand Down
5 changes: 3 additions & 2 deletions quantecon/tests/test_robustlq.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,10 @@ def test_robust_rule_vs_simple(self):
assert_allclose(Kr, Ks, rtol=1e-4)
assert_allclose(Pr, Ps, rtol=1e-4)

atol = 1e-10
assert_allclose(Fr_pf, Fs_pf, rtol=1e-4)
assert_allclose(Kr_pf, Ks_pf, rtol=1e-4)
assert_allclose(Pr_pf, Ps_pf, rtol=1e-4)
assert_allclose(Kr_pf, Ks_pf, rtol=1e-4, atol=atol)
assert_allclose(Pr_pf, Ps_pf, rtol=1e-4, atol=atol)


def test_f2k_and_k2f(self):
Expand Down

0 comments on commit f7a7c69

Please # to comment.