16 template <
int NumRows,
int NumCols,
typename Real>
38 Matrix(std::initializer_list<Real> values);
54 inline Real
const&
operator()(
int r,
int c)
const;
92 inline Real
const&
operator()(
int r,
int c)
const;
100 #if defined(GTE_USE_ROW_MAJOR) 101 std::array<std::array<Real,NumCols>,NumRows>
mStorage;
103 std::array<std::array<Real,NumRows>,NumCols>
mStorage;
111 template <
int NumRows,
int NumCols,
typename Real>
115 template <
int NumRows,
int NumCols,
typename Real>
120 template <
int NumRows,
int NumCols,
typename Real>
126 template <
int NumRows,
int NumCols,
typename Real>
132 template <
int NumRows,
int NumCols,
typename Real>
136 template <
int NumRows,
int NumCols,
typename Real>
140 template <
int NumRows,
int NumCols,
typename Real>
144 template <
int NumRows,
int NumCols,
typename Real>
150 template <
int NumRows,
int NumCols,
typename Real>
156 template <
int NumRows,
int NumCols,
typename Real>
160 template <
int NumRows,
int NumCols,
typename Real>
165 template <
int NumRows,
int NumCols,
typename Real>
168 template <
int NumRows,
int NumCols,
typename Real>
171 template <
int NumRows,
int NumCols,
typename Real>
174 template <
int N,
typename Real>
176 bool* reportInvertibility =
nullptr);
178 template <
int N,
typename Real>
182 template <
int NumRows,
int NumCols,
typename Real>
187 template <
int NumRows,
int NumCols,
typename Real>
194 template <
int NumRows,
int NumCols,
typename Real>
201 template <
int NumRows,
int NumCols,
int NumCommon,
typename Real>
207 template <
int NumRows,
int NumCols,
int NumCommon,
typename Real>
214 template <
int NumRows,
int NumCols,
int NumCommon,
typename Real>
221 template <
int NumRows,
int NumCols,
int NumCommon,
typename Real>
228 template <
int NumRows,
int NumCols,
int NumCommon,
typename Real>
235 template <
int NumRows,
int NumCols,
typename Real>
242 template <
int NumRows,
int NumCols,
typename Real>
249 template <
int NumRows,
int NumCols,
typename Real>
255 template <
int N,
typename Real>
261 template <
int N,
typename Real>
265 template <
int N,
typename Real>
269 template <
int NumRows,
int NumCols,
typename Real>
275 template <
int NumRows,
int NumCols,
typename Real>
277 std::array<Real, NumRows*NumCols>
const&
values)
279 for (
int r = 0, i = 0;
r < NumRows; ++
r)
281 for (
int c = 0;
c < NumCols; ++
c, ++i)
288 template <
int NumRows,
int NumCols,
typename Real>
291 int const numValues =
static_cast<int>(values.size());
292 auto iter = values.begin();
294 for (r = 0, i = 0; r < NumRows; ++
r)
296 for (c = 0; c < NumCols; ++
c, ++i)
311 for (; c < NumCols; ++
c)
323 for (; r < NumRows; ++
r)
325 for (c = 0; c < NumCols; ++
c)
333 template <
int NumRows,
int NumCols,
typename Real>
339 template <
int NumRows,
int NumCols,
typename Real>
inline 345 template <
int NumRows,
int NumCols,
typename Real>
inline 351 template <
int NumRows,
int NumCols,
typename Real>
355 for (
int c = 0;
c < NumCols; ++
c)
361 template <
int NumRows,
int NumCols,
typename Real>
365 for (
int r = 0;
r < NumRows; ++
r)
371 template <
int NumRows,
int NumCols,
typename Real>
375 for (
int c = 0;
c < NumCols; ++
c)
382 template <
int NumRows,
int NumCols,
typename Real>
386 for (
int r = 0;
r < NumRows; ++
r)
393 template <
int NumRows,
int NumCols,
typename Real>
inline 399 template <
int NumRows,
int NumCols,
typename Real>
inline 405 template <
int NumRows,
int NumCols,
typename Real>
inline 411 template <
int NumRows,
int NumCols,
typename Real>
inline 417 template <
int NumRows,
int NumCols,
typename Real>
inline 423 template <
int NumRows,
int NumCols,
typename Real>
inline 429 template <
int NumRows,
int NumCols,
typename Real>
inline 435 template <
int NumRows,
int NumCols,
typename Real>
inline 441 template <
int NumRows,
int NumCols,
typename Real>
444 Real
const zero = (Real)0;
445 for (
int i = 0; i < NumRows * NumCols; ++i)
451 template <
int NumRows,
int NumCols,
typename Real>
455 if (0 <= r && r < NumRows && 0 <= c && c < NumCols)
461 template <
int NumRows,
int NumCols,
typename Real>
465 int const numDiagonal = (NumRows <= NumCols ? NumRows : NumCols);
466 for (
int i = 0; i < numDiagonal; ++i)
472 template <
int NumRows,
int NumCols,
typename Real>
480 template <
int NumRows,
int NumCols,
typename Real>
489 template <
int NumRows,
int NumCols,
typename Real>
499 template <
int NumRows,
int NumCols,
typename Real>
506 template <
int NumRows,
int NumCols,
typename Real>
511 for (
int i = 0; i < NumRows*NumCols; ++i)
518 template <
int NumRows,
int NumCols,
typename Real>
528 template <
int NumRows,
int NumCols,
typename Real>
538 template <
int NumRows,
int NumCols,
typename Real>
543 return result *= scalar;
546 template <
int NumRows,
int NumCols,
typename Real>
551 return result *= scalar;
554 template <
int NumRows,
int NumCols,
typename Real>
559 return result /= scalar;
562 template <
int NumRows,
int NumCols,
typename Real>
568 for (
int i = 0; i < NumRows*NumCols; ++i)
575 template <
int NumRows,
int NumCols,
typename Real>
581 for (
int i = 0; i < NumRows*NumCols; ++i)
588 template <
int NumRows,
int NumCols,
typename Real>
592 for (
int i = 0; i < NumRows*NumCols; ++i)
599 template <
int NumRows,
int NumCols,
typename Real>
603 if (scalar != (Real)0)
605 Real invScalar = ((Real)1) / scalar;
606 for (
int i = 0; i < NumRows*NumCols; ++i)
613 for (
int i = 0; i < NumRows*NumCols; ++i)
621 template <
int NumRows,
int NumCols,
typename Real>
625 for (
int i = 1; i < NumRows*NumCols; ++i)
632 template <
int NumRows,
int NumCols,
typename Real>
635 Real sum = M[0] * M[0];
636 for (
int i = 1; i < NumRows*NumCols; ++i)
643 template <
int NumRows,
int NumCols,
typename Real>
646 Real maxAbsElement = M[0];
647 for (
int i = 1; i < NumRows*NumCols; ++i)
650 if (absElement > maxAbsElement)
652 maxAbsElement = absElement;
655 return maxAbsElement;
658 template <
int N,
typename Real>
660 bool* reportInvertibility)
665 determinant,
nullptr,
nullptr,
nullptr, 0,
nullptr);
666 if (reportInvertibility)
668 *reportInvertibility = invertible;
673 template <
int N,
typename Real>
678 nullptr,
nullptr, 0,
nullptr);
682 template <
int NumRows,
int NumCols,
typename Real>
687 for (
int r = 0;
r < NumRows; ++
r)
689 for (
int c = 0;
c < NumCols; ++
c)
697 template <
int NumRows,
int NumCols,
typename Real>
704 for (
int r = 0;
r < NumRows; ++
r)
707 for (
int c = 0;
c < NumCols; ++
c)
709 result[
r] += M(
r,
c) * V[
c];
715 template <
int NumRows,
int NumCols,
typename Real>
720 for (
int c = 0;
c < NumCols; ++
c)
723 for (
int r = 0;
r < NumRows; ++
r)
725 result[
c] += V[
r] * M(
r,
c);
731 template <
int NumRows,
int NumCols,
int NumCommon,
typename Real>
740 template <
int NumRows,
int NumCols,
int NumCommon,
typename Real>
747 for (
int r = 0;
r < NumRows; ++
r)
749 for (
int c = 0;
c < NumCols; ++
c)
752 for (
int i = 0; i < NumCommon; ++i)
761 template <
int NumRows,
int NumCols,
int NumCommon,
typename Real>
768 for (
int r = 0;
r < NumRows; ++
r)
770 for (
int c = 0;
c < NumCols; ++
c)
773 for (
int i = 0; i < NumCommon; ++i)
782 template <
int NumRows,
int NumCols,
int NumCommon,
typename Real>
789 for (
int r = 0;
r < NumRows; ++
r)
791 for (
int c = 0;
c < NumCols; ++
c)
794 for (
int i = 0; i < NumCommon; ++i)
803 template <
int NumRows,
int NumCols,
int NumCommon,
typename Real>
810 for (
int r = 0;
r < NumRows; ++
r)
812 for (
int c = 0;
c < NumCols; ++
c)
815 for (
int i = 0; i < NumCommon; ++i)
824 template <
int NumRows,
int NumCols,
typename Real>
831 for (
int r = 0;
r < NumRows; ++
r)
833 for (
int c = 0;
c < NumCols; ++
c)
841 template <
int NumRows,
int NumCols,
typename Real>
848 for (
int r = 0;
r < NumRows; ++
r)
850 for (
int c = 0;
c < NumCols; ++
c)
858 template <
int NumRows,
int NumCols,
typename Real>
863 for (
int r = 0;
r < NumRows; ++
r)
865 for (
int c = 0;
c < NumCols; ++
c)
873 template <
int N,
typename Real>
876 for (
int i = 0; i < N*N; ++i)
881 for (
int i = 0; i < N; ++i)
887 template <
int N,
typename Real>
892 for (
int r = 0;
r < N; ++
r)
894 for (
int c = 0;
c < N; ++
c)
903 template <
int N,
typename Real>
906 static_assert(N >= 2,
"Invalid matrix dimension.");
908 for (
int r = 0;
r < N - 1; ++
r)
910 for (
int c = 0;
c < N - 1; ++
c)
921 template <
int NumRows,
int NumCols,
typename Real>
inline 925 #if defined(GTE_USE_ROW_MAJOR) 932 template <
int NumRows,
int NumCols,
typename Real>
inline 935 #if defined(GTE_USE_ROW_MAJOR) 942 template <
int NumRows,
int NumCols,
typename Real>
inline 945 Real
const* elements = &
mStorage[0][0];
949 template <
int NumRows,
int NumCols,
typename Real>
inline
bool operator<=(Matrix const &mat) const
Vector< NumRows, Real > GetCol(int c) const
gte::BSNumber< UIntegerType > abs(gte::BSNumber< UIntegerType > const &number)
bool operator!=(Matrix const &mat) const
DualQuaternion< Real > & operator*=(DualQuaternion< Real > &d, Real scalar)
void MakeDiagonal(GVector< Real > const &D, GMatrix< Real > &M)
GMatrix< Real > MultiplyMD(GMatrix< Real > const &M, GVector< Real > const &D)
Real const & operator[](int i) const
bool operator>=(Matrix const &mat) const
GLenum GLsizei GLsizei GLint * values
GMatrix< Real > MultiplyATB(GMatrix< Real > const &A, GMatrix< Real > const &B)
bool operator==(Matrix const &mat) const
Real const & operator[](int i) const
GMatrix< Real > Transpose(GMatrix< Real > const &M)
GVector< Real > HLift(GVector< Real > const &v, Real last)
DualQuaternion< Real > operator+(DualQuaternion< Real > const &d)
GVector< Real > HProject(GVector< Real > const &v)
Vector< NumCols, Real > GetRow(int r) const
std::array< std::array< Real, NumRows >, NumCols > mStorage
DualQuaternion< Real > & operator-=(DualQuaternion< Real > &d0, DualQuaternion< Real > const &d1)
void SetCol(int c, Vector< NumRows, Real > const &vec)
bool operator>(Matrix const &mat) const
GMatrix< Real > MultiplyAB(GMatrix< Real > const &A, GMatrix< Real > const &B)
bool operator<(Matrix const &mat) const
Real const & operator()(int r, int c) const
static Matrix Unit(int r, int c)
GMatrix< Real > MultiplyATBT(GMatrix< Real > const &A, GMatrix< Real > const &B)
Real LInfinityNorm(GMatrix< Real > const &M)
void SetRow(int r, Vector< NumCols, Real > const &vec)
GMatrix< Real > MultiplyABT(GMatrix< Real > const &A, GMatrix< Real > const &B)
DualQuaternion< Real > operator-(DualQuaternion< Real > const &d)
DualQuaternion< Real > & operator+=(DualQuaternion< Real > &d0, DualQuaternion< Real > const &d1)
Quaternion< Real > Inverse(Quaternion< Real > const &d)
Real L2Norm(GMatrix< Real > const &M)
Real Determinant(GMatrix< Real > const &M)
DualQuaternion< Real > & operator/=(DualQuaternion< Real > &d, Real scalar)
Vector4< float > operator*(Transform const &M, Vector4< float > const &V)
Real const & operator()(int r, int c) const
void MakeUnit(int r, int c)
GMatrix< Real > OuterProduct(GVector< Real > const &U, GVector< Real > const &V)
Real L1Norm(GMatrix< Real > const &M)
DualQuaternion< Real > operator/(DualQuaternion< Real > const &d, Real scalar)
GMatrix< Real > MultiplyDM(GVector< Real > const &D, GMatrix< Real > const &M)