GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — added xperm function: reorder state variables in a ss model. by toaster-code · Pull Request #1039 · python-control/python-control

Conversation

@toaster-code

@toaster-code toaster-code commented Aug 9, 2024

Copy link
Copy Markdown

This PR provide a new function xperm, which allows to reorder state variables in a ss model. It is still undocumented (WIP) and there are caveats (named arguments does not propagate to the new ss model created as output from this function).
This PR contains no changes in functionality of the rest of the code, just adds a function that exists in Matlab control system toolbox.

Use case: Obtain the exact set of matrices A,B,C,D from a ss model without recurring to manually reorder them to match a result (like a book exercise).

There are other users cases I think, but for me, I wanted to have xperm as MATLAB does to reorder my obtained matrices to match the book results exactly.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@toaster-code
added xperm function: reorder state variables in a ss model.
c102929
slivingston
slivingston requested changes Aug 9, 2024
View reviewed changes

@slivingston slivingston left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Please add tests.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

toaster-code reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread control/statesp.py
D_perm = sys.D # D remains unchanged

return ss(A_perm, B_perm, C_perm, D_perm)
"""

@slivingston slivingston Aug 9, 2024

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This string block should be moved to somewhere accessible to users: the docstring, or a file in examples/.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread control/statesp.py

"""
# TODO: transfer the original sys parameters to the new output sys to preserve labels.
# TODO: create docstrings for this function - WIP

@slivingston slivingston Aug 9, 2024

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This will not be merged without a substantial docstring.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@coveralls

coveralls commented Aug 10, 2024

Copy link
Copy Markdown

Coverage Status

coverage: 94.421% (-0.3%) from 94.694%
when pulling c102929 on toaster-code:added_xperm_function
into 373ff11 on python-control:main.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@toaster-code

toaster-code commented Aug 11, 2024

Copy link
Copy Markdown
Author

@slivingston Thanks for the feedback.
Sure. I shall try to write some examples to the folder "examples" and write some docstrings.
This is my first time contributing to a substantial project, so sorry if the contribution is still raw or incomplete.
All tips and advises are welcome.

I shall improve it locally before re-submitting a Pull request.

Thanks.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@slivingston slivingston self-assigned this Aug 13, 2024
@slivingston

slivingston commented Aug 13, 2024

Copy link
Copy Markdown
Member

Sure. I shall try to write some examples to the folder "examples" and write some docstrings. This is my first time contributing to a substantial project, so sorry if the contribution is still raw or incomplete. All tips and advises are welcome.

I shall improve it locally before re-submitting a Pull request.

Thanks for contributing! No worries, and I am happy to provide feedback. We can iterate on this PR as much as needed.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@murrayrm

murrayrm commented Aug 8, 2026

Copy link
Copy Markdown
Member

@toaster-code: Any plans to update this?

A couple of suggestions from me:

  • The naming conventions for python-control state that "function names usually describe what they do". I would suggest renaming this function permute_state_variables. Since MATLAB has an xperm function that does the same thing, you could also include xperm either as an alias or just put it in the MATLAB compatibility module.
  • Unless you feel we need examples, I wouldn't bother with putting something in the examples/ folder. Just include a simple (executable) example in the docstring.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@toaster-code

toaster-code commented Aug 13, 2026 via email

Copy link
Copy Markdown
Author
Hi @murrayrm, thanks for reaching out. To be honest, this subject completely fell off my radar. Unfortunately, I'm facing some issues at home (no internet) and can't push any code. I'll put this at the top of my to-do list once I'm back online. Thanks for the feedback on the naming conventions—I'll implement those changes also. If you want also to take the hand on the topic or need help I am here happy to help. Best regards Le sam. 8 août 2026 à 15:12, Richard Murray ***@***.***> a écrit :
…
*murrayrm* left a comment (python-control/python-control#1039) <#1039 (comment)> @toaster-code <https://github.com/toaster-code>: Any plans to update this? A couple of suggestions from me: - The naming conventions <https://python-control.readthedocs.io/en/0.10.2/develop.html#naming-conventions> for python-control state that "function names usually describe what they do". I would suggest renaming this function permute_state_variables. Since MATLAB has an xperm function that does the same thing, you could also include xperm either as an alias or just put it in the MATLAB compatibility module. - Unless you feel we need examples, I wouldn't bother with putting something in the examples/ folder. Just include a simple (executable) example in the docstring. — Reply to this email directly, view it on GitHub <#1039?email_source=notifications&email_token=AABEHT337K36GGEZ6R656IL5I4RMRA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMRSGYZDKMZQGIY2M4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-5226253021>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AABEHT7HGM6AOVC4U3RMB4T5I4RMRAVCNFSNUABEKJSXA33TNF2G64TZHMZDENZZGE3TKMR3JFZXG5LFHMZDINJXG4YTGOBTHCQXMAQ> . Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS <https://github.com/notifications/mobile/ios/AABEHTYJKRWZI4FJRML33K35I4RMRA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMRSGYZDKMZQGIY2M4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJKTGN5XXIZLSL5UW64Y> and Android <https://github.com/notifications/mobile/android/AABEHT5DL2V6U4L4I5QIDDT5I4RMRA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMRSGYZDKMZQGIY2M4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLTGN5XXIZLSL5QW4ZDSN5UWI>. Download it today! You are receiving this because you were mentioned.Message ID: ***@***.***>
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@slivingston slivingston slivingston requested changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@slivingston slivingston

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@toaster-code @coveralls @slivingston @murrayrm
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.