Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

LQR using SciPy#683

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
bnavigator merged 7 commits intopython-control:masterfrommurrayrm:lqr_scipy
Dec 26, 2021
Merged

Conversation

murrayrm
Copy link
Member

This PR updates themateqn module to allow the use of SciPy linear algebra functions as a replacement for Slycot functions. Among other things, this allows the use of thelqr command without having to install Slycot.

I implemented this by changing all of themateqn functions (lyap,care,dare, etc) to accept atmethod keyword that can either bescipy orslycot. The default value formethod isslycot if it is installed, otherwisescipy, so there is no change in behavior if you have Slycot.

Other changes:

  • Updatedlqr to callcare rather than replicating the code and cleaned up a lot of the code inmateqn to be more Pythonic.
  • Modified theslycot_check function so that it stores the result of checking whetherslycot can be imported rather than trying to import every time the function is called.
  • Implemented a function for checking size and properties of matrices passed tomateqn functions (mateqn._check_shape) that provides more consistent errors (this also required updating some of the unit tests).
  • Modifieddare to solve the generalized Sylvester equation usingslycot.sg02ad rather than usingslycot.sg02md to solve the simplified form of the discrete algebraic Riccati equation because there seems to be an error in the way thatstabilizing is handled insg02md (it returns the closed loop eigenvalues in the wrong order). (I'm working on generating a concrete counterexample for posting to Slycot.)

@murrayrmmurrayrm mentioned this pull requestDec 24, 2021
@coveralls
Copy link

coveralls commentedDec 24, 2021
edited
Loading

Coverage Status

Coverage increased (+0.7%) to 93.433% when pulling801f282 on murrayrm:lqr_scipy into4f681ab on python-control:master.

Copy link
Contributor

@bnavigatorbnavigator left a comment

Choose a reason for hiding this comment

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

Looks good. A few minor comments:

Comment on lines +585 to +590
elif method == 'slycot':
return _dare_slycot(A, B, Q, R, S, E, stabilizing)

else:
_check_shape("B", B, n, m)
_check_shape("Q", Q, n, n, square=True, symmetric=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe_dare_slycot() and_dare_scipy() should be on the same level?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I agree the asymmetry is annoying. I left it this way to avoid changing code that was working. Incare everything is in the main function, so at some point we should clean all of these up to be more uniform (either a single function or use_method uniformly).

bnavigator reacted with thumbs up emoji
@bnavigatorbnavigator merged commita05351b intopython-control:masterDec 26, 2021
@murrayrmmurrayrm added this to the0.9.1 milestoneDec 30, 2021
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@bnavigatorbnavigatorbnavigator left review comments

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
0.9.1
Development

Successfully merging this pull request may close these issues.

3 participants
@murrayrm@coveralls@bnavigator

[8]ページ先頭

©2009-2025 Movatter.jp