QSopt QSget_rhs QSopt > Callable Library > Function List
  QSopt
  Downloads
  LP Info
  Software
  Problem Formats
  Callable Library
  Overview
Function List
  Rational Solver
  Beta
  Contact Info
Purpose
Copy the right-hand-side values into an array.
Synopsis
int QSget_rhs (QSprob p, double *rhs)
Arguments
p a handle to an initialized problem.
rhs returns the right-hand-side values as an array; this field should point to an array of length at least nrows, the number of rows in the problem.
Returns
A zero value if the function terminated correctly, and a non-zero value if an error occurred.
Description

This function returns the right-hand-side values of the constraints (the b values in the linear system Ax = b) as a dense vector, that is, all coefficients (both zero and non-zero) are returned in the array rhs. The calling function must allocate the memory for the rhs array; it should be of length at least nrows, the number of rows in the problem.

Example
/* p is an initialized QSprob, a handle to an existing LP problem  */

int rval, nrows;
double *rhs;

nrows = QSget_rowcount (p);
rhs = (double *) malloc (nrows * sizeof (double));

rval = QSget_rhs (p, rhs);
if (rval) {
    fprintf (stderr, 
             "Could not get right-hand-side, error code %d\n", rval);
} else {
    printf ("Right-Hand-Side\n");
    for (i = 0; i < nrows; i++) {
        printf ("%f\n", rhs[i]);
    }
}

free (rhs);
 
QSopt | Problem Formats | Downloads Back
Last Updated: November 2003