Home | History | Annotate | Download | only in common

Lines Matching refs:Matrix

23  * \brief Templatized matrix class.
33 // Templated matrix class.
35 class Matrix
48 Matrix (void);
49 explicit Matrix (const T& src);
50 explicit Matrix (const T src[Rows*Cols]);
51 Matrix (const Vector<T, Rows>& src);
52 Matrix (const Matrix<T, Rows, Cols>& src);
53 ~Matrix (void);
55 Matrix<T, Rows, Cols>& operator= (const Matrix<T, Rows, Cols>& src);
56 Matrix<T, Rows, Cols>& operator*= (const Matrix<T, Rows, Cols>& src);
82 Matrix<T, Rows0, Cols1> operator* (const Matrix<T, Rows0, Cols0>& a, const Matrix<T, Rows1, Cols1>& b);
86 Vector<T, Rows> operator* (const Matrix<T, Rows, Cols>& mtx, const Vector<T, Cols>& vec);
90 Vector<T, Cols> operator* (const Vector<T, Rows>& vec, const Matrix<T, Rows, Cols>& mtx);
97 static T doDeterminant (const Matrix<T, Size, Size>& mat);
98 static Matrix<T, Size, Size> doInverse (const Matrix<T, Size, Size>& mat);
104 static T doDeterminant (const Matrix<T, 2, 2>& mat);
105 static Matrix<T, 2, 2> doInverse (const Matrix<T, 2, 2>& mat);
111 static T doDeterminant (const Matrix<T, 3, 3>& mat);
112 static Matrix<T, 3, 3> doInverse (const Matrix<T, 3, 3>& mat);
118 static T doDeterminant (const Matrix<T, 4, 4>& mat);
119 static Matrix<T, 4, 4> doInverse (const Matrix<T, 4, 4>& mat);
122 namespace matrix
126 T determinant (const Matrix<T, Size, Size>& mat)
132 Matrix<T, Size, Size> inverse (const Matrix<T, Size, Size>& mat)
137 } // matrix
142 T SquareMatrixOps<T, 2>::doDeterminant (const Matrix<T, 2, 2>& mat)
148 T SquareMatrixOps<T, 3>::doDeterminant (const Matrix<T, 3, 3>& mat)
159 T SquareMatrixOps<T, 4>::doDeterminant (const Matrix<T, 4, 4>& mat)
161 using matrix::determinant;
187 return + mat(0,0) * determinant(Matrix<T, 3, 3>(minorMatrices[0]))
188 - mat(0,1) * determinant(Matrix<T, 3, 3>(minorMatrices[1]))
189 + mat(0,2) * determinant(Matrix<T, 3, 3>(minorMatrices[2]))
190 - mat(0,3) * determinant(Matrix<T, 3, 3>(minorMatrices[3]));
194 Matrix<T, 2, 2> SquareMatrixOps<T, 2>::doInverse (const Matrix<T, 2, 2>& mat)
196 using matrix::determinant;
199 Matrix<T, 2, 2> retVal;
210 Matrix<T, 3, 3> SquareMatrixOps<T, 3>::doInverse (const Matrix<T, 3, 3>& mat)
213 using matrix::inverse;
235 const Matrix<T, 2, 2> invA = inverse(Matrix<T, 2, 2>(areaA));
236 const Matrix<T, 2, 1> matB = Matrix<T, 2, 1>(areaB);
237 const Matrix<T, 1, 2> matC = Matrix<T, 1, 2>(areaC);
238 const Matrix<T, 1, 1> matD = Matrix<T, 1, 1>(areaD);
241 const Matrix<T, 2, 2> zeroMat = Matrix<T, 2, 2>(nullField);
243 const Matrix<T, 2, 2> blockA = invA + invA*matB*schurComplement*matC*invA;
244 const Matrix<T, 2, 1> blockB = (zeroMat-invA)*matB*schurComplement;
245 const Matrix<T, 1, 2> blockC = matC*invA*(-schurComplement);
255 return Matrix<T, 3, 3>(result);
259 Matrix<T, 4, 4> SquareMatrixOps<T, 4>::doInverse (const Matrix<T, 4, 4>& mat)
262 using matrix::inverse;
286 const Matrix<T, 2, 2> invA = inverse(Matrix<T, 2, 2>(areaA));
287 const Matrix<T, 2, 2> matB = Matrix<T, 2, 2>(areaB);
288 const Matrix<T, 2, 2> matC = Matrix<T, 2, 2>(areaC);
289 const Matrix<T, 2, 2> matD = Matrix<T, 2, 2>(areaD);
291 const Matrix<T, 2, 2> schurComplement = inverse(matD - matC*invA*matB);
292 const Matrix<T, 2, 2> zeroMat = Matrix<T, 2, 2>(nullField);
294 const Matrix<T, 2, 2> blockA = invA + invA*matB*schurComplement*matC*invA;
295 const Matrix<T, 2, 2> blockB = (zeroMat-invA)*matB*schurComplement;
296 const Matrix<T, 2, 2> blockC = (zeroMat-schurComplement)*matC*invA;
297 const Matrix<T, 2, 2> blockD = schurComplement;
307 return Matrix<T, 4, 4>(result);
312 Matrix<T, Rows, Cols>::Matrix (void)
319 // Initialize to diagonal matrix.
321 Matrix<T, Rows, Cols>::Matrix (const T& src)
330 Matrix<T, Rows, Cols>::Matrix (const T src[Rows*Cols])
337 // Initialize to diagonal matrix.
339 Matrix<T, Rows, Cols>::Matrix (const Vector<T, Rows>& src)
349 Matrix<T, Rows, Cols>::Matrix (const Matrix<T, Rows, Cols>& src)
356 Matrix<T, Rows, Cols>::~Matrix (void)
362 Matrix<T, Rows, Cols>& Matrix<T, Rows, Cols>::operator= (const Matrix<T, Rows, Cols>& src)
372 Matrix<T, Rows, Cols>& Matrix<T, Rows, Cols>::operator*= (const Matrix<T, Rows, Cols>& src)
379 void Matrix<T, Rows, Cols>::setRow (int rowNdx, const Vector<T, Cols>& vec)
386 void Matrix<T, Rows, Cols>::setColumn (int colNdx, const Vector<T, Rows>& vec)
392 Vector<T, Cols> Matrix<T, Rows, Cols>::getRow (int rowNdx) const
401 Vector<T, Rows>& Matrix<T, Rows, Cols>::getColumn (int colNdx)
407 const Vector<T, Rows>& Matrix<T, Rows, Cols>::getColumn (int colNdx) const
413 Array<T, Rows*Cols> Matrix<T, Rows, Cols>::getColumnMajorData (void) const
424 Array<T, Rows*Cols> Matrix<T, Rows, Cols>::getRowMajorData (void) const
436 Matrix<T, Rows0, Cols1> operator* (const Matrix<T, Rows0, Cols0>& a, const Matrix<T, Rows1, Cols1>& b)
439 Matrix<T, Rows0, Cols1> res;
453 // Multiply of matrix with column vector.
455 Vector<T, Rows> operator* (const Matrix<T, Rows, Cols>& mtx, const Vector<T, Cols>& vec)
468 // Multiply of matrix with row vector.
470 Vector<T, Cols> operator* (const Vector<T, Rows>& vec, const Matrix<T, Rows, Cols>& mtx)
484 typedef Matrix<float, 2, 2> Matrix2f;
485 typedef Matrix<float, 3, 3> Matrix3f;
486 typedef Matrix<float, 4, 4> Matrix4f;
487 typedef Matrix<double, 2, 2> Matrix2d;
488 typedef Matrix<double, 3, 3> Matrix3d;
489 typedef Matrix<double, 4, 4> Matrix4d;
493 typedef Matrix<float, 3, 2> Mat2x3;
494 typedef Matrix<float, 4, 2> Mat2x4;
495 typedef Matrix<float, 2, 3> Mat3x2;
497 typedef Matrix<float, 4, 3> Mat3x4;
498 typedef Matrix<float, 2, 4> Mat4x2;
499 typedef Matrix<float, 3, 4> Mat4x3;
502 // Matrix-scalar operators.
505 Matrix<T, Rows, Cols> operator+ (const Matrix<T, Rows, Cols>& mtx, T scalar)
507 Matrix<T, Rows, Cols> res;
515 Matrix<T, Rows, Cols> operator- (const Matrix<T, Rows, Cols>& mtx, T scalar)
517 Matrix<T, Rows, Cols> res;
525 Matrix<T, Rows, Cols> operator* (const Matrix<T, Rows, Cols>& mtx, T scalar)
527 Matrix<T, Rows, Cols> res;
535 Matrix<T, Rows, Cols> operator/ (const Matrix<T, Rows, Cols>& mtx, T scalar)
537 Matrix<T, Rows, Cols> res;
544 // Matrix-matrix component-wise operators.
547 Matrix<T, Rows, Cols> operator+ (const Matrix<T, Rows, Cols>& a, const Matrix<T, Rows, Cols>& b)
549 Matrix<T, Rows, Cols> res;
557 Matrix<T, Rows, Cols> operator- (const Matrix<T, Rows, Cols>& a, const Matrix<T, Rows, Cols>& b)
559 Matrix<T, Rows, Cols> res;
567 Matrix<T, Rows, Cols> operator/ (const Matrix<T, Rows, Cols>& a, const Matrix<T, Rows, Cols>& b)
569 Matrix<T, Rows, Cols> res;