In CVX, I encounter a problem. I want to multiply a Matrix of 2x4 with its transpose. I know the result must be positive definite. However, it couldn't let me do the multiplication directly. Says: Disciplined convex programming error:Only scalar quadratic forms can be specified in CVX. What can I do?

cvx_begin variable power_allocation(length(anchor_coordinate.x),1) minimize sum(power_allocation) subject to Matrix = process_matrix_inv'*(observation_matrix(:,:,t*n+1)'*diag(power_allocation.*path_loss(:,t*n+1))* observation_matrix(:,:,t*n+1)+prior_infor(:,:,t*n))*process_matrix_inv; A = Matrix(1:2,3:6)*D*Matrix(1:2,3:6)'; trace_inv(Matrix(1:2,1:2)-A) <= MSE_limit; power_allocation <= power_max; power_allocation >= power_min; cvx_end

  • 1
    $\begingroup$ the matrix D is a symmetrical matrix. $\endgroup$
    – tian qing
    Mar 12, 2016 at 11:05
  • $\begingroup$ I tone the end of the post down a bit. $\endgroup$
    – Dirk
    Mar 12, 2016 at 17:12
  • 2
    $\begingroup$ As a small remark, the product of a matrix and its transpose doesn't have to be positive definite. It can be positive semidefinite. Try, for example, with a matrix that has a zero column, or is in fact entirely composed of zeros. $\endgroup$ Mar 12, 2016 at 17:54

1 Answer 1


In CVX, you can use


to implement

$ (Ax-b)^{T}Q(Ax-b) $

See the section of the manual on scalar quadratic forms.

  • $\begingroup$ Dear professor, thank you for your reply. However, in my case, the (A*x-b) part is a tensor with 2*4 scale. And in CVX, it only permits me to input a vector. How could I fix that ? $\endgroup$
    – tian qing
    Mar 14, 2016 at 11:17
  • $\begingroup$ And all I want is to represent the sum of first two elements in the trace line of an inverse of Matrix. $\endgroup$
    – tian qing
    Mar 14, 2016 at 11:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.