Boost logo

Ublas :

From: Dima Sorkin (dsorkin_at_[hidden])
Date: 2005-12-27 04:54:01

Quoting Gunter Winkler :
> You have to carefully distinguish const_iterators (which iterate over all
> nonzeroes) and mutable iterators (which iterate over all elements). So you
> probably have to use the const iterators to find the nonzeroes and use the
> operator(i,j) to assign the value. This is clearly not optimal, but the only
> way that is currently supported for all matrix types.

To want to clarify it to myself:

All sparse matrice, vector and proxy types:
const_iterator - over nonzeros
iterator - over all elements (including the "dummy" ones)

To pass over all non-zeros in row order:
for(typename M::const_iterator1 it1(M.begin1());
                        it1 != M.end1() ; ++it1){
  for (typename M::const_iterator2 it2(it1.begin());
             it2 != it1.end(); ++it2){

Dense types:
const_iterator and iterator behave the same

Thank you.