# Quad_form.m has the same file in 'cvx-function' and '@cvx', calling confusion

Hello, I am trying to formulate QP in cvx, it is from the officical example, `` Exercise 4.3: Solve a simple QP with inequality constraints’’ . The code is as follows,
% From Boyd & Vandenberghe, “Convex Optimization”
% Joëlle Skaf - 09/26/05
%
% Solves the following QP with inequality constraints:
% minimize 1/2x’Px + q’*x + r
% s.t. -1 <= x_i <= 1 for i = 1,2,3
% Also shows that the given x_star is indeed optimal

% Generate data
P = [13 12 -2; 12 17 6; -2 6 12];
q = [-22; -14.5; 13];
r = 1;
n = 3;
x_star = [1;1/2;-1];

% Construct and solve the model
fprintf(1,‘Computing the optimal solution …’);
cvx_begin
variable x(n)
minimize ( (1/2)*quad_form(x,P) + q’*x + r)
x >= -1;
x <= 1;
cvx_end
fprintf(1,‘Done! \n’);

When I run it, the error prompted is ``The funtion ‘vec’ corresponding to input paramenters of type ‘double’ is not define ‘’.

I found that both the ‘cvx-funtion’ folder and ‘cvx-funtion-@cvx’ folder contained a ‘quad_form.m’ function. The ‘quad_form.m’ in ‘cvx_funtion’ was supposed to be called during runtime, but the ‘quad_form.m’ in ‘@cvx’ was called.

I don’t know how to solve it.

Thank You.

CVX shoud “automatically” call the correct version of the function in each circumstance (numerical argument vs. CVX expression argument). If it does not, then perhaps your installation is screwed up. Have you altered the MATLAB path with regard to what CVX did when it was installed? Try deleting all CVX directories from the MATLAB path, starting a new MATLAB session and reinstalling CVX.

Your program runs fine for me.