Implementing randomized gossip

As for your semidefinite constraint, as the constraint is written, if you don’t use sdp mode, the constraint is wrong, because it will be interpreted as elementwise. So either us sdp mode, or rewrite it as s*I - (Wb-(one*one')/N) == semidefnite(N) There might be plenty more wrong with your code, but at least this must be fixed.

This same problem (more or less) has been discussed in How to write the product of CVX variables in a convex way? . I didn’t understand the problem then. and don’t now. But please read that thread.