All Classes Files Functions Variables Typedefs Pages
Matrix.hpp
1 #pragma once
2 
3 #include "MatrixCore.hpp"
4 #include "RepCommon.hpp"
5 
6 #include <string>
7 #include <sstream>
8 #include <ostream>
9 
10 namespace lumina {
11 namespace internal {
12 
13 template <typename T, std::size_t Z, std::size_t S>
14 std::string matrixRep(const Matrix<T, Z, S>& m) {
15  std::stringstream ss;
16  ss << "Matrix<" << Z << "x" << S << ">"
17  << internal::typeCharRep<T>() << " {";
18 
19  for(int i = 0; i < Z; ++i) {
20  if(i != 0) {
21  ss << ", ";
22  }
23  ss <<"{";
24 
25  for(int j = 0; j < S; ++j) {
26  if(j != 0) {
27  ss <<", ";
28  }
29  ss << internal::numberToRep(m.data[i][j]);
30  }
31 
32  ss << "}";
33  }
34 
35  ss << "}";
36  return ss.str();
37 }
38 
39 } // namespace internal
40 
41 template <typename T, std::size_t Z, std::size_t S>
42 std::ostream& operator<<(std::ostream& out, const Matrix<T, Z, S>& m) {
43  return (out << matrixRep(m));
44 }
45 
46 } // namespace lumina
This file is part of the Lumina Graphics Framework.