Why does error of convex problem below arise?

N_t=4;
N_r=2;
Pt=10;
Q_0=cov(randn(N_t,N_t));
H_2=(randn(N_r,N_t)+j*randn(N_r,N_t))/sqrt(2);

cvx_begin
variable Q_p(N_t,N_t) complex

R_1=real(log_det(eye(N_r)+H_2*Q_0*H_2'+H_2*Q_p*H_2'));

R_2=real(log_det(eye(N_r)+H_2*Q_p*H_2'))-real(trace(Q_p));

maximize( R_1+R_2)

subject to
    
    real(trace(Q_p))<= Pt
    Q_p == hermitian_semidefinite(N_t); % Q_0 is positive semidefinite

cvx_end

To solve the above convex problem, the error below shows. I am confused.

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 main_algo2 (line 104)
cvx_end

1 Like

I got the same error message as you using both CVX 2.1 build 1116 and CVX 3.0beta build 1177. I think this is a CVX bug, perhaps related to Error: inner matrix dimension must agree in cvxprob/eliminate . The good news is that this is a self-contained example (modulo possibly different random numbers, but the same error occurs for several different random number instantiations I tried).

Dear Mark,

Thanks for your kind reply.

Unfortunately, I haven’t got this part of the answer “The good news is that this is a self-contained example (modulo possibly different random numbers, but the same error occurs for several different random number instantiations I tried).”

Could you please explain which random numbers are you referring to?

Thanks a lot.

Q_0 and H_2 depend on randn.

HI, have you solved your problem?

Hi, any update to solve this bug?

I think this problem is the inner initial value of the variable cannot satisfy “Inner matrix dimensions must agree”.
As the Q_p is positive semidefinite, you should set Q_p “semidefinite symmetric complex” instead of " Q_p == hermitian_semidefinite(N_t)", thus the inner initial value of Q_p is a positive semidefinite matrix.
And problem solved!!

N_t=4;
N_r=2;
Pt=10;
Q_0=cov(randn(N_t,N_t));
H_2=(randn(N_r,N_t)+j*randn(N_r,N_t))/sqrt(2);

cvx_begin
variable Q_p(N_t,N_t) semidefinite symmetric complex

R_1=real(log_det(eye(N_r)+H_2*Q_0*H_2'+H_2*Q_p*H_2'));

R_2=real(log_det(eye(N_r)+H_2*Q_p*H_2'))-real(trace(Q_p));

maximize( R_1+R_2)

subject to
    
    real(trace(Q_p))<= Pt
%     Q_p == hermitian_semidefinite(N_t); % Q_0 is positive semidefinite
cvx_end
1 Like

Although this question has been posted for a while, I’d like to offer a solution that might help others encountering a similar problem.
The problem arises from the “log_det” function, which requires the input matrices to be symmetric or Hermitian.
To ensure that your input matrix “X” meets this requirement, you can preprocess it by “(X + X’) / 2”.
Then it works!

May I ask if there is a latest solution to this problem