Sergey Sergey - 1 year ago 80
C++ Question

Does Boost provide a facility for printing uBLAS datatypes?

I'm debugging an application that massively uses uBLAS vectors and matrices. I would like to print them to console with something like:

boost::numeric::ublas::vector<double> v;
// ...filling v...
std::cout << v; // or boost::whatever << v;

Exact output format does dot matter, I just want to look at the vector contents. Does Boost provide such an overload of
with uBLAS types? Any other short way of printing uBLAS types would be OK too. It's not a big effort to write these functions by myself, but I'm looking for a "standard" technique to do it, if any.

Answer Source

boost/numeric/ublas/io.hpp defines operator<< for uBlas components.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download