Add DebugPrint to Matrix.

This commit is contained in:
vng 2012-10-04 14:21:39 +03:00 committed by Alex Zolotarev
parent be22da030f
commit f65cafdf68
2 changed files with 21 additions and 2 deletions

View file

@ -71,7 +71,7 @@ namespace my
s << " " << m_names[level];
double const sec = m_timer.ElapsedSeconds();
s << " " << std::setfill(' ') << std::setw(16 - m_lens[level]) << sec << " ";
s << " " << setfill(' ') << setw(16 - m_lens[level]) << sec << " ";
}
};

View file

@ -2,6 +2,9 @@
#include "math.hpp"
#include "../std/iomanip.hpp"
namespace math
{
template <typename T, unsigned Rows, unsigned Cols>
@ -9,7 +12,7 @@ namespace math
{
T m_data[Rows * Cols];
Matrix(){};
Matrix() {}
template <typename U>
Matrix(Matrix<U, Rows, Cols> const & src)
@ -168,4 +171,20 @@ namespace math
}
return res;
}
template <typename T, unsigned M, unsigned N> string DebugPrint(Matrix<T, M, N> const & m)
{
ostringstream ss;
ss << ":" << endl;
for (unsigned i = 0; i < M; ++i)
{
for (unsigned j = 0; j < N; ++j)
ss << setfill(' ') << setw(10) << m(i, j) << " ";
ss << endl;
}
return ss.str();
}
}