write them as for for for if(wij>0)&& j>i … then follow the steps here How to vectorize most constraint loops in CVX