forked from organicmaps/organicmaps
Add DebugPrint to Matrix.
This commit is contained in:
parent
be22da030f
commit
f65cafdf68
2 changed files with 21 additions and 2 deletions
|
@ -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 << " ";
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue