title: c++ - use boost to build and access values in a sparse matrix
body: <p>I have a program that is reading in data in the format:</p>
  
  <pre><code>Row    Column    Value
  1      1         4
  1      3         5
  2      1         6
  ...
  </code></pre>
  
  <p>where the first two columns refer to the indices of a matrix, and the value column contains the value stored at that (row, column) coordinate in a matrix.</p>
  
  <p>If I was to actually construct a 2d array to represent the matrix, it would be very large since my input data is very sparse.  Instead I want to build a sparse matrix representation that will allow me to look up the value corresponding to a (row, column) pair, returning 0 if it is not present.</p>
  
  <p>It seems like boost has a way to do this, but I can not find enough documentation to actually understand how to use it.</p>
  
  <p>I have read through these in depth, but am still not sure how to procede:</p>
  
  <p><a href="http://www.guwi17.de/ublas/doc/html/ex__fill1_8cpp-source.html" rel="nofollow">http://www.guwi17.de/ublas/doc/html/ex__fill1_8cpp-source.html</a>
  <a href="http://www.boost.org/doc/libs/1_39_0/libs/numeric/ublas/doc/matrix_sparse.htm" rel="nofollow">http://www.boost.org/doc/libs/1_39_0/libs/numeric/ublas/doc/matrix_sparse.htm</a></p>
  
  <p>I am a c++ newbie so am unsure of how to use boost to create a sparse matrix from my input data (assuming I already read it in).  I also am having no luck finidng out how to actually return the value pertaining to a (row, column) pair using a boost sparse matrix.  Can anybody point me to some basic examples, or explain how I might do this?</p>
  
  <p>Thank you for any help you can provide. </p>