How to get an iterator in boost :: numeric :: ublas :: matrix <T> line?

I am working on matrix multiplication and I would like an iterator one row at a time to increment the matrix? It can be done?

Currently I have to get the iterator and advance it. Seems like too much CPU work / not optimized ...

boost::numeric::ublas::matrix<T> aMatrix(2048, 4096);
typename boost::numeric::ublas::unbounded_array<T>::iterator it;
it = aMatrix.data().begin();
offset = row * aMatrix.size2();
advance(it, offset);

      

+3


source to share


1 answer


Eureka! Matrix proxies ...



boost::numeric::ublas::matrix_row<boost::numeric::ublas::matrix<T> > aRow(aMatrix, row);

      

+4


source







All Articles