|
Boost Users : |
From: Alexander Bell (a.bell_at_[hidden])
Date: 2006-05-31 11:18:53
Ed Johnson <ed_at_[hidden]> writes:
> Does anyone know how to recreate this example using the iterators?
try:
using namespace boost::numeric::ublas;
typedef matrix<double> MatType;
MatType m(3,3);
for(MatType::iterator1 i1 = m.begin1(); i1!=m.end1(); ++i1)
for(MatType::iterator2 i2 = i1.begin2(); i2!=i1.end2(); ++i2)
*i2= ... // obviously you cannot assign the iterators here
untested - but the main idea is, that iterator1 accesses each row and iterator2
loops over the columns of the rows - this should work for all models of Matrix
(including sparse matrices)
Good luck,
Alexander.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net