Skip to content

Commit

Permalink
expression: fix constant-constant multiplication
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianHofmann committed Jul 19, 2023
1 parent d9abfec commit 2c14f21
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions linopy/expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,11 +432,11 @@ def __mul__(self, other):
ds = ds.assign(const=other.const)
return merge(self, ds, dim=FACTOR_DIM, cls=QuadraticExpression)
else:
coeffs = self.coeffs * as_dataarray(
other, coords=self.coords, dims=self.coord_dims
)
multiplyer = as_dataarray(other, coords=self.coords, dims=self.coord_dims)
coeffs = self.coeffs * multiplyer
assert set(coeffs.shape) == set(self.coeffs.shape)
return self.assign(coeffs=coeffs)
const = self.const * multiplyer
return self.assign(coeffs=coeffs, const=const)

def __rmul__(self, other):
"""
Expand Down

0 comments on commit 2c14f21

Please sign in to comment.