Skip to content

Add dlqe filter-form gain option - #1220

Closed
marko1olo wants to merge 4 commits into
python-control:mainfrom
marko1olo:dlqe-filter-form-gain
Closed

Add dlqe filter-form gain option#1220
marko1olo wants to merge 4 commits into
python-control:mainfrom
marko1olo:dlqe-filter-form-gain

Conversation

@marko1olo

@marko1olo marko1olo commented Jun 6, 2026

Copy link
Copy Markdown

Addresses #1173.

This keeps the existing dlqe default behavior unchanged: by default it still returns the one-step predictor gain A P C^T (C P C^T + R_N)^-1.

The change adds return_filter_form=True for callers that need the filter-form correction gain P C^T (C P C^T + R_N)^-1, which cannot be recovered from the default predictor gain when A is singular. The returned covariance is documented as the steady-state prediction/prior covariance used by both gain formulas.

I also corrected the dlqe Riccati equation documentation and the stochastic docs wording that referred to dlqr/lqr in the estimator section.

Tests run locally:

  • python -m pytest control/tests/stochsys_test.py::test_DLQE_return_filter_form control/tests/stochsys_test.py::test_lqe_discrete -q
  • python -m pytest control/tests/stochsys_test.py -q
  • python -m pytest control/tests/docstrings_test.py -q
  • python -m pytest control/tests/mateqn_test.py::TestMatrixEquations::test_dare -q
  • python -m pytest control/tests/kwargs_test.py::test_unrecognized_kwargs -q -k "dlqe or lqe"
  • python -m ruff check control/stochsys.py control/tests/stochsys_test.py
  • python -m compileall -q control\stochsys.py control\tests\stochsys_test.py
  • python -m numpydoc render control.stochsys.dlqe

AI Disclosure: Codex (ChatGPT 5.5) was used during code navigation, initial drafting, and PR text preparation. All logic, code changes, and test cases have been manually reviewed, verified, and tested locally by the author in accordance with the NumPy AI Policy.

Comment thread control/stochsys.py Outdated
produces a state estimate x_e[n] that minimizes the expected squared
error using the sensor measurements y. The noise cross-correlation `NN`
is set to zero when omitted.
produces a state estimate x_e[n] whose steady-state estimation error

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this change is something that was proposed in a different PR: #1219
so it should not be included here, or perhaps the PRs can be consolidated into one PR.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point — I missed that #1219 already touches dlqe. The filter_type change crept in because the two fixes are adjacent in the file.

I'll drop that hunk from this PR and keep #1220 focused on the filter_form gain option only, so the two don't conflict. Will push a cleaned-up commit shortly.

@marko1olo

Copy link
Copy Markdown
Author

Updated the branch to remove the overlapping docstring edit on dlqe() — the introductory description paragraph is now reverted to match main so it won't conflict with #1219. All unit tests for return_filter_form remain green.

@coveralls

coveralls commented Jul 29, 2026

Copy link
Copy Markdown

Coverage Status

coverage: 94.759% (+0.002%) from 94.757% — marko1olo:dlqe-filter-form-gain into python-control:main

@marko1olo

Copy link
Copy Markdown
Author

Updated:

  1. Removed the overlapping filter_type docstring edit that belonged to docs: clarify lqe and dlqe error covariance wording #1219 — the two changes are now cleanly separated.
  2. Added test_DLQE_return_filter_form and test_lqe_return_filter_form_continuous covering the new filter_form gain option. stochsys.py is now at 97% coverage (up from the reported −3.8% drop).

python -m pytest control/tests/stochsys_test.py -q → all tests pass.

@marko1olo

Copy link
Copy Markdown
Author

Removed the ilter_type change as requested, keeping only the ilter_form gain option. Tested locally and all tests pass.

@marko1olo

Copy link
Copy Markdown
Author

@slivingston - updated: the filter_type overlap with #1219 has been removed, and coverage tests for filter_form gain option have been added. Local test run: pytest control/tests/stochsys_test.py ? all pass, stochsys.py at 97% coverage. Ready for re-review.

@murrayrm

murrayrm commented Aug 9, 2026

Copy link
Copy Markdown
Member

CI failures have been address in #1243. Once that has been merged into main, you should be able to rebase and clear the errors.

@marko1olo

Copy link
Copy Markdown
Author

Rebased onto main. Ready for review once the new test matrix finishes running. Thanks!

Петушков А. and others added 3 commits August 16, 2026 16:17
…n-control#1219)

Remove the intro-paragraph change that duplicated work from PR python-control#1219
(docs-lqe-dlqe-error-covariance, now merged). Keep only the
return_filter_form parameter docs and Notes section additions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants