XSLPgetccoef
XSLPgetccoef |
Purpose
Retrieve a single matrix coefficient as a formula in a character string
Synopsis
int XPRS_CC XSLPgetccoef(XSLPprob Prob, int RowIndex, int ColIndex, double *Factor, char *Formula, int fLen);
Arguments
Prob
|
The current SLP problem.
|
RowIndex
|
Integer holding the row index for the coefficient.
|
ColIndex
|
Integer holding the column index for the coefficient.
|
Factor
|
Address of a double precision variable to receive the value of the constant factor multiplying the formula in the coefficient.
|
Formula
|
Character buffer in which the formula will be placed in the same format as used for input from a file. The formula will be null terminated.
|
fLen
|
Maximum length of returned formula.
|
Return value
0
|
Normal return.
|
1
|
Formula is too long for the buffer and has been truncated.
|
other
|
Error.
|
Example
The following example displays the formula for the coefficient in row 2, column 3:
char Buffer[60]; double Factor; int Code; Code = XSLPgetccoef(Prob, 2, 3, &Factor, Buffer, 60); switch (Code) { case 0: printf("\nFormula is %s",Buffer); printf("\nFactor = %lg",Factor); break; case 1: printf("\nFormula is too long for the buffer"); break; default: printf("\nError accessing coefficient"); break; }
Further information
If the requested coefficient is constant, then Factor will be set to 1.0 and the value will be formatted in Formula.
If the length of the formula would exceed fLen-1, the formula is truncated to the last token that will fit, and the (partial) formula is terminated with a null character.
Related topics