5#include <Common/assertion.h>
12template<
typename Derived,
typename T, std::
size_t M, std::
size_t N>
18template<
typename Derived,
typename T, std::
size_t M, std::
size_t N>
20 m(
std::move(elements))
23template<
typename Derived,
typename T, std::
size_t M, std::
size_t N>
29template<
typename Derived,
typename T, std::
size_t M, std::
size_t N>
35template<
typename Derived,
typename T, std::
size_t M, std::
size_t N>
39 return Derived(
static_cast<const Derived&
>(*
this)).mulLocal(constantValue);
42template<
typename Derived,
typename T, std::
size_t M, std::
size_t N>
46 for(std::size_t ri = 0; ri < M; ++ri)
48 for(std::size_t ci = 0; ci < N; ++ci)
50 m[ri][ci] *= constantValue;
53 return static_cast<Derived&
>(*this);
56template<
typename Derived,
typename T, std::
size_t M, std::
size_t N>
61 for(std::size_t ri = 0; ri < M; ++ri)
63 T result =
static_cast<T
>(0);
64 for(std::size_t ci = 0; ci < N; ++ci)
66 result += m[ri][ci] * rhsColVector[ci];
73template<
typename Derived,
typename T, std::
size_t M, std::
size_t N>
74template<std::
size_t K>
77 PH_ASSERT(out_result);
79 for(std::size_t mi = 0; mi < M; ++mi)
81 for(std::size_t ki = 0; ki < K; ++ki)
83 T result =
static_cast<T
>(0);
84 for(std::size_t ni = 0; ni < N; ++ni)
86 result += m[mi][ni] * rhsMatrix[ni][ki];
88 (*out_result)[mi][ki] = result;
93template<
typename Derived,
typename T, std::
size_t M, std::
size_t N>
94template<std::
size_t K>
97 PH_ASSERT(out_result);
99 for(std::size_t mi = 0; mi < M; ++mi)
101 for(std::size_t ki = 0; ki < K; ++ki)
103 T result =
static_cast<T
>(0);
104 for(std::size_t ni = 0; ni < N; ++ni)
106 result += m[mi][ni] * rhsMatrix[ki][ni];
108 (*out_result)[mi][ki] = result;
113template<
typename Derived,
typename T, std::
size_t M, std::
size_t N>
118 for(std::size_t ri = 0; ri < M; ++ri)
120 for(std::size_t ci = 0; ci < N; ++ci)
122 result[ci][ri] = m[ri][ci];
128template<
typename Derived,
typename T, std::
size_t M, std::
size_t N>
132 for(std::size_t ri = 0; ri < M; ++ri)
134 m[ri].fill(constantValue);
136 return static_cast<Derived&
>(*this);
139template<
typename Derived,
typename T, std::
size_t M, std::
size_t N>
143 PH_ASSERT_LT(rowIndex, M);
148template<
typename Derived,
typename T, std::
size_t M, std::
size_t N>
152 PH_ASSERT_LT(rowIndex, M);
157template<
typename Derived,
typename T, std::
size_t M, std::
size_t N>
160 std::string result =
"\n";
161 for(std::size_t ri = 0; ri < M; ++ri)
164 for(std::size_t ci = 0; ci < N; ++ci)
166 result += std::to_string(m[ri][ci]);
167 result += (ci + 1 == N ?
"" :
", ");
void multiplyMatrix(const TRawMatrix< T, N, K > &rhsMatrix, TRawMatrix< T, M, K > *out_result) const
Definition TMatrixMxNBase.ipp:75
Derived mul(T constantValue) const
Definition TMatrixMxNBase.ipp:36
TRawMatrix< T, N, M > transposeMatrix() const
Definition TMatrixMxNBase.ipp:114
Derived & mulLocal(T constantValue)
Definition TMatrixMxNBase.ipp:43
constexpr std::size_t numRows() const noexcept
Definition TMatrixMxNBase.ipp:24
Derived & set(T constantValue)
Definition TMatrixMxNBase.ipp:129
std::string toString() const
Definition TMatrixMxNBase.ipp:158
constexpr std::size_t numCols() const noexcept
Definition TMatrixMxNBase.ipp:30
void multiplyTransposedMatrix(const TRawMatrix< T, K, N > &rhsMatrix, TRawMatrix< T, M, K > *out_result) const
Definition TMatrixMxNBase.ipp:95
TMatrixMxNBase(T elements)
Definition TMatrixMxNBase.ipp:13
TRawColVector< T, M > multiplyVector(const TRawColVector< T, M > &rhsColVector) const
Definition TMatrixMxNBase.ipp:57
TRawMatrix< T, M, N > Elements
Definition TMatrixMxNBase.h:39
TRawRowVector< T, N > & operator[](std::size_t rowIndex)
Definition TMatrixMxNBase.ipp:140
Math functions and utilities.
Definition TransformInfo.h:10
std::array< T, M > TRawColVector
Definition TMatrixMxNBase.h:20
std::array< std::array< T, N >, M > TRawMatrix
Definition TMatrixMxNBase.h:23
std::array< T, N > TRawRowVector
Definition TMatrixMxNBase.h:17