GteGMatrix.h
Go to the documentation of this file.
1 // David Eberly, Geometric Tools, Redmond WA 98052
2 // Copyright (c) 1998-2017
3 // Distributed under the Boost Software License, Version 1.0.
4 // http://www.boost.org/LICENSE_1_0.txt
5 // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
6 // File Version: 3.0.1 (2016/08/07)
7 
8 #pragma once
9 
10 #include <Mathematics/GteGVector.h>
12 #include <algorithm>
13 
14 // Uncomment these to test for out-of-range indices and size mismatches.
15 //#define GTE_ASSERT_ON_GMATRIX_INDEX_OUT_OF_RANGE
16 //#define GTE_ASSERT_ON_GMATRIX_SIZE_MISMATCH
17 
18 namespace gte
19 {
20 
21 template <typename Real>
22 class GMatrix
23 {
24 public:
25  // The table is length zero and mNumRows and mNumCols are set to zero.
26  GMatrix();
27 
28  // The table is length numRows*numCols and the elements are initialized
29  // to zero.
30  GMatrix(int numRow, int numCols);
31 
32  // For 0 <= r < numRows and 0 <= c < numCols, element (r,c) is 1 and all
33  // others are 0. If either of r or c is invalid, the zero matrix is
34  // created. This is a convenience for creating the standard Euclidean
35  // basis matrices; see also MakeUnit(int,int) and Unit(int,int).
36  GMatrix(int numRows, int numCols, int r, int c);
37 
38  // The copy constructor, destructor, and assignment operator are generated
39  // by the compiler.
40 
41  // Member access for which the storage representation is transparent. The
42  // matrix entry in row r and column c is A(r,c). The first operator()
43  // returns a const reference rather than a Real value. This supports
44  // writing via standard file operations that require a const pointer to
45  // data.
46  void SetSize(int numRows, int numCols);
47  inline void GetSize(int& numRows, int& numCols) const;
48  inline int GetNumRows() const;
49  inline int GetNumCols() const;
50  inline int GetNumElements() const;
51  inline Real const& operator()(int r, int c) const;
52  inline Real& operator()(int r, int c);
53 
54  // Member access by rows or by columns. The input vectors must have the
55  // correct number of elements for the matrix size.
56  void SetRow(int r, GVector<Real> const& vec);
57  void SetCol(int c, GVector<Real> const& vec);
58  GVector<Real> GetRow(int r) const;
59  GVector<Real> GetCol(int c) const;
60 
61  // Member access by 1-dimensional index. NOTE: These accessors are
62  // useful for the manipulation of matrix entries when it does not
63  // matter whether storage is row-major or column-major. Do not use
64  // constructs such as M[c+NumCols*r] or M[r+NumRows*c] that expose the
65  // storage convention.
66  inline Real const& operator[](int i) const;
67  inline Real& operator[](int i);
68 
69  // Comparisons for sorted containers and geometric ordering.
70  inline bool operator==(GMatrix const& mat) const;
71  inline bool operator!=(GMatrix const& mat) const;
72  inline bool operator< (GMatrix const& mat) const;
73  inline bool operator<=(GMatrix const& mat) const;
74  inline bool operator> (GMatrix const& mat) const;
75  inline bool operator>=(GMatrix const& mat) const;
76 
77  // Special matrices.
78  void MakeZero(); // All components are 0.
79  void MakeUnit(int r, int c); // Component (r,c) is 1, all others zero.
80  void MakeIdentity(); // Diagonal entries 1, others 0, even when nonsquare
81  static GMatrix Zero(int numRows, int numCols);
82  static GMatrix Unit(int numRows, int numCols, int r, int c);
83  static GMatrix Identity(int numRows, int numCols);
84 
85 protected:
86  // The matrix is stored as a 1-dimensional array. The convention of
87  // row-major or column-major is your choice.
89  std::vector<Real> mElements;
90 };
91 
92 // Unary operations.
93 template <typename Real>
95 
96 template <typename Real>
98 
99 // Linear-algebraic operations.
100 template <typename Real>
101 GMatrix<Real> operator+(GMatrix<Real> const& M0, GMatrix<Real> const& M1);
102 
103 template <typename Real>
104 GMatrix<Real> operator-(GMatrix<Real> const& M0, GMatrix<Real> const& M1);
105 
106 template <typename Real>
107 GMatrix<Real> operator*(GMatrix<Real> const& M, Real scalar);
108 
109 template <typename Real>
110 GMatrix<Real> operator*(Real scalar, GMatrix<Real> const& M);
111 
112 template <typename Real>
113 GMatrix<Real> operator/(GMatrix<Real> const& M, Real scalar);
114 
115 template <typename Real>
117 
118 template <typename Real>
120 
121 template <typename Real>
122 GMatrix<Real>& operator*=(GMatrix<Real>& M, Real scalar);
123 
124 template <typename Real>
125 GMatrix<Real>& operator/=(GMatrix<Real>& M, Real scalar);
126 
127 // Geometric operations.
128 template <typename Real>
129 Real L1Norm(GMatrix<Real> const& M);
130 
131 template <typename Real>
132 Real L2Norm(GMatrix<Real> const& M);
133 
134 template <typename Real>
135 Real LInfinityNorm(GMatrix<Real> const& M);
136 
137 template <typename Real>
139  bool* reportInvertibility = nullptr);
140 
141 template <typename Real>
142 Real Determinant(GMatrix<Real> const& M);
143 
144 // M^T
145 template <typename Real>
147 
148 // M*V
149 template <typename Real>
151 
152 // V^T*M
153 template <typename Real>
155 
156 // A*B
157 template <typename Real>
159 
160 template <typename Real>
162 
163 // A*B^T
164 template <typename Real>
166 
167 // A^T*B
168 template <typename Real>
170 
171 // A^T*B^T
172 template <typename Real>
174 
175 // M*D, D is square diagonal (stored as vector)
176 template <typename Real>
178 
179 // D*M, D is square diagonal (stored as vector)
180 template <typename Real>
182 
183 // U*V^T, U is N-by-1, V is M-by-1, result is N-by-M.
184 template <typename Real>
186 
187 // Initialization to a diagonal matrix whose diagonal entries are the
188 // components of D.
189 template <typename Real>
190 void MakeDiagonal(GVector<Real> const& D, GMatrix<Real>& M);
191 
192 
193 template <typename Real>
195  :
196  mNumRows(0),
197  mNumCols(0)
198 {
199 }
200 
201 template <typename Real>
202 GMatrix<Real>::GMatrix(int numRows, int numCols)
203 {
204  SetSize(numRows, numCols);
205  std::fill(mElements.begin(), mElements.end(), (Real)0);
206 }
207 
208 template <typename Real>
209 GMatrix<Real>::GMatrix(int numRows, int numCols, int r, int c)
210 {
211  SetSize(numRows, numCols);
212  MakeUnit(r, c);
213 }
214 
215 template <typename Real>
216 void GMatrix<Real>::SetSize(int numRows, int numCols)
217 {
218  if (numRows > 0 && numCols > 0)
219  {
220  mNumRows = numRows;
221  mNumCols = numCols;
222  mElements.resize(mNumRows * mNumCols);
223  }
224  else
225  {
226  mNumRows = 0;
227  mNumCols = 0;
228  mElements.clear();
229  }
230 }
231 
232 template <typename Real> inline
233 void GMatrix<Real>::GetSize(int& numRows, int& numCols) const
234 {
235  numRows = mNumRows;
236  numCols = mNumCols;
237 }
238 
239 template <typename Real> inline
241 {
242  return mNumRows;
243 }
244 
245 template <typename Real> inline
247 {
248  return mNumCols;
249 }
250 
251 template <typename Real> inline
253 {
254  return static_cast<int>(mElements.size());
255 }
256 
257 template <typename Real> inline
258 Real const& GMatrix<Real>::operator()(int r, int c) const
259 {
260 #if defined(GTE_ASSERT_ON_GMATRIX_INDEX_OUT_OF_RANGE)
261  LogAssert(0 <= r && r < GetNumRows() && 0 <= c && c < GetNumCols(),
262  "Invalid index.");
263 #endif
264 
265 #if defined(GTE_USE_ROW_MAJOR)
266  return mElements[c + mNumCols*r];
267 #else
268  return mElements[r + mNumRows*c];
269 #endif
270 }
271 
272 template <typename Real> inline
274 {
275 #if defined(GTE_ASSERT_ON_GMATRIX_INDEX_OUT_OF_RANGE)
276  LogAssert(0 <= r && r < GetNumRows() && 0 <= c && c < GetNumCols(),
277  "Invalid index.");
278 #endif
279 
280 #if defined(GTE_USE_ROW_MAJOR)
281  return mElements[c + mNumCols*r];
282 #else
283  return mElements[r + mNumRows*c];
284 #endif
285 }
286 
287 template <typename Real>
288 void GMatrix<Real>::SetRow(int r, GVector<Real> const& vec)
289 {
290 #if defined(GTE_ASSERT_ON_GMATRIX_SIZE_MISMATCH)
291  LogAssert(vec.GetSize() == GetNumCols(), "Mismatched size.");
292 #endif
293  for (int c = 0; c < mNumCols; ++c)
294  {
295  operator()(r, c) = vec[c];
296  }
297 }
298 
299 template <typename Real>
300 void GMatrix<Real>::SetCol(int c, GVector<Real> const& vec)
301 {
302 #if defined(GTE_ASSERT_ON_GMATRIX_SIZE_MISMATCH)
303  LogAssert(vec.GetSize() == GetNumRows(), "Mismatched size.");
304 #endif
305  for (int r = 0; r < mNumRows; ++r)
306  {
307  operator()(r, c) = vec[r];
308  }
309 }
310 
311 template <typename Real>
313 {
314  GVector<Real> vec(mNumCols);
315  for (int c = 0; c < mNumCols; ++c)
316  {
317  vec[c] = operator()(r, c);
318  }
319  return vec;
320 }
321 
322 template <typename Real>
324 {
325  GVector<Real> vec(mNumRows);
326  for (int r = 0; r < mNumRows; ++r)
327  {
328  vec[r] = operator()(r, c);
329  }
330  return vec;
331 }
332 
333 template <typename Real> inline
334 Real const& GMatrix<Real>::operator[](int i) const
335 {
336  return mElements[i];
337 }
338 
339 template <typename Real> inline
341 {
342  return mElements[i];
343 }
344 
345 template <typename Real> inline
346 bool GMatrix<Real>::operator==(GMatrix const& mat) const
347 {
348  return mNumRows == mat.mNumRows && mNumCols == mat.mNumCols
349  && mElements == mat.mElements;
350 }
351 
352 template <typename Real> inline
353 bool GMatrix<Real>::operator!=(GMatrix const& mat) const
354 {
355  return !operator==(mat);
356 }
357 
358 template <typename Real> inline
359 bool GMatrix<Real>::operator<(GMatrix const& mat) const
360 {
361  return mNumRows == mat.mNumRows && mNumCols == mat.mNumCols
362  && mElements < mat.mElements;
363 }
364 
365 template <typename Real> inline
366 bool GMatrix<Real>::operator<=(GMatrix const& mat) const
367 {
368  return mNumRows == mat.mNumRows && mNumCols == mat.mNumCols
369  && mElements <= mat.mElements;
370 }
371 
372 template <typename Real> inline
373 bool GMatrix<Real>::operator>(GMatrix const& mat) const
374 {
375  return mNumRows == mat.mNumRows && mNumCols == mat.mNumCols
376  && mElements > mat.mElements;
377 }
378 
379 template <typename Real> inline
380 bool GMatrix<Real>::operator>=(GMatrix const& mat) const
381 {
382  return mNumRows == mat.mNumRows && mNumCols == mat.mNumCols
383  && mElements >= mat.mElements;
384 }
385 
386 template <typename Real>
388 {
389  std::fill(mElements.begin(), mElements.end(), (Real)0);
390 }
391 
392 template <typename Real>
394 {
395  MakeZero();
396  if (0 <= r && r < mNumRows && 0 <= c && c < mNumCols)
397  {
398  operator()(r, c) = (Real)1;
399  }
400 }
401 
402 template <typename Real>
404 {
405  MakeZero();
406  int const numDiagonal = (mNumRows <= mNumCols ? mNumRows : mNumCols);
407  for (int i = 0; i < numDiagonal; ++i)
408  {
409  operator()(i, i) = (Real)1;
410  }
411 }
412 
413 template <typename Real>
414 GMatrix<Real> GMatrix<Real>::Zero(int numRows, int numCols)
415 {
416  GMatrix<Real> M(numRows, numCols);
417  M.MakeZero();
418  return M;
419 }
420 
421 template <typename Real>
422 GMatrix<Real> GMatrix<Real>::Unit(int numRows, int numCols, int r, int c)
423 {
424  GMatrix<Real> M(numRows, numCols);
425  M.MakeUnit(r, c);
426  return M;
427 }
428 
429 template <typename Real>
430 GMatrix<Real> GMatrix<Real>::Identity(int numRows, int numCols)
431 {
432  GMatrix<Real> M(numRows, numCols);
433  M.MakeIdentity();
434  return M;
435 }
436 
437 
438 
439 template <typename Real>
441 {
442  return M;
443 }
444 
445 template <typename Real>
447 {
449  for (int i = 0; i < M.GetNumElements(); ++i)
450  {
451  result[i] = -M[i];
452  }
453  return result;
454 }
455 
456 template <typename Real>
458 {
459  GMatrix<Real> result = M0;
460  return result += M1;
461 }
462 
463 template <typename Real>
465 {
466  GMatrix<Real> result = M0;
467  return result -= M1;
468 }
469 
470 template <typename Real>
471 GMatrix<Real> operator*(GMatrix<Real> const& M, Real scalar)
472 {
473  GMatrix<Real> result = M;
474  return result *= scalar;
475 }
476 
477 template <typename Real>
478 GMatrix<Real> operator*(Real scalar, GMatrix<Real> const& M)
479 {
480  GMatrix<Real> result = M;
481  return result *= scalar;
482 }
483 
484 template <typename Real>
485 GMatrix<Real> operator/(GMatrix<Real> const& M, Real scalar)
486 {
487  GMatrix<Real> result = M;
488  return result /= scalar;
489 }
490 
491 template <typename Real>
493 {
494 #if defined(GTE_ASSERT_ON_GMATRIX_SIZE_MISMATCH)
495  LogAssert(M0.GetNumRows() == M1.GetNumRows() &&
496  M0.GetNumCols() == M1.GetNumCols(), "Mismatched size.");
497 #endif
498 
499  for (int i = 0; i < M0.GetNumElements(); ++i)
500  {
501  M0[i] += M1[i];
502  }
503  return M0;
504 }
505 
506 template <typename Real>
508 {
509 #if defined(GTE_ASSERT_ON_GMATRIX_SIZE_MISMATCH)
510  LogAssert(M0.GetNumRows() == M1.GetNumRows() &&
511  M0.GetNumCols() == M1.GetNumCols(), "Mismatched size.");
512 #endif
513 
514  for (int i = 0; i < M0.GetNumElements(); ++i)
515  {
516  M0[i] -= M1[i];
517  }
518  return M0;
519 }
520 
521 template <typename Real>
523 {
524  for (int i = 0; i < M.GetNumElements(); ++i)
525  {
526  M[i] *= scalar;
527  }
528  return M;
529 }
530 
531 template <typename Real>
533 {
534  if (scalar != (Real)0)
535  {
536  Real invScalar = ((Real)1) / scalar;
537  for (int i = 0; i < M.GetNumElements(); ++i)
538  {
539  M[i] *= invScalar;
540  }
541  }
542  else
543  {
544  for (int i = 0; i < M.GetNumElements(); ++i)
545  {
546  M[i] = (Real)0;
547  }
548  }
549  return M;
550 }
551 
552 template <typename Real>
553 Real L1Norm(GMatrix<Real> const& M)
554 {
555  Real sum = std::abs(M[0]);
556  for (int i = 1; i < M.GetNumElements(); ++i)
557  {
558  sum += std::abs(M[i]);
559  }
560  return sum;
561 }
562 
563 template <typename Real>
564 Real L2Norm(GMatrix<Real> const& M)
565 {
566  Real sum = M[0] * M[0];
567  for (int i = 1; i < M.GetNumElements(); ++i)
568  {
569  sum += M[i] * M[i];
570  }
571  return sqrt(sum);
572 }
573 
574 template <typename Real>
576 {
577  Real maxAbsElement = M[0];
578  for (int i = 1; i < M.GetNumElements(); ++i)
579  {
580  Real absElement = std::abs(M[i]);
581  if (absElement > maxAbsElement)
582  {
583  maxAbsElement = absElement;
584  }
585  }
586  return maxAbsElement;
587 }
588 
589 template <typename Real>
590 GMatrix<Real> Inverse(GMatrix<Real> const& M, bool* reportInvertibility)
591 {
592  GMatrix<Real> invM(M.GetNumRows(), M.GetNumCols());
593  if (M.GetNumRows() == M.GetNumCols())
594  {
595  Real determinant;
596  bool invertible = GaussianElimination<Real>()(M.GetNumRows(), &M[0],
597  &invM[0], determinant, nullptr, nullptr, nullptr, 0, nullptr);
598  if (reportInvertibility)
599  {
600  *reportInvertibility = invertible;
601  }
602  }
603  else
604  {
605 #if defined(GTE_ASSERT_ON_GMATRIX_SIZE_MISMATCH)
606  LogError("Matrix must be square.");
607 #endif
608  invM.MakeZero();
609  if (reportInvertibility)
610  {
611  *reportInvertibility = false;
612  }
613  }
614  return invM;
615 }
616 
617 template <typename Real>
619 {
620  Real determinant;
621  if (M.GetNumRows() == M.GetNumCols())
622  {
623  GaussianElimination<Real>()(M.GetNumRows(), &M[0], nullptr,
624  determinant, nullptr, nullptr, nullptr, 0, nullptr);
625  }
626  else
627  {
628 #if defined(GTE_ASSERT_ON_GMATRIX_SIZE_MISMATCH)
629  LogError("Matrix must be square.");
630 #endif
631  determinant = (Real)0;
632  }
633  return determinant;
634 }
635 
636 template <typename Real>
638 {
640  for (int r = 0; r < M.GetNumRows(); ++r)
641  {
642  for (int c = 0; c < M.GetNumCols(); ++c)
643  {
644  result(c, r) = M(r, c);
645  }
646  }
647  return result;
648 }
649 
650 template <typename Real>
652 {
653 #if defined(GTE_ASSERT_ON_GMATRIX_SIZE_MISMATCH)
654  LogAssert(V.GetSize() == M.GetNumRows(), "Mismatched size.");
655 #endif
657  for (int r = 0; r < M.GetNumRows(); ++r)
658  {
659  result[r] = (Real)0;
660  for (int c = 0; c < M.GetNumCols(); ++c)
661  {
662  result[r] += M(r, c) * V[c];
663  }
664  }
665  return result;
666 }
667 
668 template <typename Real>
670 {
671 #if defined(GTE_ASSERT_ON_GMATRIX_SIZE_MISMATCH)
672  LogAssert(V.GetSize() == M.GetNumCols(), "Mismatched size.");
673 #endif
675  for (int c = 0; c < M.GetNumCols(); ++c)
676  {
677  result[c] = (Real)0;
678  for (int r = 0; r < M.GetNumRows(); ++r)
679  {
680  result[c] += V[r] * M(r, c);
681  }
682  }
683  return result;
684 }
685 
686 template <typename Real>
688 {
689  return MultiplyAB(A, B);
690 }
691 
692 template <typename Real>
694 {
695 #if defined(GTE_ASSERT_ON_GMATRIX_SIZE_MISMATCH)
696  LogAssert(A.GetNumCols() == B.GetNumRows(), "Mismatched size.");
697 #endif
698  int const numCommon = A.GetNumCols();
700  for (int r = 0; r < result.GetNumRows(); ++r)
701  {
702  for (int c = 0; c < result.GetNumCols(); ++c)
703  {
704  result(r, c) = (Real)0;
705  for (int i = 0; i < numCommon; ++i)
706  {
707  result(r, c) += A(r, i) * B(i, c);
708  }
709  }
710  }
711  return result;
712 }
713 
714 template <typename Real>
716 {
717 #if defined(GTE_ASSERT_ON_GMATRIX_SIZE_MISMATCH)
718  LogAssert(A.GetNumCols() == B.GetNumCols(), "Mismatched size.");
719 #endif
720  int const numCommon = A.GetNumCols();
722  for (int r = 0; r < result.GetNumRows(); ++r)
723  {
724  for (int c = 0; c < result.GetNumCols(); ++c)
725  {
726  result(r, c) = (Real)0;
727  for (int i = 0; i < numCommon; ++i)
728  {
729  result(r, c) += A(r, i) * B(c, i);
730  }
731  }
732  }
733  return result;
734 }
735 
736 template <typename Real>
738 {
739 #if defined(GTE_ASSERT_ON_GMATRIX_SIZE_MISMATCH)
740  LogAssert(A.GetNumRows() == B.GetNumRows(), "Mismatched size.");
741 #endif
742  int const numCommon = A.GetNumRows();
744  for (int r = 0; r < result.GetNumRows(); ++r)
745  {
746  for (int c = 0; c < result.GetNumCols(); ++c)
747  {
748  result(r, c) = (Real)0;
749  for (int i = 0; i < numCommon; ++i)
750  {
751  result(r, c) += A(i, r) * B(i, c);
752  }
753  }
754  }
755  return result;
756 }
757 
758 template <typename Real>
760 {
761 #if defined(GTE_ASSERT_ON_GMATRIX_SIZE_MISMATCH)
762  LogAssert(A.GetNumRows() == B.GetNumCols(), "Mismatched size.");
763 #endif
764  int const numCommon = A.GetNumRows();
766  for (int r = 0; r < result.GetNumRows(); ++r)
767  {
768  for (int c = 0; c < result.GetNumCols(); ++c)
769  {
770  result(r, c) = (Real)0;
771  for (int i = 0; i < numCommon; ++i)
772  {
773  result(r, c) += A(i, r) * B(c, i);
774  }
775  }
776  }
777  return result;
778 }
779 
780 template <typename Real>
782 {
783 #if defined(GTE_ASSERT_ON_GMATRIX_SIZE_MISMATCH)
784  LogAssert(D.GetSize() == M.GetNumCols(), "Mismatched size.");
785 #endif
787  for (int r = 0; r < result.GetNumRows(); ++r)
788  {
789  for (int c = 0; c < result.GetNumCols(); ++c)
790  {
791  result(r, c) = M(r, c) * D[c];
792  }
793  }
794  return result;
795 }
796 
797 template <typename Real>
799 {
800 #if defined(GTE_ASSERT_ON_GMATRIX_SIZE_MISMATCH)
801  LogAssert(D.GetSize() == M.GetNumRows(), "Mismatched size.");
802 #endif
804  for (int r = 0; r < result.GetNumRows(); ++r)
805  {
806  for (int c = 0; c < result.GetNumCols(); ++c)
807  {
808  result(r, c) = D[r] * M(r, c);
809  }
810  }
811  return result;
812 }
813 
814 template <typename Real>
816 {
818  for (int r = 0; r < result.GetNumRows(); ++r)
819  {
820  for (int c = 0; c < result.GetNumCols(); ++c)
821  {
822  result(r, c) = U[r] * V[c];
823  }
824  }
825  return result;
826 }
827 
828 template <typename Real>
830 {
831 #if defined(GTE_ASSERT_ON_GMATRIX_SIZE_MISMATCH)
832  LogAssert(M.GetNumRows() == M.GetNumCols(), "Mismatched size.");
833 #endif
834  int const N = M.GetNumRows();
835  for (int i = 0; i < N*N; ++i)
836  {
837  M[i] = (Real)0;
838  }
839 
840  for (int i = 0; i < N; ++i)
841  {
842  M(i, i) = D[i];
843  }
844 }
845 
846 
847 }
std::vector< Real > mElements
Definition: GteGMatrix.h:89
static GMatrix Unit(int numRows, int numCols, int r, int c)
Definition: GteGMatrix.h:422
void SetSize(int numRows, int numCols)
Definition: GteGMatrix.h:216
bool operator==(GMatrix const &mat) const
Definition: GteGMatrix.h:346
gte::BSNumber< UIntegerType > abs(gte::BSNumber< UIntegerType > const &number)
Definition: GteBSNumber.h:966
#define LogAssert(condition, message)
Definition: GteLogger.h:86
DualQuaternion< Real > & operator*=(DualQuaternion< Real > &d, Real scalar)
Real const & operator[](int i) const
Definition: GteGMatrix.h:334
void MakeDiagonal(GVector< Real > const &D, GMatrix< Real > &M)
Definition: GteGMatrix.h:829
void MakeIdentity()
Definition: GteGMatrix.h:403
GVector< Real > GetRow(int r) const
Definition: GteGMatrix.h:312
GMatrix< Real > MultiplyMD(GMatrix< Real > const &M, GVector< Real > const &D)
Definition: GteGMatrix.h:781
int GetNumElements() const
Definition: GteGMatrix.h:252
bool operator>=(GMatrix const &mat) const
Definition: GteGMatrix.h:380
int GetNumCols() const
Definition: GteGMatrix.h:246
bool operator!=(GMatrix const &mat) const
Definition: GteGMatrix.h:353
void SetCol(int c, GVector< Real > const &vec)
Definition: GteGMatrix.h:300
void SetRow(int r, GVector< Real > const &vec)
Definition: GteGMatrix.h:288
GMatrix< Real > MultiplyATB(GMatrix< Real > const &A, GMatrix< Real > const &B)
Definition: GteGMatrix.h:737
GMatrix< Real > Transpose(GMatrix< Real > const &M)
Definition: GteGMatrix.h:637
const GLubyte * c
Definition: glext.h:11671
DualQuaternion< Real > operator+(DualQuaternion< Real > const &d)
#define LogError(message)
Definition: GteLogger.h:92
DualQuaternion< Real > & operator-=(DualQuaternion< Real > &d0, DualQuaternion< Real > const &d1)
int GetNumRows() const
Definition: GteGMatrix.h:240
bool operator>(GMatrix const &mat) const
Definition: GteGMatrix.h:373
Real const & operator()(int r, int c) const
Definition: GteGMatrix.h:258
GMatrix< Real > MultiplyAB(GMatrix< Real > const &A, GMatrix< Real > const &B)
Definition: GteGMatrix.h:693
void GetSize(int &numRows, int &numCols) const
Definition: GteGMatrix.h:233
void MakeUnit(int r, int c)
Definition: GteGMatrix.h:393
GLboolean r
Definition: glcorearb.h:1217
GMatrix< Real > MultiplyATBT(GMatrix< Real > const &A, GMatrix< Real > const &B)
Definition: GteGMatrix.h:759
Real LInfinityNorm(GMatrix< Real > const &M)
Definition: GteGMatrix.h:575
GMatrix< Real > MultiplyABT(GMatrix< Real > const &A, GMatrix< Real > const &B)
Definition: GteGMatrix.h:715
DualQuaternion< Real > operator-(DualQuaternion< Real > const &d)
static GMatrix Identity(int numRows, int numCols)
Definition: GteGMatrix.h:430
static GMatrix Zero(int numRows, int numCols)
Definition: GteGMatrix.h:414
DualQuaternion< Real > & operator+=(DualQuaternion< Real > &d0, DualQuaternion< Real > const &d1)
bool operator<(GMatrix const &mat) const
Definition: GteGMatrix.h:359
Quaternion< Real > Inverse(Quaternion< Real > const &d)
Real L2Norm(GMatrix< Real > const &M)
Definition: GteGMatrix.h:564
Real Determinant(GMatrix< Real > const &M)
Definition: GteGMatrix.h:618
DualQuaternion< Real > & operator/=(DualQuaternion< Real > &d, Real scalar)
GVector< Real > GetCol(int c) const
Definition: GteGMatrix.h:323
Vector4< float > operator*(Transform const &M, Vector4< float > const &V)
GLuint64EXT * result
Definition: glext.h:10003
void MakeZero()
Definition: GteGMatrix.h:387
GMatrix< Real > OuterProduct(GVector< Real > const &U, GVector< Real > const &V)
Definition: GteGMatrix.h:815
bool operator<=(GMatrix const &mat) const
Definition: GteGMatrix.h:366
Real L1Norm(GMatrix< Real > const &M)
Definition: GteGMatrix.h:553
DualQuaternion< Real > operator/(DualQuaternion< Real > const &d, Real scalar)
GMatrix< Real > MultiplyDM(GVector< Real > const &D, GMatrix< Real > const &M)
Definition: GteGMatrix.h:798
int GetSize() const
Definition: GteGVector.h:191


geometric_tools_engine
Author(s): Yijiang Huang
autogenerated on Thu Jul 18 2019 04:00:00