Skip to content

Commit 7aaf355

Browse files
committed
Add TF __truediv__ and __rtruediv__
1 parent 0f59701 commit 7aaf355

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

control/xferfcn.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,11 @@ def __truediv__(self, other):
747747
else:
748748
other = _convert_to_transfer_function(other)
749749

750+
# Special case for SISO ``other``
751+
if not self.issiso() and other.issiso():
752+
other = append(*([other**-1] * self.noutputs))
753+
return self * other
754+
750755
if (self.ninputs > 1 or self.noutputs > 1 or
751756
other.ninputs > 1 or other.noutputs > 1):
752757
raise NotImplementedError(
@@ -770,6 +775,11 @@ def __rtruediv__(self, other):
770775
else:
771776
other = _convert_to_transfer_function(other)
772777

778+
# Special case for SISO ``self``
779+
if self.issiso() and not other.issiso():
780+
promoted_self = append(*([self**-1] * other.ninputs))
781+
return other * promoted_self
782+
773783
if (self.ninputs > 1 or self.noutputs > 1 or
774784
other.ninputs > 1 or other.noutputs > 1):
775785
raise NotImplementedError(

0 commit comments

Comments
 (0)