Maybe use proxies, that are a light-weight view of what is in the matrix?
http://www.boost.org/doc/libs/1_47_0/libs/numeric/ublas/doc/matrix_proxy.htm
example:
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/matrix_proxy.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
matrix<double> m (3, 3);
for (unsigned i = 0; i < m.size1 (); ++ i) {
matrix_row<matrix<double> > mr (m, i);
for (unsigned j = 0; j < mr.size (); ++ j)
mr (j) = 3 * i + j;
std::cout << mr << std::endl;
}
}
Hi. I'd like to have a matrix<T> stored in such a way that I can quickly use each row (or else column) as a vector<T>. Seeing the vector_of_vector matrix type, at least the name suggests that this is what I need, but I suspect this is not so
because I can't get it to do that. Does anyone have a hint on how to extract an entire row of a matrix into a vector as efficiently as possible?
Thanks
_______________________________________________
ublas mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/ublas
Sent to: [hidden email]
_______________________________________________
ublas mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/ublasSent to:
[hidden email]