Hi Riccardo,
 
  This follows straight from the ublas docs and examples therein..here's a snippet that may help:
 
for(itm1 i1 = A.begin1(); i1 != A.end1(); ++i1) {
   int nnz = 0;
   itm2 i2 = i1.begin();
   irow = (int) i2.index1();
   //Loop over each row's non-zero elements
   for(; i2 != i1.end(); ++i2) {
       (m_cols)[nnz] = (int) i2.index2();
       (m_vals)[nnz] = *i2;
       ++nnz;
   }
   //-Some treatment of zero rows...
   if( nnz == 0 ) {
       (m_cols)[nnz] = irow;
       (m_vals)[nnz] = -1.0;
       ++nnz;
   }
   //-Do other stuff...blah blah
}
 
--Thomas.


On Mon, Feb 7, 2011 at 10:13 AM, <rrossi@cimne.upc.edu> wrote:

Dear list,

              i created a mapped_matrix and now i need to iterate over the non_zero elements of SOME rows.

say i need all of the elements of row 123... how should i get them?

 

thanks in advance

Riccardo


_______________________________________________
ublas mailing list
ublas@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/ublas
Sent to: sgthomas27@gmail.com