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

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

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))

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

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.'))`

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

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

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.'))`

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

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