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

Hello Dear
I wrote this code in CVX, and I get the "Undefined function ‘vec’ for input arguments of type ‘double’. "error. Can anyone help me?

U=1.0e+04 *...
[...
1.2690 + 0.0000i  -0.9141 + 0.1963i   1.1062 - 0.6537i  -0.5840 + 0.9455i  0.2723 - 1.1190i  -0.0666 + 0.2825i   0.3520 - 0.1756i  -0.2939 - 0.2951i   0.0791 + 0.3589i   0.3215 - 0.3344i;
-0.9141 - 0.1963i   1.7447 + 0.0000i  -1.1615 + 0.7543i   0.6827 - 1.2483i   -0.5779 + 0.9474i   0.2405 - 0.4622i  -0.5224 + 0.0182i   0.5184 + 0.1927i -0.0862 - 0.5291i  -0.2363 + 0.1912i;
1.1062 + 0.6537i  -1.1615 - 0.7543i   1.8608 + 0.0000i  -1.1473 + 0.7722i 1.1122 - 0.6679i  -0.3222 + 0.1638i   0.5829 + 0.1441i  -0.1910 - 0.6422i -0.0980 + 0.4656i   0.4661 - 0.1695i;
-0.5840 - 0.9455i   0.6827 + 1.2483i  -1.1473 - 0.7722i   1.7639 + 0.0000i   -0.9189 + 0.1954i   0.4042 - 0.0985i  -0.1945 - 0.4069i  -0.0122 + 0.5359i    0.5357 - 0.3729i  -0.3704 - 0.0905i;
0.2723 + 1.1190i  -0.5779 - 0.9474i   1.1122 + 0.6679i  -0.9189 - 0.1954i  1.2676 + 0.0000i  -0.3445 - 0.0192i   0.3527 + 0.2626i   0.0954 - 0.4334i -0.2499 + 0.1693i   0.3618 + 0.1782i;
-0.0666 - 0.2825i   0.2405 + 0.4622i  -0.3222 - 0.1638i   0.4042 + 0.0985i   -0.3445 + 0.0192i   0.1773 + 0.0000i  -0.0604 - 0.1109i   0.0292 + 0.1567i    0.1384 - 0.0567i  -0.0773 - 0.0360i;
0.3520 + 0.1756i  -0.5224 - 0.0182i   0.5829 - 0.1441i  -0.1945 + 0.4069i    0.3527 - 0.2626i  -0.0604 + 0.1109i   0.2555 + 0.0000i  -0.1012 - 0.1359i    0.0643 + 0.1710i   0.1386 - 0.0574i;
-0.2939 + 0.2951i   0.5184 - 0.1927i  -0.1910 + 0.6422i  -0.0122 - 0.5359i    0.0954 + 0.4334i   0.0292 - 0.1567i  -0.1012 + 0.1359i   0.3018 + 0.0000i   -0.1014 - 0.1362i   0.0297 + 0.1575i;
0.0791 - 0.3589i  -0.0862 + 0.5291i  -0.0980 - 0.4656i   0.5357 + 0.3729i   -0.2499 - 0.1693i   0.1384 + 0.0567i   0.0643 - 0.1710i  -0.1014 + 0.1362i    0.2564 + 0.0000i  -0.0608 - 0.1115i;
0.3215 + 0.3344i  -0.2363 - 0.1912i   0.4661 + 0.1695i  -0.3704 + 0.0905i    0.3618 - 0.1782i  -0.0773 + 0.0360i   0.1386 + 0.0574i   0.0297 - 0.1575i -0.0608 + 0.1115i   0.1781 + 0.0000i];
nu = 1.0e+03 *...
[...
   5.3643 - 3.4661i;
  -7.3591 - 0.8172i;
   6.2110 + 1.5906i;
  -3.0170 - 4.8616i;
   4.5081 + 4.9017i;
  -0.8786 - 1.9449i;
   2.7847 + 0.1798i;
  -1.2698 + 0.9470i;
   0.5090 - 2.2579i;
   2.2067 + 0.4713i];
C = -7.2972e+03;
N = 10;
N_prim = 5;
cvx_clear
cvx_begin
    variable v(N,1) complex
    maximize(-quad_form(v,U)+2*real(v'*nu)+C)
    subject to
        abs(v)<=ones(N,1);
        sum_square(abs(v))<=N_prim;
cvx_end

U has a couple of (slightly) negative eigenvalues, so quad-_form will not accept this even if you fix the vec error. You need to adjust U in some manner.

As for the vec error, read Error "Undefined function 'vec' for input arguments of type 'double' Note that vec is called by quad_form.

An alternative workardound to the vec issue is to explicitly form the quadratic form as v'*U*v.

thank you very much
could you please guide me on how I can adjust U ?
on another system I get the error:
The second argument must be positive or negative semidefinite.

but I know that U is PSD because it is a gram matrix

U is not PSD as you will see by looking at eig(U).

U-m*min(eig(U))*eye(10) is PSD for any m >= 1 (i.e., add a (just large) enough multiple of the identity matrix to make the matrix PSD). But I am not telling you this is the adjustment you should make. Perhaps you made an outright error in constructing the Gram matrix, or if not, encountered significant roundoff error somewhere in its construction.

Another alternative is to adjust negative eigenvalues of U to be slightly positive, while keeping the eigenvectors the same.

[V,E]=eig(U);
mineig = 1e-8;
U = V*diag(max(diag(E),mineig))*V';