Error: Only scalar quadratic forms can be specified in CVX

hi !

I am trying to use cvx to do the following:
find the maximum d such that matrix P exist.
d is a scalar while P is 3by3 matrix.

so I wrote the following:

cvx_begin sdp
    %Optimize over P & d
    %--> find the maximum d such that P exists.
    variable P(n,n) semidefinite
    variable d(1) 
    maximize(d);
    subject to
        Ap = A0+ d*A1;
        An = A0- d*A1;
        0 > An'*P + P*An;
        0 > Ap'*P + P*Ap;
        P>eye(n);
cvx_end;

but I get the following error:
Disciplined convex programming error:
Only scalar quadratic forms can be specified in CVX.

I don’t know why it accrues since I used something similar before to find P 2x2.
that time did not involve variable d.

thank you !

When you made d a variable, it changed from being an LMI (Linear Matrix Inequality, a.k.a. Linear SDP) to a BMI (Blinear Matrix Inequality), which is non-convex and not allowed by CVX.

P*An includes a term P*d*A1, which has a (bilinear) product of variables, hence the error message. Similarly for P*Ap.

If you fix d, you can solve a convex feasibility problem, so perhaps can apply bisection (section 4.2.5 of Convex Optimization – Boyd and Vandenberghe ).