Main Page   Groups   Namespaces  

mini3d::matrix< T, nR, nC > Class Template Reference
[Template]

matrix - this class implements a 2D matrix templated by the element type and the size type More...

List of all members.

Public Types

typedef int size_t

Public Member Functions

 matrix ()
 Default constructor.
 matrix (const matrix<T, nR, nC>& src)
 Copy constructor.
virtual ~matrix ()
 Destructor.
matrix<T, nR, nC> operator+ (const matrix<T, nR, nC>& rhs) const
 The matrix addition operator.
matrix<T, nR, nC>& operator+= (const matrix<T, nR, nC>& rhs)
 The in place matrix addition operator.
matrix<T, nR, nC> operator- ()
 The unary operator.
matrix<T, nR, nC> operator- (const matrix<T, nR, nC>& rhs) const
 The matrix subtraction operator.
matrix<T, nR, nC>& operator-= (const matrix<T, nR, nC>& rhs)
 The in place matrix subtraction operator.
matrix<T, nR, nC>& operator*= (int scale)
 The in place scalar multiplication operator.
matrix<T, nR, nC>& operator*= (float scale)
 The in place scalar multiplication operator.
matrix<T, nR, nC>& operator*= (double scale)
 The in place scalar multiplication operator.
matrix<T, nR, nC> operator* (int scale) const
 The scalar multiplication operator.
matrix<T, nR, nC> operator* (float scale) const
 The scalar multiplication operator.
matrix<T, nR, nC> operator* (double scale) const
 The scalar multiplication operator.
matrix<T, nR, nC>& operator/= (int scale)
 The in place scalar division operator.
matrix<T, nR, nC>& operator/= (float scale)
 The in place scalar division operator.
matrix<T, nR, nC>& operator/= (double scale)
 The in place scalar division operator.
matrix<T, nR, nC> operator/ (int scale) const
 The scalar division operator.
matrix<T, nR, nC> operator/ (float scale) const
 The scalar division operator.
matrix<T, nR, nC> operator/ (double scale) const
 The scalar division operator.
T& operator() (size_t row, size_t col)
 Get the element of the matrix (lvalue).
operator() (size_t row, size_t col) const
 Get the element of the matrix (rvalue).
template<int nC2>
matrix<T, nR, nC2> operator* (const matrix<T, nC, nC2>& b)
 Matrix multiplication function.
matrix<T, nR, nC>& operator= (const matrix<T, nR, nC>& src)
 The assignment operator.
size_t numRow () const
 Get the number of row of this matrix.
size_t numCol () const
 Get the number of column of this matrix.
bool isSquare () const
 Is it a square matrix.
matrix<T, nC, nR> transpose () const
 Get a transpose of this matrix.
void makeIdentity ()
 Make an identity matrix.
void makeZero ()
 Make a zero matrix.
void trim (T epsilon=EPSILON)
 Trim the element and set it to zero if < epsilon.

Protected Attributes

_m [nR][nC]

Friends

matrix<T, nR, nC> operator* (int scale, const matrix<T, nR, nC>& rhs)
 The scalar multiplication operator that allows the scalar value to preceed the matrix.
matrix<T, nR, nC> operator* (float scale, const matrix<T, nR, nC>& rhs)
 The scalar multiplication operator that allows the scalar value to preceed the matrix.
matrix<T, nR, nC> operator* (double scale, const matrix<T, nR, nC>& rhs)
 The scalar multiplication operator that allows the scalar value to preceed the matrix.
std::ostream& operator<< (std::ostream& os, const matrix<T, nR, nC>& m)
 The out stream operator.
std::istream& operator>> (std::istream& is, matrix<T, nR, nC>& m)
 The in stream operator.


Detailed Description

template <typename T, int nR, int nC>
class mini3d::matrix< T, nR, nC >

matrix - this class implements a 2D matrix templated by the element type and the size type


Member Typedef Documentation

template <typename T, int nR, int nC>
typedef int mini3d::matrix<T, nR, nC>::size_t
 


Constructor & Destructor Documentation

template <typename T, int nR, int nC>
mini3d::matrix<T, nR, nC>::matrix (  )  [inline]
 

Default constructor.

create a nR x nC matrix, m(i, j) = 0

template <typename T, int nR, int nC>
mini3d::matrix<T, nR, nC>::matrix ( const matrix<T, nR, nC>&  src  )  [inline]
 

Copy constructor.

Parameters:
src the matrix to be copied from

template <typename T, int nR, int nC>
virtual mini3d::matrix<T, nR, nC>::~matrix (  )  [inline, virtual]
 

Destructor.


Member Function Documentation

template <typename T, int nR, int nC>
bool mini3d::matrix<T, nR, nC>::isSquare (  )  const [inline]
 

Is it a square matrix.

Returns:
true if it is square matrix, otherwise.

template <typename T, int nR, int nC>
void mini3d::matrix<T, nR, nC>::makeIdentity (  )  [inline]
 

Make an identity matrix.

template <typename T, int nR, int nC>
void mini3d::matrix<T, nR, nC>::makeZero (  )  [inline]
 

Make a zero matrix.

template <typename T, int nR, int nC>
size_t mini3d::matrix<T, nR, nC>::numCol (  )  const [inline]
 

Get the number of column of this matrix.

Returns:
the number of column of this matrix

template <typename T, int nR, int nC>
size_t mini3d::matrix<T, nR, nC>::numRow (  )  const [inline]
 

Get the number of row of this matrix.

Returns:
the number of row of this matrix

template <typename T, int nR, int nC>
template <int nC2>
matrix<T, nR, nC2> mini3d::matrix<T, nR, nC>::operator* ( const matrix<T, nC, nC2>&  b  )  [inline]
 

Matrix multiplication function.

Parameters:
b rhs matrix
Returns:
(*this) * b

template <typename T, int nR, int nC>
matrix<T, nR, nC> mini3d::matrix<T, nR, nC>::operator* ( double  scale  )  const [inline]
 

The scalar multiplication operator.

Parameters:
scale a double scalar which you want to multiply
Returns:
the matrix after the multiplication

template <typename T, int nR, int nC>
matrix<T, nR, nC> mini3d::matrix<T, nR, nC>::operator* ( float  scale  )  const [inline]
 

The scalar multiplication operator.

Parameters:
scale a float scalar which you want to multiply
Returns:
the matrix after the multiplication

template <typename T, int nR, int nC>
matrix<T, nR, nC> mini3d::matrix<T, nR, nC>::operator* ( int  scale  )  const [inline]
 

The scalar multiplication operator.

Parameters:
scale an int scalar which you want to multiply
Returns:
the matrix after the multiplication

template <typename T, int nR, int nC>
matrix<T, nR, nC>& mini3d::matrix<T, nR, nC>::operator*= ( double  scale  )  [inline]
 

The in place scalar multiplication operator.

Parameters:
scale a double scalar which you want to multiply
Returns:
this matrix after the multiplication

template <typename T, int nR, int nC>
matrix<T, nR, nC>& mini3d::matrix<T, nR, nC>::operator*= ( float  scale  )  [inline]
 

The in place scalar multiplication operator.

Parameters:
scale a float scalar which you want to multiply
Returns:
this matrix after the multiplication

template <typename T, int nR, int nC>
matrix<T, nR, nC>& mini3d::matrix<T, nR, nC>::operator*= ( int  scale  )  [inline]
 

The in place scalar multiplication operator.

Parameters:
scale an int scalar which you want to multiply
Returns:
this matrix after the multiplication

template <typename T, int nR, int nC>
T mini3d::matrix<T, nR, nC>::operator() ( size_t  row,
size_t  col
const [inline]
 

Get the element of the matrix (rvalue).

Parameters:
row the row index of the element
col the column index of the element
Returns:
the element of the matrix at the specified location

template <typename T, int nR, int nC>
T& mini3d::matrix<T, nR, nC>::operator() ( size_t  row,
size_t  col
[inline]
 

Get the element of the matrix (lvalue).

Parameters:
row the row index of the element
col the column index of the element
Returns:
the element of the matrix at the specified location

template <typename T, int nR, int nC>
matrix<T, nR, nC> mini3d::matrix<T, nR, nC>::operator+ ( const matrix<T, nR, nC>&  rhs  )  const [inline]
 

The matrix addition operator.

Parameters:
rhs the matrix which you want to add
Returns:
the matrix after the addition

template <typename T, int nR, int nC>
matrix<T, nR, nC>& mini3d::matrix<T, nR, nC>::operator+= ( const matrix<T, nR, nC>&  rhs  )  [inline]
 

The in place matrix addition operator.

Parameters:
rhs the matrix which you want to add
Returns:
this matrix after the addition

template <typename T, int nR, int nC>
matrix<T, nR, nC> mini3d::matrix<T, nR, nC>::operator- ( const matrix<T, nR, nC>&  rhs  )  const [inline]
 

The matrix subtraction operator.

Parameters:
rhs the matrix which you want to subtract
Returns:
the matrix after the subtraction

template <typename T, int nR, int nC>
matrix<T, nR, nC> mini3d::matrix<T, nR, nC>::operator- (  )  [inline]
 

The unary operator.

Returns:
the unary of this matrix

template <typename T, int nR, int nC>
matrix<T, nR, nC>& mini3d::matrix<T, nR, nC>::operator-= ( const matrix<T, nR, nC>&  rhs  )  [inline]
 

The in place matrix subtraction operator.

Parameters:
rhs the matrix which you want to subtract
Returns:
this matrix after the subtraction

template <typename T, int nR, int nC>
matrix<T, nR, nC> mini3d::matrix<T, nR, nC>::operator/ ( double  scale  )  const [inline]
 

The scalar division operator.

Parameters:
scale a double scalar which you want to divide
Returns:
the matrix after the division

template <typename T, int nR, int nC>
matrix<T, nR, nC> mini3d::matrix<T, nR, nC>::operator/ ( float  scale  )  const [inline]
 

The scalar division operator.

Parameters:
scale a float scalar which you want to divide
Returns:
the matrix after the division

template <typename T, int nR, int nC>
matrix<T, nR, nC> mini3d::matrix<T, nR, nC>::operator/ ( int  scale  )  const [inline]
 

The scalar division operator.

Parameters:
scale an int scalar which you want to divide
Returns:
the matrix after the division

template <typename T, int nR, int nC>
matrix<T, nR, nC>& mini3d::matrix<T, nR, nC>::operator/= ( double  scale  )  [inline]
 

The in place scalar division operator.

Parameters:
scale a double scalar which you want to divide
Returns:
this matrix after the division

template <typename T, int nR, int nC>
matrix<T, nR, nC>& mini3d::matrix<T, nR, nC>::operator/= ( float  scale  )  [inline]
 

The in place scalar division operator.

Parameters:
scale a float scalar which you want to divide
Returns:
this matrix after the division

template <typename T, int nR, int nC>
matrix<T, nR, nC>& mini3d::matrix<T, nR, nC>::operator/= ( int  scale  )  [inline]
 

The in place scalar division operator.

Parameters:
scale an int scalar which you want to divide
Returns:
this matrix after the division

template <typename T, int nR, int nC>
matrix<T, nR, nC>& mini3d::matrix<T, nR, nC>::operator= ( const matrix<T, nR, nC>&  src  )  [inline]
 

The assignment operator.

Parameters:
src the matrix you want to copy from
Returns:
this matrix after the assigment

template <typename T, int nR, int nC>
matrix<T, nC, nR> mini3d::matrix<T, nR, nC>::transpose (  )  const [inline]
 

Get a transpose of this matrix.

Returns:
transpose of this matrix

Reimplemented in mini3d::matrix3d, and mini3d::matrix4d.

template <typename T, int nR, int nC>
void mini3d::matrix<T, nR, nC>::trim ( epsilon = EPSILON  )  [inline]
 

Trim the element and set it to zero if < epsilon.

Parameters:
epsilon the epsilon for testing of equality


Friends And Related Function Documentation

template <typename T, int nR, int nC>
matrix<T, nR, nC> operator* ( double  scale,
const matrix<T, nR, nC>&  rhs
[friend]
 

The scalar multiplication operator that allows the scalar value to preceed the matrix.

Parameters:
scale a double scalar which you want to multiply
Returns:
the matrix after the multiplication

template <typename T, int nR, int nC>
matrix<T, nR, nC> operator* ( float  scale,
const matrix<T, nR, nC>&  rhs
[friend]
 

The scalar multiplication operator that allows the scalar value to preceed the matrix.

Parameters:
scale a float scalar which you want to multiply
Returns:
the matrix after the multiplication

template <typename T, int nR, int nC>
matrix<T, nR, nC> operator* ( int  scale,
const matrix<T, nR, nC>&  rhs
[friend]
 

The scalar multiplication operator that allows the scalar value to preceed the matrix.

Parameters:
scale an int scalar which you want to multiply
Returns:
the matrix after the multiplication

template <typename T, int nR, int nC>
std::ostream& operator<< ( std::ostream&  os,
const matrix<T, nR, nC>&  m
[friend]
 

The out stream operator.

Parameters:
os the ostream
m the matrix
Returns:
the ostream

template <typename T, int nR, int nC>
std::istream& operator>> ( std::istream&  is,
matrix<T, nR, nC>&  m
[friend]
 

The in stream operator.

Parameters:
is the istream
m the matrix
Returns:
the istream


Member Data Documentation

template <typename T, int nR, int nC>
T mini3d::matrix<T, nR, nC>::_m[nR][nC] [protected]
 


The documentation for this class was generated from the following file:
Generated for libmini3d by Doxygen 1.4.4 © 1997-2001