#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 ublas@lists.boost.org https://listarchives.boost.org/mailman/listinfo.cgi/ublas Sent to: athanasios.iliopoulos.ctr.gr@nrl.navy.mil