Thats from my code. But I remember spending several hours
reading their web pages on sparse matrices before I could figure
out how to use it.
 
I cannot remember the link.. you can try googling it. But I do
admit that boost docs are very difficult to find and obscure in
terms of examples. Maybe it is better now.

You can try this for example:
http://www.boost.org/doc/libs/1_45_0/libs/numeric/ublas/doc/matrix_sparse.htm
http://www.guwi17.de/ublas/examples/



--Thomas.

On Mon, Feb 7, 2011 at 11:40 PM, Riccardo Rossi <rrossi@cimne.upc.edu> wrote:

Hello Thomas,
   thank you for the snippet but...where did u take it from? i was
looking for the documentation but i could not find it. Could u pass me
the pointer for the future?

thanks
Riccardo



On Mon, 2011-02-07 at 17:51 -0800, Sunil Thomas wrote:
> 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
>
> _______________________________________________
> ublas mailing list
> ublas@lists.boost.org
> http://lists.boost.org/mailman/listinfo.cgi/ublas
> Sent to: rrossi@cimne.upc.edu

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