Hi Dexter,
Let me try to use the example of min 0.5 x0^2 - x0*x1 + x1^2 - 2*x0 -
6*x1.
First, the linear part of the objective function is - 2*x0 - 6*x1.
Its coefficients are specified in c = [-2 -6];
Next, the second-order part of the objective function is 0.5 x0^2 -
x0*x1 + x1^2. Let's rewrite it as
0.5 x0 * x0 - x0 * x1 + x1 * x1. ....................... (1)
Its has three monomial terms, and each is the product of two variables
and a coefficient.
opts.QP.qrow = int32([0 0 1]) specifies those first variables, which
are x0, x0, x1 in their order appeared in (1).
opts.QP.qcol = int32([0 1 1]) specifies those second variables, which
are x0, x1, x1 in their order appeared in (1).
Last, opts.QP.qval = [0.5 -1 1] specifies those coefficients, which
are 0.5, -1, 1 in their order appeared in (1).
If there is no constraint in your QP, just let A = [ ]; and b=[ ];
Best,
Wotao