Search code examples
c++boostboost-ublas

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 operator<< for std::ostream 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.


Solution

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