Reputation: 2088
I am trying to use quadprog in matlab. The variable is a matrix X. My problem has a linear constraint saying diag(AX)<= b, where A is a matrix and b is a vector. However, since quadprog only accepts vector variables, the inequality constraint above should be reformulated in vector form. But I do not know how. Can you help me to do so? Thanks.
Upvotes: 0
Views: 567
Reputation:
I'll assume that A and X are square matrices, of size nxn.
What are the diagonal elements? Temporarily, I'll call
C = diag(A*X)
What is C(i,i) ?
C(i,i) = sum(A(i,j)*X(j,i))
where the sum is over j. Essentially the i'th diagonal element of C is a dot product between the i'th row of A and the i'th column of X. There are n such dot products, which are trivially written in matrix form.
Of course, if A and X are not square, the same holds as long as they conform for matrix multiplication.
Upvotes: 1