From 2993d4d6feb68973255e41a6bfec116674ac8ee6 Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Tue, 7 May 2024 16:56:07 +0200 Subject: Fix bug in PolyMatrixAsAffinExpression The bug was introduced by a bugfix, ironic: 7f26976a32513540d94dff3fc5bf3d7d2033f7e4 --- polymatrix/polymatrix/init.py | 2 +- polymatrix/polymatrix/mixins.py | 2 +- 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]]: -- cgit v1.2.1