From 403e292f2dd44ac41535b463b719525d9374fb77 Mon Sep 17 00:00:00 2001 From: Michael Schneeberger Date: Tue, 9 May 2023 09:49:44 +0200 Subject: create single parameter if n_rows > 1 or n_col > 1 --- sumofsquares/sosexprbase/init/initsosexprbase.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sumofsquares/sosexprbase/init/initsosexprbase.py b/sumofsquares/sosexprbase/init/initsosexprbase.py index 9dade7e..f8f97fd 100644 --- a/sumofsquares/sosexprbase/init/initsosexprbase.py +++ b/sumofsquares/sosexprbase/init/initsosexprbase.py @@ -47,9 +47,12 @@ def init_param_sos_expr_base( param_matrix = param.T else: - params = tuple(monom.parametrize(f'{name}_{row+1}_{col+1}') for col in range(n_col) for row in range(n_row)) - param = polymatrix.v_stack(params) - param_matrix = polymatrix.v_stack(tuple(param.T for param in params)) + param = monom.rep_mat(n_col * n_row, 1).parametrize(f'{name}') + param_matrix = param.reshape(monom, -1).T + + # params = tuple(monom.parametrize(f'{name}_{row+1}_{col+1}') for col in range(n_col) for row in range(n_row)) + # param = polymatrix.v_stack(params) + # param_matrix = polymatrix.v_stack(tuple(param.T for param in params)) return ParamSOSExprBaseImpl( name=name, -- cgit v1.2.1