# Simple disciplined convex programming error

Hi. i have problem in cvx.
it looks completely simple

``````m = 3; n = 3;
A = randn(m,n); b = randn(m,n);
cvx_begin
variable x(m,n)
r= A * x*x - b ;
minimize(norm( r,2 ))
cvx_end
``````

Error using * (line 5)
Disciplined convex programming error:
Only scalar quadratic forms can be specified in CVX
.please say me what should i do with this error.

Maybe you should solve it for r= Ay-b with symmetric positive definite y, and then use Cholesky factorization y=x’*x.

I suspect you want
`r= A * x - b ;`
for some conformal (compatible) dimensions of `A,x,b`.

If `x` and `b` are vectors, then `minimize(norm( r,2 ))` can be used. However, if `x` and `b` are matrices, then I suspect what you want is `minimize(norm( r,'fro' ))`, which is very different than the matrix 2-norm which would be specified by `minimize(norm( r,2 ))` .

But it’s your problem, so I can’t say for sure what you really want. Note that your code `x*x` is conformal only when m = n, as it happens to be with your sample input data.

Thank you so much for your help but I cannot solve this problem, the main question is that I could not use expression x^2 in CVX
I wanted minimize Ax^2-b in previous part
But when I use x^2 DSP appears
How I could minimize expression A
x^2-b where A and b are matrixes

You can’t do that in CVX. But do you really want to? Look again at my suggestion.

And of course, the objective function must evaluate to a scalar, so presumably you mean to apply a norm to that.

Are you confusing wanting a least squares solution with forming `x*x` (which you would never do in linear least squares)?

Or if you really do want `x'*x`, do as @Milad_A suggested, and declare `y` as a semidefinite (square) variable instead of `declaring x`as a variable, then after `cvx_end`, use the command `x = chol(y)` to find `x`. Or if you want `x*x`, do the same, except `x = sqrtm(y)`.

It seems unlikely to me that you really want this.

I am really appreciate of your help ,sqrtm(x) is helpful but if I want use some expression in CVX like x^n or exp(x) where x is matrixes, what must I do because dcp error appears again
Also when objective is “x”
When I multiple another definite matrix like r*x, dcp error appears again