# Error in quadratic objective function

I want to maximize the function:

``````maximize  y' * diag(diag(bo * bo'))* y
``````

where both bo and y are complex vectors.

I used the previous formula and the quad_form function:

``````maximize quad_form(y,diag(diag(bo * bo')) )
``````

and both give this error:

``````Error using class
Cannot change the number of fields of class 'cvxtuple' without first typing 'clear classes'.

Error in cvxtuple (line 19)
v = class( struct( 'value_', { v }, 'dual_', { [] } ), 'cvxtuple', cvxobj );

Error in cvx_end (line 183)
assignin( 'caller', 'cvx_optpnt', cvxtuple( cvx_collapse( vars, false, false ) ) );

Error in lorentz (line 100)
cvx_end

Error in rotated_lorentz (line 99)
cone = lorentz( sx, dim );

Error in cvx/quad_over_lin (line 77)
{ x, y, z } == rotated_lorentz( sx, dim, ~isreal( x ) ); %#ok

Error in cvx/sum_square_abs (line 6)
cvx_optval = quad_over_lin( x, 1, varargin{:} );

Error in cvx/quad_form (line 224)
cvx_optval = cvx_optval + alpha * sum_square_abs( ( R * x ) / sqrt(alpha) ) +    real( v' * x );

Error in maximize (line 14)
x = evalin( 'caller', sprintf( '%s ', varargin{:} ) );

Error in max_min_assump1_06_modified_4_squared_obj (line 238)
maximize  quad_form(y,diag(diag(bo * bo')) )
``````

How Could i solve this error??
I am using :

CVX Version 2.0 (beta), October 2013, Build 1011 for Windows 64

I’m not sure why this particular error is occurring—you may need to restart MATLAB to fix the ‘clear classes’ error. But if `bo` and `y` are both variables, this is a non-convex expression and CVX cannot handle it.

Perhaps you (the OP) had a three-fold typo (copy and paste), writing maximize when you meant minimize, but the remainder of this answer assumes it was not a typo, and is in fact what you intended.

To dispense with mcg’s concern, let’s assume that bo is an input vector rather than an optimization vector. Then the objective function is convex, and it is not (also) concave unless bo is the zero vector. Therefore, maximizing the objective will be rejected by cvx unless bo is the zero vector, in which case it doesn’t amount to much of an objective function.

y is the variable.
bo is a known complex vector
and it is a maximization problem.

## I tried to test the code on another machine, windows 7, 32 Bit and older version of CVX and i have a new error:

``````  Error using cholinc
CHOLINC has been removed.  Use ICHOL instead.

Error in cvx/quad_form (line 149)
R = cholinc( Q( prm, prm ), 'inf' ); %#ok

Error in maximize (line 20)
arg = evalin( 'caller', sprintf( '%s ', varargin{:} ) );

Error in max_min_assump1_06_modified_4_squared_obj (line 238)
maximize  quad_form(y,diag(diag(bo * bo')) )``````

Your statement that y is the variable, bo is a known complex vector and it is a maximization problem,exactly matches the conditions for the 2nd paragraph of my answer to apply. Unless bo is the zero vector, you are trying to maximize a non-concave objective, which cvx can not handle and will reject.

Maximizing a non-concave objective is not a convex optimization problem, and therefore is outside of cvx’s scope, so it will produce some error message, although I defer to mcg as to why you get the particular error messages you do.

Ah, of course, I can’t believe I missed the obvious non-convexity. With `bo` as a constant, this is a convex maximization and still violates the ruleset. The `ichol` error message is a known problem due to MATLAB’s lack of back-compatibility, but the fact remains CVX will never accept this model.

is there is any conversion to let the cvx accept the model under the assumption of bo a constant?

about the ichol error, the new cvx build can solve this error or what?

No, there’s no way to make CVX accept the model. It’s simply not convex.