Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

Phx::Matrix< Rows, Cols, value_type > Class Template Reference

A dimension-templatized class for matrices of values. More...

#include <PhxMatrix.h>

List of all members.

Public Member Functions

 Matrix (const value_type *data)
uint32_t rows () const
uint32_t columns () const
value_type element (uint16_t row, uint16_t col) const
value_type & element (uint16_t row, uint16_t col)
void element (uint16_t row, uint16_t col, value_type value)
template<uint16_t RowRangeSize, uint16_t ColRangeSize>
Matrix< RowRangeSize, ColRangeSize,
value_type > 
subMatrix (const Matrix< 1, RowRangeSize, uint16_t > &rowRange, const Matrix< 1, ColRangeSize, uint16_t > &colRange)
template<uint32_t RowRangeSize, uint32_t ColRangeSize>
Matrix< RowRangeSize, ColRangeSize,
value_type > 
operator() (const Matrix< 1, RowRangeSize, uint16_t > &rowRange, const Matrix< 1, ColRangeSize, uint16_t > &colRange)
template<uint16_t RhsCols>
Matrix< Rows, RhsCols, value_type > operator * (const Matrix< Cols, RhsCols, value_type > &rhs) const
 Matrix multiplication operator.
Matrix< Rows, Cols, value_type > operator+ (const Matrix< Rows, Cols, value_type > &rhs) const
 Element-wise addition operator.
Matrix< Rows, Cols, value_type > operator- (const Matrix< Rows, Cols, value_type > &rhs) const
 Element-wise subtraction operator.
Matrix< Rows, Cols, value_type > operator * (value_type s) const
 Scalar multiplication operator.
Matrix< Rows, Cols, value_type > operator/ (value_type s) const
 Scalar division operator.
Matrix< Rows, Cols, value_type > operator- (void) const
 Unary negation operator.
Matrix< Cols, Rows, value_type > transpose (void) const
 Returns the matrix transpose of this matrix.
value_type * data ()
const value_type * data () const

Static Public Member Functions

static Matrix< Rows, Cols,
value_type > 
identity ()
 Returns an "identity" matrix with dimensions given by the class's template parameters.
static Matrix< Rows, Cols,
value_type > 
zero ()
 Returns a zero matrix with dimensions given by the class's template parameters.

Friends

template<uint16_t Rows2, uint16_t Cols2, typename value_type2>
std::ostream & operator<< (std::ostream &os, const Matrix< Rows2, Cols2, value_type2 > &rhs)
template<uint16_t Rows2, uint16_t Cols2, typename value_type2>
std::istream & operator>> (std::istream &is, Matrix< Rows2, Cols2, value_type2 > &rhs)


Detailed Description

template<uint16_t Rows, uint16_t Cols, typename value_type = double>
class Phx::Matrix< Rows, Cols, value_type >

A dimension-templatized class for matrices of values.

This template class generically supports any constant-sized matrix of values. The Rows and Cols template parameters define the size of the matrix at compile-time. Hence, the size of the matrix cannot be chosen at runtime. However, the dimensions are appropriately type-checked at compile-time where possible.

By default, the matrix contains values of type double. The value_type template parameter may be selected to allow matrices of integers or floats.

Note:
At present, type cohersion between matrices with different value_type parameters is not implemented. It is recommended that matrices with value type double be used for all numerical computation.
Note that the special cases of row and column vectors are subsumed by this class.


Member Function Documentation

template<uint16_t Rows, uint16_t Cols, typename value_type = double>
static Matrix<Rows, Cols, value_type> Phx::Matrix< Rows, Cols, value_type >::identity  )  [inline, static]
 

Returns an "identity" matrix with dimensions given by the class's template parameters.

In the case that Rows != Cols, this matrix is simply the one where the Aii elements for i < min(Rows, Cols) are 1, and all other elements are 0.

Returns:
A Matrix<Rows, Cols, value_type> with off-diagonal elements set to 0, and diagonal elements set to 1.

template<uint16_t Rows, uint16_t Cols, typename value_type = double>
Matrix<Rows, Cols, value_type> Phx::Matrix< Rows, Cols, value_type >::operator * value_type  s  )  const [inline]
 

Scalar multiplication operator.

Returns:
A matrix where result(i,j) = (*this)(i,j) * s.

template<uint16_t Rows, uint16_t Cols, typename value_type = double>
template<uint16_t RhsCols>
Matrix<Rows, RhsCols, value_type> Phx::Matrix< Rows, Cols, value_type >::operator * const Matrix< Cols, RhsCols, value_type > &  rhs  )  const [inline]
 

Matrix multiplication operator.

Returns:
A matrix where result is the matrix product (*this) * rhs.

template<uint16_t Rows, uint16_t Cols, typename value_type = double>
Matrix<Rows, Cols, value_type> Phx::Matrix< Rows, Cols, value_type >::operator+ const Matrix< Rows, Cols, value_type > &  rhs  )  const [inline]
 

Element-wise addition operator.

Returns:
A matrix where result(i,j) = (*this)(i,j) + rhs(i,j).

template<uint16_t Rows, uint16_t Cols, typename value_type = double>
Matrix<Rows, Cols, value_type> Phx::Matrix< Rows, Cols, value_type >::operator- void   )  const [inline]
 

Unary negation operator.

Returns:
A matrix where result(i,j) = -(*this)(i,j).

template<uint16_t Rows, uint16_t Cols, typename value_type = double>
Matrix<Rows, Cols, value_type> Phx::Matrix< Rows, Cols, value_type >::operator- const Matrix< Rows, Cols, value_type > &  rhs  )  const [inline]
 

Element-wise subtraction operator.

Returns:
A matrix where result(i,j) = (*this)(i,j) - rhs(i,j).

template<uint16_t Rows, uint16_t Cols, typename value_type = double>
Matrix<Rows, Cols, value_type> Phx::Matrix< Rows, Cols, value_type >::operator/ value_type  s  )  const [inline]
 

Scalar division operator.

Returns:
A matrix where result(i,j) = (*this)(i,j) / s.

template<uint16_t Rows, uint16_t Cols, typename value_type = double>
Matrix<Cols, Rows, value_type> Phx::Matrix< Rows, Cols, value_type >::transpose void   )  const [inline]
 

Returns the matrix transpose of this matrix.

Returns:
A Matrix of dimension Cols by Rows where result(i,j) = (*this)(j,i) for each element.

template<uint16_t Rows, uint16_t Cols, typename value_type = double>
static Matrix<Rows, Cols, value_type> Phx::Matrix< Rows, Cols, value_type >::zero  )  [inline, static]
 

Returns a zero matrix with dimensions given by the class's template parameters.

Returns:
A Matrix<Rows, Cols, value_type> containing all 0.


The documentation for this class was generated from the following file:
Generated on Wed Dec 21 22:05:39 2005 for Phoenix OSFS by  doxygen 1.4.2