Reputation: 43
In cvxpy, I have variables defined as w=Variable(10,4)
. My objective function is the sum of the dot products of each column. In Matlab it would be
(w(:,1)'*w(:,1) + w(:,2)'*w(:,2) + w(:,3)'*w(:,3) + w(:,4)'*w(:,4))
Can anyone please help how to do it in cvxpy?
Upvotes: 1
Views: 534
Reputation: 1143
Your objective function is the trace of the Gram matrix, i.e., the squared Frobenius norm. Try:
objective = Minimize( norm(W,"fro") )
Upvotes: 1