00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef MTL_PRINT_VECTOR_INCLUDE
00013 #define MTL_PRINT_VECTOR_INCLUDE
00014
00015 #include <iostream>
00016 #include <boost/numeric/mtl/utility/is_row_major.hpp>
00017 #include <boost/numeric/mtl/concept/collection.hpp>
00018
00019 namespace mtl { namespace vector {
00020
00021 template <typename Vector>
00022 std::ostream& print_vector(Vector const& vector, std::ostream& out= std::cout, int width= 0, int precision= 0)
00023 {
00024 out << '{' << size(vector)
00025 << (traits::is_row_major< typename OrientedCollection<Vector>::orientation >::value ? "R" : "C")
00026 << "}[" ;
00027 for (size_t r = 0; r < size(vector); ++r) {
00028 out.fill (' ');
00029 if (width)
00030 out.width (width);
00031
00032 if (precision)
00033 out.precision(precision);
00034 out << vector[r] << (r < size(vector) - 1 ? "," : "]");
00035 }
00036 return out;
00037 }
00038
00039 }}
00040
00041 #endif // MTL_PRINT_VECTOR_INCLUDE