Can't solve a convex problem

Hello!

I have a problem with OSQP. I set up a problem with this vectors for the P matrix:

c_float P_x[6] = {48, 30, 5, 50, 7, 20,};
c_int P_nnz = 6;
c_int P_i[6] = {0, 0, 0, 1, 1, 2,};
c_int P_p[4] = {0, 1, 2, 6,};

My P matrix equals to: [48 30 5]
[30 50 7]
[ 5 7 20]

But I got this output:

ERROR in LDL_factor: Error in KKT matrix LDL factorization when computing the nonzero elements. The problem seems to be non-convex
ERROR in osqp_setup: KKT matrix factorization.
The problem seems to be non-convex.

But I don’t understand, my problem should be convex, I have checked determinants and eigenvalues, solved the same problem in MATLAB with quadprog, so it should be OK but it isn’t.

Any idea why I’m having this trouble?

Thank you

You should construct vectors P_x, P_i and P_p so that they match the upper-triangular part of matrix P in CSC format. In other words, you should define them as:

P_x[6] = {48, 30, 50, 5, 7, 20};
P_i[6] = {0, 0, 1, 0, 1, 2};
P_p[4] = {0, 1, 3, 6};