Thanks a lot Stefan. I am able to use it now!<br><br><div class="gmail_quote">On Thu, Apr 26, 2012 at 3:52 AM, Stefan Vigerske <span dir="ltr">&lt;<a href="mailto:stefan@math.hu-berlin.de" target="_blank">stefan@math.hu-berlin.de</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
the coefficients are stored in sparse format (<a href="http://en.wikipedia.org/wiki/Sparse_matrix" target="_blank">http://en.wikipedia.org/wiki/<u></u>Sparse_matrix</a>) by Clp, i.e., it stores only nonzero elements to save memory space and computing time.<br>


<br>
See <a href="http://www.coin-or.org/Doxygen/Clp/classClpMatrixBase.html" target="_blank">http://www.coin-or.org/<u></u>Doxygen/Clp/<u></u>classClpMatrixBase.html</a> .<br>
If the matrix is row major ordered (CSR) (!isColOrdered()), then getElements() gives you the nonzero coefficients in the matrix, getIndices() gives the column index for each coefficient, getVectorStarts()[i] tells you, at which index in getElements() and getIndices() the information for the i&#39;th row are starting, and getVectorLengths()[i] give you the number of nonzero elements in the i&#39;th row.<br>


<br>
That is,<br>
<br>
for( j = getVectorStarts()[i];<br>
     j &lt; getVectorStarts()[i] + getVectorLengths()[i];<br>
     j++ )<br>
{<br>
  printf(&quot;row %d col %d has coef. %g\n&quot;,<br>
    i, getIndices()[j], getElements()[j]);<br>
}<br>
<br>
should print you all nonzero coeffizients of the i&#39;th row, together with their column index.<br>
<br>
Column major ordered (CSC) matrices are analogeous, getIndices() gives you row indices and getVectorStarts() gives you the positions where columns start in the indices and elements arrays.<br>
<br>
Hope that helps,<br>
Stefan<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
Hi All,<br>
<br>
I read a lp model in mps format model using the readMps command. Then some<br>
constraints are added and deleted during the program run<br>
What methods can I use to obtain coefficients of the constraints present in<br>
the model.  I am finding it difficult to understand the ClpMatrixBase class.<br>
Is there a straight forward way to do so.<br>
something like,<br>
<br>
double* getRowCoefficients(int rowIdx)<br>
<br>
or else, if someone can tell how to use the ClpMatrixBase class to obtain<br>
the coefficients<br>
<br>
Thanks,<br>
Akhil<br>
<br>
<br>
<br>
<br></div></div>
______________________________<u></u>_________________<br>
Clp mailing list<br>
<a href="mailto:Clp@list.coin-or.org" target="_blank">Clp@list.coin-or.org</a><br>
<a href="http://list.coin-or.org/mailman/listinfo/clp" target="_blank">http://list.coin-or.org/<u></u>mailman/listinfo/clp</a><span class="HOEnZb"><font color="#888888"><br>
</font></span></blockquote><span class="HOEnZb"><font color="#888888">
<br>
<br>
-- <br>
Stefan Vigerske<br>
Humboldt University Berlin, Numerical Mathematics<br>
<a href="http://www.math.hu-berlin.de/~stefan" target="_blank">http://www.math.hu-berlin.de/~<u></u>stefan</a><br>
</font></span></blockquote></div><br>