Commit ae1ed26b authored by Joseph Weston's avatar Joseph Weston

fix unused variable bug in a seldom-executed code branch

parent 98d3a738
......@@ -10,6 +10,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added citation instructions in CITING.md
- Added a tutorial with downloadable Python files and Jupyter notebooks
### Fixed
- Bug when multiplying a model by a sympy expression (undefined variable)
### Removed
- Removed the notebooks from the source repository
......
......@@ -360,6 +360,7 @@ class Model(UserDict):
result = self.zeros_like()
result.data = {key: val * other for key, val in self.items()}
elif isinstance(other, Basic):
keep = self.keep
result = sum((type(self)({key * other: copy(val)},
keep=keep,
momenta=self.momenta)
......@@ -396,11 +397,12 @@ class Model(UserDict):
if isinstance(other, Number):
result = self.__mul__(other)
elif isinstance(other, Basic):
keep = self.keep
result = sum((type(self)({other * key: copy(val)},
keep=self.keep,
keep=keep,
momenta=self.momenta)
for key, val in self.items()
if (key * other in self.keep or not self.keep)),
if (key * other in keep or not keep)),
self.zeros_like())
else:
# Otherwise try to multiply every value with other
......
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