Hi,

I am solving an SDP problem in MATLAB.

When I use CVX 3.0, there is an error launched

"Subscript indices must either be real positive integers or logicals."

However, this error doesn’t occur when I use CVX 2.0 version or the same problem with different input data.

For a test of CVX 3.0, I attached my code

clear all; clc;

n = 2; m = 5; s = 5;

alpha = 1e-2;

R = [1 alpha alpha alpha alpha; …

alpha 1 alpha alpha alpha; …

alpha alpha 1 alpha alpha; …

alpha alpha alpha 1 alpha; …

alpha alpha alpha alpha 1];

w0 = zeros(m,1); w0( randi(m,1,s) ) = 1;

X0 = w0w0’;

Z0 = inv( ( 2 * X0 - ones(m,1) * w0’ - w0 * ones(1,m) + ones(m,1) * ones(1,m) ). R );

H = ones(m,n);

cvx_begin sdp

variable w(m);

variable X(m,m) symmetric;

variable Z(m,m) symmetric;

variable V(m,m) symmetric;

variable T(n,n) symmetric;

expression L1(m,m);

C = Z0; C0 = (2 * X0 - ones(m,1) * w0’ - w0 * ones(1,m));

L1 = C - C * ( ( 2 * X - ones(m,1) * w’ - w * ones(1,m) - C0 ).* R )* C;

expression L2(m,m);

L2 = X.* Z0 + X0.* Z - X0.* Z0;

minimize ( trace(T) + trace(V) );

subject to

trace(X) == s; %%% Linear

diag(X) - w == zeros(m,1); %% linear

[X, w; w.’, 1] >= 0; %%% Linear matrix ineq

[Z, eye(m); eye(m), (2X - ones(m,1) * w’ - w * ones(1,m) + ones(m,1) * ones(1,m)). R] >= 0; %%% LMI

Z - L1 <= V; %% LMI

V >= 0; %% LMI

L2 >= 0; %% LMI

[ (eye(n) + H’ * L2 * H), eye(n); …

eye(n), T] >= 0; %%% LMI

cvx_end

The CVX message is

"

Subscript indices must either be real positive integers or logicals.

Error in cvx_sdpt3>solve (line 211)

Avec{end}{end+1} = reshape( ( str_3 * str_2 ) * reshape( At(ti,:), nt, nv * m ), nt2 * nv, m );

Error in cvx_solve (line 399)

[ x, status, tprec, iters, y ] = shim.solve( At, b, c, cones, params );

Error in cvx_finish (line 57)

[ status, result, bound, iters, tol ] = cvx_solve;

Error in cvx_end (line 11)

evalin( ‘caller’, ‘cvx_finish’ );

Error in Test_CVX (line 39)

cvx_end

"

If we set alpha = 0, then the aforementioned code works for SDP and have the valid output.

"------------------------------------------------------------

Status: Solved

Optimal value (cvx_optval): +3.32964e-10

"

I am wondering the reason for this error. Can you fix it?

Thank you very much,