summaryrefslogtreecommitdiffstats
path: root/sumofsquares/sosexprbase/mixins/exprfrommonommixin.py
diff options
context:
space:
mode:
Diffstat (limited to 'sumofsquares/sosexprbase/mixins/exprfrommonommixin.py')
-rw-r--r--sumofsquares/sosexprbase/mixins/exprfrommonommixin.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/sumofsquares/sosexprbase/mixins/exprfrommonommixin.py b/sumofsquares/sosexprbase/mixins/exprfrommonommixin.py
index 354f46f..6e6e80b 100644
--- a/sumofsquares/sosexprbase/mixins/exprfrommonommixin.py
+++ b/sumofsquares/sosexprbase/mixins/exprfrommonommixin.py
@@ -12,5 +12,17 @@ class ExprFromMonomMixin(ParameterMixin, ExprBaseMixin):
...
@property
+ @abc.abstractmethod
+ def n_row(self) -> int:
+ ...
+
+ @property
def expr(self) -> polymatrix.Expression:
- return (self.param_matrix @ self.monom).cache()
+ expr_vec = (self.param_matrix @ self.monom).cache()
+
+ if self.n_row == 1:
+ return expr_vec
+
+ else:
+ return expr_vec.reshape(self.n_row, -1)
+