Public Member Functions

mth::Matrix< T, M, N > Class Template Reference

compile-time (static) matrix More...

Inheritance diagram for mth::Matrix< T, M, N >:
can::Array< Vector< T, N >, M >

List of all members.

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

Detailed Description

template<class T, unsigned M = 0, unsigned N = 0>
class mth::Matrix< T, M, N >

compile-time (static) matrix


Constructor & Destructor Documentation

template<class T, unsigned M = 0, unsigned N = 0>
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


Member Function Documentation

template<class T, unsigned M = 0, unsigned N = 0>
T const& mth::Matrix< T, M, N >::operator() ( unsigned  i,
unsigned  j 
) const [inline]

immutable index operator

see the mutable index operator details

template<class T, unsigned M = 0, unsigned N = 0>
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

template<class T, unsigned M = 0, unsigned N = 0>
template<unsigned O>
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


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines