3

I'm working on matrix multiplication, and I would like an iterator over a single row of a boost matrix? Can this be done?

Currently, I have to get an iterator and advance it. It seems like too much CPU work / non-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);
Mikhail
  • 7,749
  • 11
  • 62
  • 136
Zak
  • 12,213
  • 21
  • 59
  • 105

1 Answers1

4

Eureka! Matrix proxies...

boost::numeric::ublas::matrix_row<boost::numeric::ublas::matrix<T> > aRow(aMatrix, row);
Zak
  • 12,213
  • 21
  • 59
  • 105