CPXXgetquad and CPXgetquad

The routine CPXXgetquad/CPXgetquad is used to access a range of columns of the matrix Q of a model with a quadratic objective function.

int  CPXXgetquad( CPXCENVptr env, CPXCLPptr lp, CPXNNZ * nzcnt_p, CPXNNZ * qmatbeg, CPXDIM * qmatind, double * qmatval, CPXNNZ qmatspace, CPXNNZ * surplus_p, CPXDIM begin, CPXDIM end )

int  CPXgetquad( CPXCENVptr env, CPXCLPptr lp, int * nzcnt_p, int * qmatbeg, int * qmatind, double * qmatval, int qmatspace, int * surplus_p, int begin, int end )

Description

The routine CPXXgetquad/CPXgetquad is used to access a range of columns of the matrix Q of a model with a quadratic objective function. The beginning and end of the range, along with the length of the arrays in which the nonzero entries of these columns are to be returned, must be specified.

Specifically, column j consists of the entries in qmatval and qmatind in the range from qmatbeg[j-begin] to qmatbeg[(j+1)-begin]-1. (Column end consists of the entries from qmatbeg[end-begin] to nzcnt_p-1.) This array must be of length at least (end-begin+1).

Note: If the value of qmatspace is zero, the negative of the value of surplus_p returned indicates the length needed for the arrays qmatind and qmatval.

Arguments

env
A pointer to the CPLEX environment as returned by CPXXopenCPLEX/CPXopenCPLEX.
lp
A pointer to a CPLEX problem object as returned by CPXXcreateprob/CPXcreateprob.
nzcnt_p
A pointer to an integer to contain the number of nonzeros returned; that is, the true length of the arrays qmatind and qmatval. If the function returns either 0 (zero) or CPXERR_NEGATIVE_SURPLUS, then this value contains the number of elements that were stored in qmatind or qmatval. Otherwise, the value is either unchanged or set to 0 (zero).
qmatbeg
An array to contain indices indicating where each of the requested columns of Q begins in the arrays qmatval and qmatind.
qmatind
An array to contain the row indices associated with the elements of qmatval. May be NULL if qmatspace is zero.
qmatval
An array to contain the nonzero coefficients of the specified columns. May be NULL if qmatspace is zero.
qmatspace
An integer indicating the length of the arrays qmatind and qmatval. May be zero.
surplus_p
A pointer to an integer to contain the difference between qmatspace and the number of entries in each of the arrays qmatind and qmatval. A nonnegative value of *surplus_p indicates that the length of the arrays was sufficient. A negative value indicates that the length was insufficient and that the routine could not complete its task. In this case, CPXXgetquad/CPXgetquad returns the value CPXERR_NEGATIVE_SURPLUS, and the negative value of *surplus_p indicates the amount of insufficient space in the arrays.
begin
An integer indicating the beginning of the range of columns to be returned.
end
An integer indicating the end of the range of columns to be returned.

Return

The routine returns zero if successful and nonzero if an error occurs. The value CPXERR_NEGATIVE_SURPLUS indicates that insufficient space was available in the arrays qmatind and qmatval to hold the nonzero coefficients.

Example


 status = CPXgetquad (env, lp, &nzcnt, qmatbeg, qmatind,
                      qmatval, qmatspace, &surplus, 0,
                      cur_numquad-1);