Enable scalar division of state-space objects#811
Merged
murrayrm merged 3 commits intopython-control:mainfrom Dec 16, 2022
Merged
Enable scalar division of state-space objects#811murrayrm merged 3 commits intopython-control:mainfrom
murrayrm merged 3 commits intopython-control:mainfrom
Conversation
Attempt division by any non-LTI and non-NameIOSystem by translating G / k to G * (1/k). Division of StateSpace by TransferFunction, etc., unchanged.
These aren't used in Python 3.
control/iosys.py
Outdated
| return newsys | ||
|
|
||
| def __truediv__(sys2, sys1): | ||
| """Multiply two input/output systems (series interconnection)""" |
Contributor
There was a problem hiding this comment.
should this docstring say "divide"?
sawyerbfuller
requested changes
Dec 12, 2022
Contributor
sawyerbfuller
left a comment
There was a problem hiding this comment.
looks good to me - with one possible update in a docstrong
Contributor
Author
|
Whoops, yes. Should be similar to StateSpace truediv docstring. Earliest I
can look at this is Friday.
…On Mon, 12 Dec 2022, 18:55 Sawyer Fuller, ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In control/iosys.py
<#811 (comment)>
:
> @@ -346,6 +346,17 @@ def __neg__(sys):
# Return the newly created system
return newsys
+ def __truediv__(sys2, sys1):
+ """Multiply two input/output systems (series interconnection)"""
should this docstring say "divide"?
—
Reply to this email directly, view it on GitHub
<#811 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAA3C7TWMZLIXFWKP4YPHCDWM5KGRANCNFSM6AAAAAAS2FXV4E>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I think this is a reasonable if minor improvement; it lets one write
gscaled = g / 2instead ofgscaled = g * (1/2). I'm less sure about division by arrays, but I see multiplication by arrays is allowed, and it seems natural to have symmetry between these operations.I added a simple test for
StateSpace / scalarandStateSpace / array, but not forInputOutputSystem / scalar. etc.I also modified the type-conversion tests as required.