Previous Page: CPXgetcolnameFirst PageNext Page: CPXgetcovcnt

CPXgetcols


Description

The routine CPXgetcols() is used to access a range of columns of the constraint matrix of an LP problem object. 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.

Return Value

The routine returns a zero on success, and a nonzero if an error occurs. The value CPXERR_NEGATIVE_SURPLUS indicates that insufficient space was available in the cmatind and cmatval arrays to hold the nonzero coefficients.

Synopsis

int CPXgetcols (CPXENVptr env,
                CPXLPptr lp,
                int *nzcnt_p,
                int *cmatbeg,
                int *cmatind,
                double *cmatval,
                int cmatspace,
                int *surplus_p,
                int begin,
                int end);

Arguments


CPXENVptr env
The pointer to the CPLEX environment as returned by one of the CPXopenCPLEX routines.

CPXLPptr lp
A pointer to a CPLEX LP problem object as returned by CPXcreateprob().

int *nzcnt_p
A pointer to an integer that will contain the number of nonzeros returned; i.e., the true length of the arrays cmatind and cmatval.

int *cmatbeg
An array that will contain indices indicating where each of the requested columns begins in the arrays cmatval and cmatind. Specifically, column j consists of the entries in cmatval and cmatind in the range from cmatbeg[j - begin] tocmatbeg[(j + 1) - begin]-1. (Column end consists of the entries from cmatbeg[end - begin] to nzcnt_p-1.) This array must be of length at least(end - begin + 1).

int *cmatind
An array that will contain the row indices associated with the elements of cmatval. cmatind may be NULL if cmatspace is 0.

double *cmatval
An array that will contain the nonzero coefficients of the specified columns. cmatval may be NULL if cmatspace is 0.

int cmatspace
An integer indicating the length of the arrays cmatind and cmatval. cmatspace may be 0.

int *surplus_p
A pointer to an integer that will contain the difference between cmatspace and the number of entries in each of the arrays cmatind and cmatval. A non-negative 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, CPXgetcols() returns the value CPXERR_NEGATIVE_SURPLUS, and the negative value of *surplus_p indicates the amount of insufficient space in the arrays.

If the value of cmatspace is 0 then the negative of the value of *surplus_p returned indicates the length needed for the arrays cmatind and cmatval.

int begin
An integer indicating the beginning of the range of columns to be returned.

int end
An integer indicating the end of the range of columns to be returned.

Example

status = CPXgetcols (env, lp, &nzcnt, cmatbeg, cmatind,
                     cmatval, cmatspace, &surplus, 0,
                     cur_numcols-1);

Previous Page: CPXgetcolnameFirst PageNext Page: CPXgetcovcnt