Lines Matching refs:T
34 template <typename T, int Rows, int Cols>
38 typedef Vector<T, Rows> Element;
39 typedef T Scalar;
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);
55 Matrix<T, Rows, Cols>& operator= (const Matrix<T, Rows, Cols>& src);
56 Matrix<T, Rows, Cols>& operator*= (const Matrix<T, Rows, Cols>& src);
58 void setRow (int rowNdx, const Vector<T, Cols>& vec);
59 void setColumn (int colNdx, const Vector<T, Rows>& vec);
61 Vector<T, Cols> getRow (int ndx) const;
62 Vector<T, Rows>& getColumn (int ndx);
63 const Vector<T, Rows>& getColumn (int ndx) const;
65 Vector<T, Rows>& operator[] (int ndx) { return getColumn(ndx); } in operator []()
66 const Vector<T, Rows>& operator[] (int ndx) const { return getColumn(ndx); } in operator []()
68 inline const T& operator() (int row, int col) const { return m_data[col][row]; } in operator ()()
69 inline T& operator() (int row, int col) { return m_data[col][row]; } in operator ()()
71 Array<T, Rows*Cols> getRowMajorData (void) const;
72 Array<T, Rows*Cols> getColumnMajorData (void) const;
75 Vector<Vector<T, Rows>, Cols> m_data;
81 template <typename T, int Rows0, int Cols0, int Rows1, int Cols1>
82 Matrix<T, Rows0, Cols1> operator* (const Matrix<T, Rows0, Cols0>& a, const Matrix<T, Rows1, Cols1>&…
85 template <typename T, int Rows, int Cols>
86 Vector<T, Rows> operator* (const Matrix<T, Rows, Cols>& mtx, const Vector<T, Cols>& vec);
89 template <typename T, int Rows, int Cols>
90 Vector<T, Cols> operator* (const Vector<T, Rows>& vec, const Matrix<T, Rows, Cols>& mtx);
94 template <typename T, int Size>
97 static T doDeterminant (const Matrix<T, Size, Size>& mat);
98 static Matrix<T, Size, Size> doInverse (const Matrix<T, Size, Size>& mat);
101 template <typename T>
102 struct SquareMatrixOps<T, 2>
104 static T doDeterminant (const Matrix<T, 2, 2>& mat);
105 static Matrix<T, 2, 2> doInverse (const Matrix<T, 2, 2>& mat);
108 template <typename T>
109 struct SquareMatrixOps<T, 3>
111 static T doDeterminant (const Matrix<T, 3, 3>& mat);
112 static Matrix<T, 3, 3> doInverse (const Matrix<T, 3, 3>& mat);
115 template <typename T>
116 struct SquareMatrixOps<T, 4>
118 static T doDeterminant (const Matrix<T, 4, 4>& mat);
119 static Matrix<T, 4, 4> doInverse (const Matrix<T, 4, 4>& mat);
125 template <typename T, int Size>
126 T determinant (const Matrix<T, Size, Size>& mat) in determinant() argument
128 return SquareMatrixOps<T, Size>::doDeterminant(mat); in determinant()
131 template <typename T, int Size>
132 Matrix<T, Size, Size> inverse (const Matrix<T, Size, Size>& mat) in inverse() argument
134 return SquareMatrixOps<T, Size>::doInverse(mat); in inverse()
141 template <typename T>
142 T SquareMatrixOps<T, 2>::doDeterminant (const Matrix<T, 2, 2>& mat) in doDeterminant() argument
147 template <typename T>
148 T SquareMatrixOps<T, 3>::doDeterminant (const Matrix<T, 3, 3>& mat) in doDeterminant() argument
158 template <typename T>
159 T SquareMatrixOps<T, 4>::doDeterminant (const Matrix<T, 4, 4>& mat) in doDeterminant() argument
163 const T minorMatrices[4][3*3] = in doDeterminant()
187 return + mat(0,0) * determinant(Matrix<T, 3, 3>(minorMatrices[0])) in doDeterminant()
188 - mat(0,1) * determinant(Matrix<T, 3, 3>(minorMatrices[1])) in doDeterminant()
189 + mat(0,2) * determinant(Matrix<T, 3, 3>(minorMatrices[2])) in doDeterminant()
190 - mat(0,3) * determinant(Matrix<T, 3, 3>(minorMatrices[3])); in doDeterminant()
193 template <typename T>
194 Matrix<T, 2, 2> SquareMatrixOps<T, 2>::doInverse (const Matrix<T, 2, 2>& mat) in doInverse() argument
198 const T det = determinant(mat); in doInverse()
199 Matrix<T, 2, 2> retVal; in doInverse()
209 template <typename T>
210 Matrix<T, 3, 3> SquareMatrixOps<T, 3>::doInverse (const Matrix<T, 3, 3>& mat) in doInverse() argument
215 const T areaA[2*2] = in doInverse()
220 const T areaB[2] = in doInverse()
225 const T areaC[2] = in doInverse()
229 const T areaD[1] = in doInverse()
233 const T nullField[4] = { T(0.0f) }; in doInverse()
235 const Matrix<T, 2, 2> invA = inverse(Matrix<T, 2, 2>(areaA)); in doInverse()
236 const Matrix<T, 2, 1> matB = Matrix<T, 2, 1>(areaB); in doInverse()
237 const Matrix<T, 1, 2> matC = Matrix<T, 1, 2>(areaC); in doInverse()
238 const Matrix<T, 1, 1> matD = Matrix<T, 1, 1>(areaD); in doInverse()
240 const T schurComplement = T(1.0f) / (matD - matC*invA*matB)(0,0); in doInverse()
241 const Matrix<T, 2, 2> zeroMat = Matrix<T, 2, 2>(nullField); in doInverse()
243 const Matrix<T, 2, 2> blockA = invA + invA*matB*schurComplement*matC*invA; in doInverse()
244 const Matrix<T, 2, 1> blockB = (zeroMat-invA)*matB*schurComplement; in doInverse()
245 const Matrix<T, 1, 2> blockC = matC*invA*(-schurComplement); in doInverse()
246 const T blockD = schurComplement; in doInverse()
248 const T result[3*3] = in doInverse()
255 return Matrix<T, 3, 3>(result); in doInverse()
258 template <typename T>
259 Matrix<T, 4, 4> SquareMatrixOps<T, 4>::doInverse (const Matrix<T, 4, 4>& mat) in doInverse() argument
264 const T areaA[2*2] = in doInverse()
269 const T areaB[2*2] = in doInverse()
274 const T areaC[2*2] = in doInverse()
279 const T areaD[2*2] = in doInverse()
284 const T nullField[4] = { T(0.0f) }; in doInverse()
286 const Matrix<T, 2, 2> invA = inverse(Matrix<T, 2, 2>(areaA)); in doInverse()
287 const Matrix<T, 2, 2> matB = Matrix<T, 2, 2>(areaB); in doInverse()
288 const Matrix<T, 2, 2> matC = Matrix<T, 2, 2>(areaC); in doInverse()
289 const Matrix<T, 2, 2> matD = Matrix<T, 2, 2>(areaD); in doInverse()
291 const Matrix<T, 2, 2> schurComplement = inverse(matD - matC*invA*matB); in doInverse()
292 const Matrix<T, 2, 2> zeroMat = Matrix<T, 2, 2>(nullField); in doInverse()
294 const Matrix<T, 2, 2> blockA = invA + invA*matB*schurComplement*matC*invA; in doInverse()
295 const Matrix<T, 2, 2> blockB = (zeroMat-invA)*matB*schurComplement; in doInverse()
296 const Matrix<T, 2, 2> blockC = (zeroMat-schurComplement)*matC*invA; in doInverse()
297 const Matrix<T, 2, 2> blockD = schurComplement; in doInverse()
299 const T result[4*4] = in doInverse()
307 return Matrix<T, 4, 4>(result); in doInverse()
311 template <typename T, int Rows, int Cols>
312 Matrix<T, Rows, Cols>::Matrix (void) in Matrix()
316 (*this)(row, col) = (row == col) ? T(1) : T(0); in Matrix()
320 template <typename T, int Rows, int Cols>
321 Matrix<T, Rows, Cols>::Matrix (const T& src) in Matrix()
325 (*this)(row, col) = (row == col) ? src : T(0); in Matrix()
329 template <typename T, int Rows, int Cols>
330 Matrix<T, Rows, Cols>::Matrix (const T src[Rows*Cols]) in Matrix()
338 template <typename T, int Rows, int Cols>
339 Matrix<T, Rows, Cols>::Matrix (const Vector<T, Rows>& src) in Matrix() argument
344 (*this)(row, col) = (row == col) ? src.m_data[row] : T(0); in Matrix()
348 template <typename T, int Rows, int Cols>
349 Matrix<T, Rows, Cols>::Matrix (const Matrix<T, Rows, Cols>& src) in Matrix() argument
355 template <typename T, int Rows, int Cols>
356 Matrix<T, Rows, Cols>::~Matrix (void) in ~Matrix()
361 template <typename T, int Rows, int Cols>
362 Matrix<T, Rows, Cols>& Matrix<T, Rows, Cols>::operator= (const Matrix<T, Rows, Cols>& src) in operator =() argument
371 template <typename T, int Rows, int Cols>
372 Matrix<T, Rows, Cols>& Matrix<T, Rows, Cols>::operator*= (const Matrix<T, Rows, Cols>& src) in operator *=() argument
378 template <typename T, int Rows, int Cols>
379 void Matrix<T, Rows, Cols>::setRow (int rowNdx, const Vector<T, Cols>& vec) in setRow() argument
385 template <typename T, int Rows, int Cols>
386 void Matrix<T, Rows, Cols>::setColumn (int colNdx, const Vector<T, Rows>& vec) in setColumn() argument
391 template <typename T, int Rows, int Cols>
392 Vector<T, Cols> Matrix<T, Rows, Cols>::getRow (int rowNdx) const in getRow()
394 Vector<T, Cols> res; in getRow()
400 template <typename T, int Rows, int Cols>
401 Vector<T, Rows>& Matrix<T, Rows, Cols>::getColumn (int colNdx) in getColumn()
406 template <typename T, int Rows, int Cols>
407 const Vector<T, Rows>& Matrix<T, Rows, Cols>::getColumn (int colNdx) const in getColumn()
412 template <typename T, int Rows, int Cols>
413 Array<T, Rows*Cols> Matrix<T, Rows, Cols>::getColumnMajorData (void) const in getColumnMajorData()
415 Array<T, Rows*Cols> a; in getColumnMajorData()
416 T* dst = a.getPtr(); in getColumnMajorData()
423 template <typename T, int Rows, int Cols>
424 Array<T, Rows*Cols> Matrix<T, Rows, Cols>::getRowMajorData (void) const in getRowMajorData()
426 Array<T, Rows*Cols> a; in getRowMajorData()
427 T* dst = a.getPtr(); in getRowMajorData()
435 template <typename T, int Rows0, int Cols0, int Rows1, int Cols1>
436 Matrix<T, Rows0, Cols1> operator* (const Matrix<T, Rows0, Cols0>& a, const Matrix<T, Rows1, Cols1>&… in operator *() argument
439 Matrix<T, Rows0, Cols1> res; in operator *()
444 T v = T(0); in operator *()
454 template <typename T, int Rows, int Cols>
455 Vector<T, Rows> operator* (const Matrix<T, Rows, Cols>& mtx, const Vector<T, Cols>& vec) in operator *() argument
457 Vector<T, Rows> res; in operator *()
460 T v = T(0); in operator *()
469 template <typename T, int Rows, int Cols>
470 Vector<T, Cols> operator* (const Vector<T, Rows>& vec, const Matrix<T, Rows, Cols>& mtx) in operator *() argument
472 Vector<T, Cols> res; in operator *()
475 T v = T(0); in operator *()
504 template <typename T, int Rows, int Cols>
505 Matrix<T, Rows, Cols> operator+ (const Matrix<T, Rows, Cols>& mtx, T scalar) in operator +() argument
507 Matrix<T, Rows, Cols> res; in operator +()
514 template <typename T, int Rows, int Cols>
515 Matrix<T, Rows, Cols> operator- (const Matrix<T, Rows, Cols>& mtx, T scalar) in operator -() argument
517 Matrix<T, Rows, Cols> res; in operator -()
524 template <typename T, int Rows, int Cols>
525 Matrix<T, Rows, Cols> operator* (const Matrix<T, Rows, Cols>& mtx, T scalar) in operator *() argument
527 Matrix<T, Rows, Cols> res; in operator *()
534 template <typename T, int Rows, int Cols>
535 Matrix<T, Rows, Cols> operator/ (const Matrix<T, Rows, Cols>& mtx, T scalar) in operator /() argument
537 Matrix<T, Rows, Cols> res; in operator /()
546 template <typename T, int Rows, int Cols>
547 Matrix<T, Rows, Cols> operator+ (const Matrix<T, Rows, Cols>& a, const Matrix<T, Rows, Cols>& b) in operator +() argument
549 Matrix<T, Rows, Cols> res; in operator +()
556 template <typename T, int Rows, int Cols>
557 Matrix<T, Rows, Cols> operator- (const Matrix<T, Rows, Cols>& a, const Matrix<T, Rows, Cols>& b) in operator -() argument
559 Matrix<T, Rows, Cols> res; in operator -()
566 template <typename T, int Rows, int Cols>
567 Matrix<T, Rows, Cols> operator/ (const Matrix<T, Rows, Cols>& a, const Matrix<T, Rows, Cols>& b) in operator /() argument
569 Matrix<T, Rows, Cols> res; in operator /()