Matrix< M, N, T > Class Template Reference
A Matrix is templated to store M rows and N columns of data of type T. If left off, T will default to a "real_t" data type. Also, if N is not specified, the template will default to a square MxM matrix. More...
#include <Matrix.h>
Public Member Functions | |
Constructors | |
| Matrix (const T *srcData) | |
| Expects arguments in row-major order. | |
| Matrix () | |
| Constructs a zero Matrix. | |
| Matrix (const Matrix< M, N, T > &m) | |
| Copy Constructor. | |
Accessor Operators | |
| const Vector< N, T > & | operator[] (const unsigned rowIndex) const |
| Vector< N, T > & | operator[] (const unsigned rowIndex) |
| const T * | operator* () const |
| T * | operator* () |
Equality Operators | |
| bool | operator== (const Matrix< M, N, T > &m) const |
| bool | operator!= (const Matrix< M, N, T > &m) const |
Mutator Operators | |
| Matrix< M, N, T > & | operator= (const Matrix< M, N, T > &m) |
| Matrix< M, N, T > & | operator+= (const Matrix< M, N, T > &rhs) |
| Matrix< M, N, T > & | operator-= (const Matrix< M, N, T > &rhs) |
| Matrix< M, N, T > & | operator*= (const Matrix< M, N, T > &rhs) |
Scalar Mutator Operators | |
| Matrix< M, N, T > & | operator*= (const T &scale) |
| Matrix< M, N, T > & | operator/= (const T &scale) |
Arithmetic Operators | |
| Matrix< M, N, T > | operator+ (const Matrix< M, N, T > &rhs) const |
| Matrix< M, N, T > | operator- (const Matrix< M, N, T > &rhs) const |
| Matrix< M, N, T > | operator* (const Matrix< M, N, T > &rhs) const |
| MxN (square) matrix * MxN (square) matrix yields an MxN (square) matrix. | |
| Point< M, T > | operator* (const Point< N, T > &rhs) const |
| Vector< M, T > | operator* (const Vector< N, T > &rhs) const |
| Vector< M-1, T > | operator* (const Vector< N-1, T > &rhs) const |
Scalar Arithmetic Operators | |
| Matrix< M, N, T > | operator* (const T &scale) const |
| Matrix< M, N, T > | operator/ (const T &scale) const |
More Complex Functionality | |
| bool | isDiagonal () const |
| Vector< N, T > & | row (unsigned index) |
| Vector< N, T > | row (unsigned index) const |
| Vector< M, T > | col (unsigned index) const |
| Matrix< M, N, T > & | setCol (unsigned index, const Vector< M, T > &vec) |
| Sets the index'th column of this matrix to the given Vector. | |
| const Matrix< M, N, T > | getTranspose () const |
| void | fillGLMatrix (T *bufferToFill) const |
| bool | isUpperTriangular () const |
| bool | isLowerTriangular () const |
| Matrix< M, N, T > | getInverse () const |
| T | getDeterminant () const |
| void | cleanup () |
| Cleans up a matrix (0's out entries that are less than epsilon). | |
| Matrix (const T &v0, const T &v1=0, const T &v2=0, const T &v3=0, const T &v4=0, const T &v5=0, const T &v6=0, const T &v7=0, const T &v8=0, const T &v9=0, const T &v10=0, const T &v11=0, const T &v12=0, const T &v13=0, const T &v14=0, const T &v15=0) | |
| Convenience Constructor. | |
Static Public Member Functions | |
Static convenience constructors to generate common matrices | |
| static Matrix | zero () |
| Generates a matrix full of zeroes. | |
| static Matrix | identity () |
| Generates an identity matrix. | |
| static Matrix | diagonal (T diagonalValue) |
| Generates a diagonal matrix with the value specified. | |
Public Attributes | |
| Vector< N, T > | rows [M] |
| Underlying data, where each row is stored in a separate Vector. | |
Detailed Description
template<unsigned M, unsigned N = M, typename T = real_t>
class Matrix< M, N, T >
A Matrix is templated to store M rows and N columns of data of type T. If left off, T will default to a "real_t" data type. Also, if N is not specified, the template will default to a square MxM matrix.
Provides basic functionality for a templated, arbitrarily-sized matrix.
Included in this definition are typedefs for the most commonly used matrices (4x4, 3x3, etc), and these can be thought of as shortcuts to reference their associated Matrix templates. For example, Matrix4x4 can be used to refer to Matrix<4, 4, real_t>.
A Matrix stores each of its M rows internally as an N-length Vector.
- Date:
- Fall 2008
Included in this definition are typedefs for the most commonly used matrices (4x4, 3x3, etc), and these can be thought of as shortcuts to reference their associated Matrix templates. For example, Matrix4x4 can be used to refer to Matrix<4, 4, real_t>.
A Matrix stores each of its M rows internally as an N-length Vector called rows which has been defined as:
Vector<N, T> rows[M];
Definition at line 48 of file Matrix.h.
Constructor & Destructor Documentation
| Matrix< M, N, T >::Matrix | ( | const T & | v0, | |
| const T & | v1 = 0, |
|||
| const T & | v2 = 0, |
|||
| const T & | v3 = 0, |
|||
| const T & | v4 = 0, |
|||
| const T & | v5 = 0, |
|||
| const T & | v6 = 0, |
|||
| const T & | v7 = 0, |
|||
| const T & | v8 = 0, |
|||
| const T & | v9 = 0, |
|||
| const T & | v10 = 0, |
|||
| const T & | v11 = 0, |
|||
| const T & | v12 = 0, |
|||
| const T & | v13 = 0, |
|||
| const T & | v14 = 0, |
|||
| const T & | v15 = 0 | |||
| ) | [inline, explicit] |
Member Function Documentation
| Vector< N, T > & Matrix< M, N, T >::operator[] | ( | const unsigned | rowIndex | ) | [inline] |
- Returns:
- a reference to the row at the given index
- Note:
- changes to the returned vector will affect this matrix
Definition at line 68 of file Matrix.inl.
| const T * Matrix< M, N, T >::operator* | ( | ) | const [inline] |
- Returns:
- a const pointer to the raw, underlying data (row-major, M*N-length array of type T)
Definition at line 77 of file Matrix.inl.
| T * Matrix< M, N, T >::operator* | ( | ) | [inline] |
- Returns:
- a pointer to the raw, underlying data (row-major, M*N-length array of type T)
Definition at line 84 of file Matrix.inl.
| bool Matrix< M, N, T >::operator== | ( | const Matrix< M, N, T > & | m | ) | const [inline] |
Definition at line 101 of file Matrix.inl.
| bool Matrix< M, N, T >::operator!= | ( | const Matrix< M, N, T > & | m | ) | const [inline] |
Definition at line 113 of file Matrix.inl.
| Matrix< M, N, T > & Matrix< M, N, T >::operator= | ( | const Matrix< M, N, T > & | m | ) | [inline] |
Definition at line 125 of file Matrix.inl.
| Matrix< M, N, T > & Matrix< M, N, T >::operator+= | ( | const Matrix< M, N, T > & | rhs | ) | [inline] |
Definition at line 133 of file Matrix.inl.
| Matrix< M, N, T > & Matrix< M, N, T >::operator-= | ( | const Matrix< M, N, T > & | rhs | ) | [inline] |
Definition at line 142 of file Matrix.inl.
| Matrix< M, N, T > & Matrix< M, N, T >::operator*= | ( | const Matrix< M, N, T > & | rhs | ) | [inline] |
Definition at line 151 of file Matrix.inl.
| Matrix< M, N, T > & Matrix< M, N, T >::operator*= | ( | const T & | scale | ) | [inline] |
Definition at line 165 of file Matrix.inl.
| Matrix< M, N, T > & Matrix< M, N, T >::operator/= | ( | const T & | scale | ) | [inline] |
Definition at line 174 of file Matrix.inl.
| Matrix< M, N, T > Matrix< M, N, T >::operator+ | ( | const Matrix< M, N, T > & | rhs | ) | const [inline] |
Definition at line 188 of file Matrix.inl.
| Matrix< M, N, T > Matrix< M, N, T >::operator- | ( | const Matrix< M, N, T > & | rhs | ) | const [inline] |
Definition at line 199 of file Matrix.inl.
| Matrix< M, N, T > Matrix< M, N, T >::operator* | ( | const Matrix< M, N, T > & | rhs | ) | const [inline] |
MxN (square) matrix * MxN (square) matrix yields an MxN (square) matrix.
Definition at line 211 of file Matrix.inl.
| Point< M, T > Matrix< M, N, T >::operator* | ( | const Point< N, T > & | rhs | ) | const [inline] |
MxN matrix * N-length column vector yields an M-length vector
- Note:
- this method returns an M-length Vector. Make sure you understand why.
Definition at line 222 of file Matrix.inl.
| Vector< M, T > Matrix< M, N, T >::operator* | ( | const Vector< N, T > & | rhs | ) | const [inline] |
Definition at line 237 of file Matrix.inl.
| Vector< M-1, T > Matrix< M, N, T >::operator* | ( | const Vector< N-1, T > & | rhs | ) | const [inline] |
Definition at line 248 of file Matrix.inl.
| Matrix< M, N, T > Matrix< M, N, T >::operator* | ( | const T & | scale | ) | const [inline] |
Definition at line 262 of file Matrix.inl.
| Matrix< M, N, T > Matrix< M, N, T >::operator/ | ( | const T & | scale | ) | const [inline] |
Definition at line 273 of file Matrix.inl.
| bool Matrix< M, N, T >::isDiagonal | ( | ) | const [inline] |
| Vector< N, T > & Matrix< M, N, T >::row | ( | unsigned | index | ) | [inline] |
- Returns:
- a Vector containing the index'th row of this matrix
- Note:
- Modifying the Vector returned will directly affect this Matrix's data
Definition at line 302 of file Matrix.inl.
| Vector< N, T > Matrix< M, N, T >::row | ( | unsigned | index | ) | const [inline] |
- Returns:
- a Vector containing the index'th row of this matrix
- Note:
- Modifying the Vector returned will Not affect this Matrix's data
Definition at line 311 of file Matrix.inl.
| Vector< M, T > Matrix< M, N, T >::col | ( | unsigned | index | ) | const [inline] |
- Returns:
- a Vector containing the index'th column of this matrix
- Note:
- Modifying the Vector returned will Not affect this Matrix's data
Definition at line 320 of file Matrix.inl.
| Matrix< M, N, T > & Matrix< M, N, T >::setCol | ( | unsigned | index, | |
| const Vector< M, T > & | vec | |||
| ) | [inline] |
Sets the index'th column of this matrix to the given Vector.
Definition at line 332 of file Matrix.inl.
| void Matrix< M, N, T >::fillGLMatrix | ( | T * | bufferToFill | ) | const [inline] |
Fills the data provided with the transpose of this matrix (since OpenGL matrices are stored in column-major format).
Definition at line 399 of file Matrix.inl.
| bool Matrix< M, N, T >::isUpperTriangular | ( | ) | const [inline] |
- Returns:
- true if this matrix is strictly upper-triangular. An upper- triangular matrix contains only zeros below its diagonal (but may contain non-zero values on and above its diagonal).
Example 4x4 non upper triangular matrix: [ 1 2 3 4 ] [ 0 5 6 7 ] [ 8 0 0 9 ] [ 0 0 0 0 ]
Definition at line 425 of file Matrix.inl.
| bool Matrix< M, N, T >::isLowerTriangular | ( | ) | const [inline] |
- Returns:
- true if this matrix is strictly lower-triangular. An lower- triangular matrix contains only zeros above its diagonal (but may contain non-zero values on and below its diagonal).
Example 4x4 non upper triangular matrix: [ 1 0 0 2 ] [ 3 4 0 5 ] [ 6 7 8 0 ] [ 0 0 0 0 ]
Definition at line 452 of file Matrix.inl.
| T Matrix< M, N, T >::getDeterminant | ( | ) | const [inline] |
| void Matrix< M, N, T >::cleanup | ( | ) | [inline] |
Cleans up a matrix (0's out entries that are less than epsilon).
Definition at line 579 of file Matrix.inl.
Member Data Documentation
The documentation for this class was generated from the following files:
Generated on 28 Feb 2009 for Milton by
1.5.6