Cvx algorithm for mosek

I tried formulating my problem to mosek directly.

It took my code to setup the problem 10 seconds more than cvx.
cvx eliminated 3/5 of the constraints.
After factorization cvx had 2.9e5 nnz vs. 1.4e8 nnz in mine.
This leads to mosek solution of 1.3 seconds for cvx formulation, while for my formulation I stopped it on the fourth iteration after 183 seconds.

I should note that mosek eliminated variables for my formulation, which means that cvx does a better job at it.

How do you do it?

One thing that CVX does that MOSEK does not is to dualize when it thinks it is wortwhile.
So maybe CVX is feeding MOSEK with dual problem. It seems I am correct. See the Yalmip post.

Yes, we should continue the discussion on the other thread. Although it’s not the same, it’s a very similar problem (2D vs 3D).

Looking at the linked thread, it is clear Erling is correct. CVX passes the solver the dual problem whenever its heuristics suggest that doing so would be more efficient.