Creating square matrix variable with specific attribute

Uncategorized
Apr 6, 2020
K

Hi,

I have got a problem with creating a square matrix and

I would really appreciate if someone could have comment or suggest a way.

I am trying to create a complex square matrix variable.

This matrix should be a lower triangular matrix and also its diagonal elements should be real and positive.

To sum up, a complex square matrix which is lower triangular and its diagonal elements are real and positive values.

I tried to use

variable A complex lower triangular;

imag(diag(A)) == 0;

Somehow CVX does not accept ‘imag(diag(A)) == 0;’

(i.e. if I erase the constraint ‘imag(diag(A)) == 0;’), it works)

If someone has other ways to create this matrix variable,

It would be really thankful.

Thank you!!

M

CVX 2.2 accepts the following:

cvx_begin
variable A complex lower triangular
imag(diag(A))==0

Actually, though, you want lower_triangular (note the underscore), but both are accepted without error message. And of course to be non-trivial, A should not be a scalar. So
variable A(n,n) complex lower_triangular .

Are you applying imag(diag(A))==0 to a nonlinear expression A, as opposed to a variable A? That would be a disallowed equality constraint.

Please ensure you are using CVX 2.2, not 3.0beta (which is known to have bugs).

K
Replying to #2

I am using version 2.2, but I got the error message that says

Error using *
Inner matrix dimensions must agree.

Error in cvxprob/eliminate (line 137)
P = P * cvx_invert_structure(
xR );

Error in cvxprob/solve (line 18)
[ At, cones, sgn, Q, P, dualized ] = eliminate(
prob, true, shim.dualize );

Error in cvx_end (line 88)
solve( prob );

Error in optimize1 (line 154)
cvx_end

Is it kind of famous bug??

M

That looks like a CVX bug (although perhaps not famous, until now). It would help if you can show a minimum reproducible example illustrating the error.

K
Replying to #4

I’ve got better insight on this error

Thank you for your interest and suggestion again

K
Replying to #4

I’ve got better insight on this error

As you said, CVX was able to accept


variable W_m(N_RU,N+F,M) complex;
variable Q_m(N_RU,N_RU,M) lower_triangular complex;
variable V_m(N_CP,N_CP,M) hermitian

for m=1:M

      real(diag(Q_m(:,:,m))) >= 0;

      imag(diag(Q_m(:,:,m))) == 0;             

end


However, I have also another constraint as below


for m=1:M

-sum(sum_square_abs(R(:,:,m)*W_m(:,:,m)))-sum(sum_square_abs(R(:,:,m)*Q_m(:,:,m)))+log_det(Z_m(:,:,m))+N_RU…
>= -(B_fso/((1-alpha_1-alpha_2)*f_s))c_fso…
-((alpha_1
B_rf)/((1-alpha_1-alpha_2)*f_s))*log_det(eye(N_RU)+ ((F_rf_m(:,:,m)*V_m(:,:,m)F_rf_m(:,:,m)')/sigma2_rf))…
-2
log_det(Q_m(:,:,m));

end


where

for m=1:M
R(:,:,m)=chol(Z_m(:,:,m));
end

Those two constraints can not be compatible.
In other words, either one of them should be erased for the CVX to work properly.
What I mean by two constraints is

  1. imag(diag(Q_m(:,:,m))) == 0;

and

  1. -sum(sum_square_abs(R(:,:,m)*W_m(:,:,m)))-sum(sum_square_abs(R(:,:,m)*Q_m(:,:,m)))+log_det(Z_m(:,:,m))+N_RU…

    = -(B_fso/((1-alpha_1-alpha_2)*f_s))c_fso…
    -((alpha_1
    B_rf)/((1-alpha_1-alpha_2)*f_s))*log_det(eye(N_RU)+ ((F_rf_m(:,:,m)*V_m(:,:,m)F_rf_m(:,:,m)')/sigma2_rf))…
    -2
    log_det(Q_m(:,:,m));

I do not know what the constraint 2 above has to do with constraint 1 (i.e. making diagonal entries real values)

Thank you for your interest and suggestion again

I do not know

M

I suggest you produce a minimal reproducible example, and submit a bug report as instructed in http://cvxr.com/cvx/support/ .

K
Replying to #7

I have tried several things and I’ve got to find this was because of

2*log_det(Q_m(:,:,m));.

Somehow

2*log_det(Q_m(:,:,m));

and

imag(diag(Q_m(:,:,m))) == 0;

This two can not be written in same problem.

Do you think the fact that this two can not be compatible is kind of bug of CVX?

K
Replying to #7

I have tried several things and I’ve got to find this was because of

2*log_det(Q_m(:,:,m));.

Somehow

2*log_det(Q_m(:,:,m));

and

imag(diag(Q_m(:,:,m))) == 0;

This two can not be written in same problem.

Do you think the fact that this two can not be compatible is kind of bug of CVX?