Which one is more costly in terms of solution speed


(Fred) #1

Hi,

I have a general question about CVX solution time. Let’s say I have an p.s.d variable 6x6, there are two ways I can define it as follows:

variable W(6,6) hermitian semidefinite

or

variable Wr(6,1)
variable Wc(15,1) complex
W =[Wr(1,1)  Wc(1,1)  Wc(2,1)   Wc(3,1)   Wc(4,1)   Wc(5,1)
     Wc(1,1)' Wr(2,1)  Wc(6,1)   Wc(7,1)   Wc(8,1)   Wc(9,1)
     Wc(2,1)' Wc(6,1)' Wr(3,1)   Wc(10,1)  Wc(11,1)  Wc(12,1)
     Wc(3,1)' Wc(7,1)' Wc(10,1)' Wr(4,1)   Wc(13,1)  Wc(14,1)
     Wc(4,1)' Wc(8,1)' Wc(11,1)' Wc(13,1)' Wr(5,1)   Wc(15,1)
     Wc(5,1)' Wc(9,1)' Wc(12,1)' Wc(14,1)' Wc(15,1)' Wr(6,1) ];

W >= 0;

I’m wondering which way is better in terms of solution speed?
And in general, defining a variable or putting a constraint is more efficient in terms of speed?
Thanks,


(Michael C. Grant) #2

I would suspect that the first choice is faster, but at these sizes, the difference is likely minimal.

But the focus on efficiency for CVX is, in general, misplaced. CVX is designed to make it easy for you to build problems, not for speed in solving them. If you’re trying to maximize the performance of an application that depends on convex models, you should not be using CVX.


(Fred) #3

Thanks for the answer Michael.