31 May
2006
31 May
'06
3:18 p.m.
Ed Johnson
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.