Ok. I've looked at it. And where is the problem ? I think I've not fully understood what do you want
to know.

One method of iteration through all the elements of a matrix is the one I have explained before
(it is the more direct method, if you do not concern about the "scanning order" of the elements).

The other method is the one shown into the example you suggested. In this case, the author
uses the uBLAS iterators, that allow to you to selectively iterate along columns (iterator1) and
along rows (iterator2). Furthermore, during the scanning, you can exchange the kind of the
iterator you are using simply calling the begin() method of the iterator itself. This method (and its
twin end() method) gives to you the starting iterator (or "past-the-end" iterator, in the case of the
end() method) in the other direction, starting from the element into which you are arrived. So, you
potentially can do a zig-zag path throug the matrix, if you continue to call the begin() method to
switch the iterator you are using.

All this stuff is also explained into the official uBLAS documentation (although I should admit that
the "double nature of an uBLAS iterator" is not sufficiently stressed).

On 8/25/07, Nuno Sucena Almeida <slug@aeminium.org> wrote:

Look at the Gunter Winkler sparse_io for example, you can use iterators:

http://www.guwi17.de/ublas/examples/sparse_io.cpp

                                        Nuno

On Fri, Aug 24, 2007 at 07:17:13AM -0400, Neal Becker wrote:
| Simple question.  How do I iterate over all elements of a matrix?

--
http://aeminium.org/slug
D30B 54C0 40A7 7D61 C44F  4BA4 F071 2168 F494 ACB9
_______________________________________________
ublas mailing list
ublas@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/ublas