I"m using cvx with MATLAB and sdpt3 solver. The computation time of my optimization problem is with following iterative equation

for i=1:N

X(i+1) == X(i) - I(i) * C;

end

two times shorter, than with the vectorized equation:

X(1) == X0;

X(2:(N+1)) == X0 .* ones(1,N) - sum(repmat(I,N,1) .* tril(ones(N,N),0),2)’ .* C;

Outside the CVX enviroment the second equation is multiple times faster using MATLAB. Can somebody tell me what is happening in the background of CVX causing this?