Repository navigation
FIX: raise instead of returning non-finite values when the Riccati iteration overflows - #990
mayuriphad wants to merge 1 commit into
Conversation
…eration overflows (QuantEcon#986) Signed-off-by: mayuriphad <[email protected]>
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
Thanks for the pull request, @mayuriphad! QuantEcon welcomes AI-assisted contributions under its Code of AI Use. Every pull request carries one
This comment is posted on every external pull request that arrives without the line, so it is not a flag on yours. Nothing is blocked; a maintainer reads the reply. |
|
Added the |
|
Hi, just checking whether anything else is needed from my side on this PR. Happy to make changes if so. |
Fixes #986
solve_discrete_riccati_systemloopswhile error > tolerance. When the iterates overflow,errorbecomesnan, andnan > toleranceisFalse. The loop then exits as if it had converged and returns non-finitePs. Callers such asLQMarkov.stationary_valuesfail later with SciPy'sarray must not contain infs or NaNs, and the solver's own failure message (with thebeta >= 1stabilizability hint) is never raised. The doubling solversolve_discrete_riccati, used byLQandKalman, exits the same way.Both loops now raise the existing
fail_msgas soon as the error is not finite. The check adds no arithmetic, so runs that converge are unchanged.Tests:
test_solve_discrete_riccati_system_overflow_raisesandtest_solve_discrete_riccati_overflow_raises, both using the unstabilizable systemx' = 2x, B = 0from the issue. Both fail onmain(noValueError) and pass with this change.test_matrix_eqn,test_lqcontrol,test_ricatti,test_kalman,test_robustlqandtest_lqnash: 47 passed.Note: #984 changes the update inside the system solver's loop but not its exit condition. The new check sits just after the error sum, so any conflict between the two PRs should be trivial.
Assisted-by: Claude Code (Claude Opus 5.5)