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);
Eureka! Matrix proxies...
boost::numeric::ublas::matrix_row<boost::numeric::ublas::matrix<T> > aRow(aMatrix, row);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With