Undefined function 'vec' for input arguments of type 'double'

After installing the cvx, this problem came up when testing a simple model. And it come up again every time i try a problem.Here is the error in testing simple model:

Testing with a simple model...
UNEXPECTED ERROR: ---------------------------------------------
Undefined function 'vec' for input arguments of type 'double'.
Error in cvx_sdpt3>solve (line 405)
        x(1,tvec{k}) = x(1,tvec{k}) + vec(xx{k})' * xvec{k};
Error in cvxprob/solve (line 429)
            [ x, status, tprec, iters ] = shim.solve( At, b, c,
                cones, quiet, prec, solv.settings, eargs{:} );
Error in cvx_end (line 88)
        solve( prob );
Error in cvx_setup (line 213)
        cvx_end

Switching to the SeDuMi solver will fix this problem (cvx_solver sedumi). You can still do this even though cvx_setup itself will fail when running the test model. It is a known bug but I haven’t been able to figure out the conditions under which it pops up.

A permanent fix is to run these commands after cvx_setup:

addpath([cvx_where,'functions',filesep,'vec_']);
savepath
1 Like
cp /your_cvx_folder/functions/vec_/vec.m /your_cvx_folder/functions/vec.m

This naive method solved my problems…

1 Like