-
Notifications
You must be signed in to change notification settings - Fork 438
Enable scalar division of state-space objects #811
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
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.
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.
LGTM.
control/iosys.py
Outdated
@@ -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)""" |
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.
should this docstring say "divide"?
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.
looks good to me - with one possible update in a docstrong
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:
***@***.***>
|
I think this is a reasonable if minor improvement; it lets one write
gscaled = g / 2
instead 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 / scalar
andStateSpace / array
, but not forInputOutputSystem / scalar
. etc.I also modified the type-conversion tests as required.