added xperm function: reorder state variables in a ss model. - #1039
added xperm function: reorder state variables in a ss model.#1039toaster-code wants to merge 1 commit into
Conversation
| D_perm = sys.D # D remains unchanged | ||
|
|
||
| return ss(A_perm, B_perm, C_perm, D_perm) | ||
| """ |
There was a problem hiding this comment.
This string block should be moved to somewhere accessible to users: the docstring, or a file in examples/.
|
|
||
| """ | ||
| # TODO: transfer the original sys parameters to the new output sys to preserve labels. | ||
| # TODO: create docstrings for this function - WIP |
There was a problem hiding this comment.
This will not be merged without a substantial docstring.
|
@slivingston Thanks for the feedback. I shall improve it locally before re-submitting a Pull request. Thanks. |
Thanks for contributing! No worries, and I am happy to provide feedback. We can iterate on this PR as much as needed. |
|
@toaster-code: Any plans to update this? A couple of suggestions from me:
|
|
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:
***@***.***>
|
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.