- Notifications
You must be signed in to change notification settings - Fork441
Closed
Milestone
Description
TransferFunction
doesn't have the__array_priority = 11
class attribute thatStateSpace
andFrequencyResponseData
do. Is this on purpose? See below for results ofarray * tf
, which results in an array (dtype object), andarray * ss
, which results in a SS object. I found this while investigating the behaviour ofbdalg.connect
in relation with#421
Should multiplication of scalar transfer functions by arrays be special-cased so that, e.g., with scalar tfk
,k * eye(5)
gives a 5x5 TF with identical entries on the diagonal? I think this sort of convention is used in literature, but it might be tricky to get something consistent here (e.g., should 1-input 1-output state-space systems do something analogous?; should one do general broadcasting?)
(control-dev) rory@rory-latitude:~/src/python-control$ ipythonPython 3.8.5 | packaged by conda-forge | (default, Jul 31 2020, 02:39:48) Type 'copyright', 'credits' or 'license' for more informationIPython 7.17.0 -- An enhanced Interactive Python. Type '?' for help.In [1]: !git describe 0.8.3-62-g6ede92eIn [2]: import control In [3]: import numpy as np In [4]: np.array([[1]]) * control.tf([1], [1,1]) Out[4]: array([[TransferFunction(array([1.]), array([1, 1]))]], dtype=object)In [5]: np.array([[1]]) * control.ss([[-1]], [[1]], [[1]], [[0]]) Out[5]: StateSpace(array([[-1.]]), array([[1.]]), array([[1.]]), array([[0.]]))