get_row

Get all row elements from the matrix.

unsigned char get_row(lprec *lp, int row_nr, REAL *row);

Return Value

get_row returns TRUE (1) if the operation was successful. A return value of FALSE (0) indicates an error.
An error occurs when row_nr is not between 0 and the number of rows in the lp.
Note that row entry mode must be off, else this function also fails. See set_add_rowmode

Parameters

lp

Pointer to previously created lp model. See return value of make_lp, read_lp, read_LP, read_lpt, read_LPT, read_mps, read_freemps, read_MPS, read_freeMPS, read_XLI

row_nr

Row number of the matrix. Must be between 0 and number of rows in the lp. Row 0 is objective function.

row

Array in which the values are returned. The array must be dimensioned with at least 1 plus number of columns elements in the lp.

Remarks

This function retrieves all values for the given row.
Element 0 of the row array is not filled. Element 1 will contain the value for column 1, Element 2 the value for column 2, ...

Example

#include <stdio.h>
#include <stdlib.h>
#include "lp_lib.h"

int main(void)
{
  lprec *lp;
  REAL row[1+2]; /* must be 1 greater than number of columns ! */

  /* Create a new LP model */
  lp = make_lp(1, 2);
  if(lp == NULL) {
    fprintf(stderr, "Unable to create new LP model\n");
    return(1);
  }

  get_row(lp, 1, row);

  delete_lp(lp);
  return(0);
}

lp_solve API reference

See Also make_lp, read_lp, read_LP, read_lpt, read_LPT, read_mps, read_freemps, read_MPS, read_freeMPS, read_XLI, get_mat, get_column, set_rh, set_rh_vec, str_set_rh_vec, add_constraint, add_constraintex, str_add_constraint, add_column, add_columnex, str_add_column