I wrote this code, it did not work, because of > Disciplined convex programming

error: Only scalar quadratic forms can be specified in CVX> . why I got this and how can I solve it?

thanks

variable x(n,1)

minimize(sum_square_abs(a1*diag(x)*diag(x’)*a2))

cvx_end

# Disciplined convex programming error: Only scalar quadratic forms can be specified in CVX

**ali_darabi**(Ali Darabi) #1

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

You haven’t told us what a1 and a2 are. I will presume they are non-negative constants and ignore them for the time being. Your objective as written is not a scalar, so it can not be a valid objective function. It’s also not clear to me how many times you want the components of x to be in effect squared. As written, you are getting something like x^4. Bottom line: I don’t know what problem you are trying to solve.

Is this what you want?

`minimize(sum_square(x))`

If x is intended to be complex, you need to declare it as such

variable x(n,1) complex

minimize(sum_square_abs(x))

**ali_darabi**(Ali Darabi) #3

a1 is a vector with size n*1
a2 is a vector with size 1*n. and all variables are complex.

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

I don’t know whether this is what you want. Note that .’ is non-conjugate transpose.

`cvx_begin variable x(n,1) complex minimize(sum_square_abs(a1.'*x.*(ctranspose(x).').*a2.')) cvx_end`

Or I believe you could use instead

`minimize(sum_square_abs(a1.'*x.*x'.'.*a2.'))`

**ali_darabi**(Ali Darabi) #5

so .’ means non-conjugate transpose and ’ means conjugate transpose?

thanks

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

Yes. Look at help transpose, help ctranspose, and help cvx/transpose and help cvx/ctranspose…

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

Some of my * got lost (now fixed). Anyhow, I made it more complicated than necessary, because conj can be used

`minimize(sum_square_abs(a1.'*x.*conj(x).*a2.'))`

**ali_darabi**(Ali Darabi) #8

I have a problem in optimization, I could not solve it for 8 month. can you help me?

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

If it is a CVX question, you can ask. Otherwise, another venue would be more appropriate,.