Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Update _ssmatrix and _check_shape for consistent usage #1116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 2, 2025

Conversation

murrayrm
Copy link
Member

@murrayrm murrayrm commented Feb 2, 2025

Prompted by issue #1100, this PR updates the _ssmatrix and _check_shape functions to make their usage more consistent and remove legacy calls that are no longer needed.

Changes:

  • Updated _ssmatrix to allow checking for square matrices and row/col dimensions, with improved error messages that include the name of the matrix generating the error.
  • Functions that accept state-space matrices now call _ssmatrix for uniform processing.
  • Removed unneeded calls to _ssmatrix on outputs of functions in mateqn.py and other places. These calls were used back when we supported the NumPy matrix class and are no longer required.
  • Fixed acker to use the matrices generated by _ssmatrix.
  • Updated _check_shape to have a call signature that is more conistent with _ssmatrix: the matrix and dimensions are first, followed by optional keywords, with a name keyword for the name of the matrix being checked (for error messages).
  • Removed internal _check_shape in statefbk.py and replaced with a call to mateqn._check_shape.
  • Updated unit tests to reflect the new wording of some error messages.

@murrayrm murrayrm linked an issue Feb 2, 2025 that may be closed by this pull request
@coveralls
Copy link

coveralls commented Feb 2, 2025

Coverage Status

coverage: 94.661% (+0.002%) from 94.659%
when pulling 4fc70f7 on murrayrm:update_ssmatrix-01Feb2025
into 2cb0520 on python-control:main.

control.dlqe: '9db995ed95c2214ce97074b0616a3191',
control.dlqr: '896cfa651dbbd80e417635904d13c9d6',
control.lqe: '567bf657538935173f2e50700ba87168',
control.dlqe: 'f2e52e35692cf5ffe911684d41d284c9',
Copy link
Contributor

Choose a reason for hiding this comment

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

I think these hashes are new-ish, just got caught out by them working on adding ruff-pyflakes checks. Is the idea to require the developer changing code to consider implications on the docstring? Or, I suppose, vice versa.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, that was the idea. However, they will go away when #1094 is merged (I found a better way to handle them).

@murrayrm murrayrm merged commit d2f9a9c into python-control:main Feb 2, 2025
23 checks passed
@murrayrm murrayrm added this to the 0.10.2 milestone Feb 19, 2025
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.

statefbk.acker doesn't use _ssmatrix-converted value of inputs
3 participants