我正在研究矩阵乘法,我想要一个遍历 boost 矩阵单行的迭代器?这能做到吗?
目前,我必须获得一个迭代器并推进它。似乎 CPU 工作太多/未优化...
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);
关于c++ - 如何让迭代器指向 boost::numeric::ublas::matrix<T> 的一行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9861271/