summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNao Pross <np@0hm.ch>2024-05-07 16:56:07 +0200
committerNao Pross <np@0hm.ch>2024-05-07 16:56:07 +0200
commit2993d4d6feb68973255e41a6bfec116674ac8ee6 (patch)
tree7a3496cbf1b1d788904529f8dae600f5007ed376
parentFix bug in v_stack that creates unnecessary Expressions, add __str__ to combi... (diff)
downloadpolymatrix-2993d4d6feb68973255e41a6bfec116674ac8ee6.tar.gz
polymatrix-2993d4d6feb68973255e41a6bfec116674ac8ee6.zip
Fix bug in PolyMatrixAsAffinExpression
The bug was introduced by a bugfix, ironic: 7f26976a32513540d94dff3fc5bf3d7d2033f7e4
-rw-r--r--polymatrix/polymatrix/init.py2
-rw-r--r--polymatrix/polymatrix/mixins.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/polymatrix/polymatrix/init.py b/polymatrix/polymatrix/init.py
index 332977e..d45b02e 100644
--- a/polymatrix/polymatrix/init.py
+++ b/polymatrix/polymatrix/init.py
@@ -67,7 +67,7 @@ def to_affine_expression(p: PolyMatrixMixin) -> PolyMatrixAsAffineExpressionMixi
# Generate slices to index sub-matrices
slices = {
- m: tuple(range(i*ncols, (i+1)*ncols +1))
+ m: tuple(range(i*ncols, (i+1)*ncols))
for i, m in enumerate(monomials)
}
diff --git a/polymatrix/polymatrix/mixins.py b/polymatrix/polymatrix/mixins.py
index 7313a8e..4dcd6f7 100644
--- a/polymatrix/polymatrix/mixins.py
+++ b/polymatrix/polymatrix/mixins.py
@@ -355,7 +355,7 @@ class PolyMatrixAsAffineExpressionMixin(
nrows, _ = self.shape
return np.zeros((nrows, 1))
- columns = range(*self.slices[monomial])
+ columns = self.slices[monomial]
return self.affine_coefficients[:, columns]
def affine_coefficients_by_degrees(self) -> Iterable[tuple[int, MatrixType]]: