I have a matrix constraint A>=0 in which the elements include cvx variables. i wanted to express this constraint as x’*A*x>=0 which x is an arbitrary vector. but an error was shown as complex affine>=real constant. because the coefficients of cvx varibles in matrix elements are complex. how should I express this constraint?

# How to express a semidefinite convex matrix as a constraint in cvx?

**saeed1**(saeed ) #1

Is there any cvx function to express a matrix as a constraint?

Disciplined convex programming error: Matrix powers not permitted

**mcg**(Michael C. Grant) #2

What does an inequality with a complex value even mean? Did you intend for the quantity `x'*A*x`

to be complex?

**saeed1**(saeed ) #3

no, not finally. the matrix A>=0 which means positive semidefinite and 0 is not complex. based on the rule that for a positive semidefinite matrix A, gives the inequality x’Ax>=0 for every x, i wanted to convert the constraint A>=0 which is a constraint on matrix to a constraint x’Ax>=0 which is a constraint on an affine expression. that was because i did not know how to express constraint A>=0 in cvx. note that elements of a inclute multiplication of complex coefficient and cvx variables.

**mcg**(Michael C. Grant) #4

Why not just specify that A is positive semidefinite directly? Please use the user’s guide which discusses how to implement semidefinite constraints.

**saeed1**(saeed ) #5

I have many constraints in my problem. one of them is A>=0 which A is a matrix that includes some of the variables of the problem. I wanted to see if is there a direct function to express this constraint in cvx or I have to use another equivalent form for this constraint?

**Mark_L_Stone**(Mark L. Stone) #6

You can use

`A == semidefinite(n`

) to express the constraint that the real n by n matrix A be semidefinite. Use `A == hemnitian_semidefinite(n)`

is A is complex.

Or if you use the semidefinite mode (cvx_begin sdp ), `A > = 0`

means that A is constrained to be semidefinite.

In either case, the elements of A need to be affine in the CVX variables.

Read more about it in the CVX User’s Guide. http://cvxr.com/cvx/doc/basics.html#set-membership and http://cvxr.com/cvx/doc/sdp.html Alternatively, a CVX matric variable can be declared (hermitian) semidefinite, as described in http://cvxr.com/cvx/doc/basics.html#variables .