compile-time (static) matrix More...
Public Member Functions | |
Matrix () | |
default constructor | |
Matrix (unsigned m, unsigned n) | |
construct with m by n elements | |
unsigned | rows () const |
get the number of rows | |
unsigned | cols () const |
get the number of columns | |
T & | operator() (unsigned i, unsigned j) |
mutable index operator | |
T const & | operator() (unsigned i, unsigned j) const |
immutable index operator | |
Matrix< T, M, N > | operator+ (Matrix< T, M, N > const &b) const |
add two matrices | |
Matrix< T, M, N > | operator- (Matrix< T, M, N > const &b) const |
subtract two matrices | |
Matrix< T, M, N > | operator* (T const &s) const |
multiply by a scalar | |
Matrix< T, M, N > | operator/ (T const &s) const |
divide by a scalar | |
Vector< T, M > | operator* (Vector< T, N > const &b) const |
multiply a matrix by a vector | |
template<unsigned O> | |
Matrix< T, M, O > | operator* (Matrix< T, N, O > const &b) const |
multiply two matrices | |
void | zero () |
zero a matrix |
compile-time (static) matrix
mth::Matrix< T, M, N >::Matrix | ( | unsigned | m, | |
unsigned | n | |||
) | [inline] |
construct with m by n elements
A dummy constructor Matrix(m,n) is provided so that dynamic and static matrices can be used interchangebly
T const& mth::Matrix< T, M, N >::operator() | ( | unsigned | i, | |
unsigned | j | |||
) | const [inline] |
immutable index operator
see the mutable index operator details
T& mth::Matrix< T, M, N >::operator() | ( | unsigned | i, | |
unsigned | j | |||
) | [inline] |
mutable index operator
An index operator (i,j) is provided so that compile time matrices and runtime-sized matrices can be used interchangebly, without worrying about changing index syntax
Matrix<T,M,O> mth::Matrix< T, M, N >::operator* | ( | Matrix< T, N, O > const & | b | ) | const [inline] |
multiply two matrices
the extra template parameter generates code for all possible combinations of matrix sizes