Commit 0a91fa36 authored by Tim Keil's avatar Tim Keil

also adjust ProductFunction

parent 45f7d8a7
......@@ -115,17 +115,15 @@ class Function(ParametricObject):
return NotImplemented
if isinstance(other, (Number, ParameterFunctional)):
return LincombFunction([self], [other])
if self.name != 'ProductFunction':
if self.name != 'ProductFunction' or not isinstance(self, ProductFunction):
if isinstance(other, ProductFunction) and other.name == 'ProductFunction':
return other.with_(functions=other.functions + [self])
else:
return ProductFunction([self, other])
elif isinstance(other, ProductFunction) and other.name == 'ProductFunction':
assert isinstance(self, ProductFunction)
functions = self.functions + other.functions
return ProductFunction(functions)
else:
assert isinstance(self, ProductFunction)
return self.with_(functions=self.functions + [other])
__rmul__ = __mul__
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment