Hello,

my code faces the following errors only because matrix H is semidefinite. Whenever I remove the keyword semidefinite, the code has no error. But, in fact matrix H must be a PSD matrix. Could you please help me fix this proble? Thank you for your help and time.

cvx_begin SDP

```
cvx_solver SEDUMI
variable y
variable M1(m + q + 1, m + q + 1)
variable M2(m + q + 1, m + q + 1)
variable M(m + q + 1, m + q + 1)
variable W(m + q + 1, m + q + 1)
variable H(m + q + 1, m + q + 1) semidefinite
variable G(m + q + 1, m + q + 1)
variable alphaa(q , 1)
variable betaa(q , 1)
variable gamaa(m , 1)
maximize ( y )
subject to:
%===================== 1st Constraint set ==========================
for i = 1 : q, M1 == M1 + alphaa(i , 1) * [2*b(i) -1*Ap(i,:) ; -1*Ap(i,:)' zeros(m + q , m + q)]; end
for i = 1 : q, M2 == M2 + betaa(i , 1) * [b(i)^2 zeros(1, m + q) ; zeros(m + q, 1) -1*Ap(i,:)'*Ap(i,:)]; end
M == M1 + M2;
%===================== 2nd Constraint set ==========================
for i = 1 : m, W == W + gamaa(i , 1) * [0 -1*E(:,i)' ; -1*E(:,i) 2*E(:,i)*E(:,i)']; end
%===================== 3rd Constraint set ==========================
for i = 1 : m + q + 1
for j = 1 : m + q + 1
G(i , j) >= 0;
end
end
%===================== 4th Constraint set ==========================
[-1*y cp' ; cp Qp ] == M + W + H + G;
```

cvx_end

%********************************************* Errors ***************************************************

## Calling SeDuMi 1.34: 694 variables, 0 equality constraints

Status: Error

Optimal value (cvx_optval): NaN

Error using sparse

Index exceeds matrix dimensions.

Error in pretransfo (line 444)

dblks = cumsum(full(sparse(1,istrt,1,1,sdpL)));

Error in sedumi (line 261)

[A,b,c,K,prep,origcoeff] = pretransfo(A,b,c,K,pars);

Error in cvx_run_solver (line 50)

[ varargout{1:nargout} ] = sfunc( inputs{:} );

Error in cvx_sedumi>solve (line 245)

[ xx, yy, info ] = cvx_run_solver( @sedumi, At, b, c, K, pars, ‘xx’, ‘yy’, ‘info’, settings, 5 );

Error in cvxprob/solve (line 429)

[ x, status, tprec, iters ] = shim.solve( At, b, c, cones, quiet, prec, solv.settings, eargs{:} );

Error in cvx_end (line 88)

solve( prob );

Error in Knapsack_Copositive_problem25 (line 139)

cvx_end