|
Ublas : |
From: Vento Neicapelli (lascoscazzato_at_[hidden])
Date: 2005-01-19 12:54:31
Dear uBlas users,
I start evaluating uBlas lib. Who know how to get the nonzero elements of a
sparse_matrix (or compressed_matrix)? Is there an iterator?
suppose you have this simple code:
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/matrix_sparse.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
sparse_matrix<double> m (30, 30);
//fill the matrix diagonal...
for (unsigned i = 0; i < m.size1 (); i++)
m(i,i) = 2*i+1;
.....
// how to print only the non zero (on the diagonal)?
}
many Tnx!
lasco
_________________________________________________________________
Don't just search. Find. Check out the new MSN Search!
http://search.msn.com/