diff options
author | Michael Schneeberger <michael.schneeberger@fhnw.ch> | 2023-03-29 13:57:22 +0200 |
---|---|---|
committer | Michael Schneeberger <michael.schneeberger@fhnw.ch> | 2023-03-29 13:57:22 +0200 |
commit | 498a4694d092adf820c6168edd141599a7c69346 (patch) | |
tree | 9591edff7acb9f7e36ec5698ff12e1bb6e3c30b5 | |
parent | from_ creates expression from expression (diff) | |
download | polymatrix-498a4694d092adf820c6168edd141599a7c69346.tar.gz polymatrix-498a4694d092adf820c6168edd141599a7c69346.zip |
parametrize operator acts only on column vector
-rw-r--r-- | polymatrix/expression/mixins/parametrizeexprmixin.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/polymatrix/expression/mixins/parametrizeexprmixin.py b/polymatrix/expression/mixins/parametrizeexprmixin.py index b8054ef..c33ca5b 100644 --- a/polymatrix/expression/mixins/parametrizeexprmixin.py +++ b/polymatrix/expression/mixins/parametrizeexprmixin.py @@ -31,13 +31,13 @@ class ParametrizeExprMixin(ExpressionBaseMixin): state, underlying = self.underlying.apply(state) - start_index = state.n_param + assert underlying.shape[1] == 1 + terms = {} - for col in range(underlying.shape[1]): - for row in range(underlying.shape[0]): - var_index = start_index + col * underlying.shape[1] + row - terms[row, col] = {((var_index, 1),): 1.0} + for row in range(underlying.shape[0]): + var_index = state.n_param + row + terms[row, 0] = {((var_index, 1),): 1.0} state = state.register( key=self, |