Hello,
I am trying to run a cvx program where I the number of variables change with the iteration number (say, k). For example, when k = 2, the cvx routine has these variables (note: the variable n is fixed for different values of k):
cvx_begin
variable q(n) complex;
variable Q_11(n, n) hermitian;
variable Q_12(n, n) hermitian;
variable Q_21(n-1, n-1) hermitian;
variable Q_22(n-1, n-1) hermitian;
minimize ...
However, when k = 7, then the number of variables increase, and the routine looks like this:
cvx_begin
variable q(n) complex;
variable Q_11(n, n) hermitian;
variable Q_12(n, n) hermitian;
variable Q_13(n, n) hermitian;
variable Q_14(n, n) hermitian;
variable Q_15(n, n) hermitian;
variable Q_16(n, n) hermitian;
variable Q_17(n, n) hermitian;
variable Q_21(n-1, n-1) hermitian;
variable Q_22(n-1, n-1) hermitian;
variable Q_23(n-1, n-1) hermitian;
variable Q_24(n-1, n-1) hermitian;
variable Q_25(n-1, n-1) hermitian;
variable Q_26(n-1, n-1) hermitian;
variable Q_27(n-1, n-1) hermitian;
minimize ...
I would like to automate the variable declaration based on the value of k, without explicitly writing down all variable declarations every time I change k (as I have done in the code above). Is there a way to do this? Any help will be greatly appreciated. Thanks.
AJ