Hello All,

I have that error: “Your objectşve function is not scalar” But I could not find where I am wrong. This is my code can you look at it?

function G = TD_P_inv_Dual(P_exp,B,A_ax,B_by)

```
d = size(P_exp,1); %dimentions
m = size(P_exp,3); %number of operators
cvx_begin
variable S(1,m,m) %For the dual we have not dual variables instead of that we have variable and in this equation we have S
W_hat=zeros(d^2,d^2);
%variable sigma_e(d^2,d^2,d) hermitian semidefinite
for a=1:d
for b=1:d
for x=1:m
for y=1:m
W_hat=W_hat+B(a,b,x,y).*(kron(A_ax(:,:,x,a),B_by(:,:,y,b)));
end
end
end
end
W=sum(sum(sum(sum(B.*P_exp))));
J=cvx(0);
J= (S*W);
J=real(J)
minimize(J)
subject to
for e=1:d
(W_hat-kron(squeeze(A_ax(:,:,1,e)),eye(d)))==semidefinite(d^2,d^2);
end
cvx_end
G=double(J);
```

Bets!