Om  1.0.0
A universal framework for multimedia simulation
Public Member Functions | Static Public Attributes | List of all members
om::math::MatrixND< T, numRows, numColumns > Class Template Reference

A class that represents a matrix of a fixed arbitrary number of rows and columns. More...

#include <omMatrixND.h>

Public Member Functions

 MatrixND ()
 Create a matrix with its elements all equal to zero. More...
 
 MatrixND (const T array[numRows *numColumns])
 Create a matrix from a pointer to an array with elements specified in column-major order. More...
 
T * toArrayColumnMajor ()
 Return a pointer to the matrix's elements in colunn-major order. More...
 
const T * toArrayColumnMajor () const
 Return a pointer to the matrix's elements in colunn-major order. More...
 
VectorND< T, numRows > & getColumn (Index columnIndex)
 Return a reference to the column at the specified index in the matrix. More...
 
const VectorND< T, numRows > & getColumn (Index columnIndex) const
 Return a const reference to the column at the specified index in the matrix. More...
 
VectorND< T, numRows > & operator() (Index columnIndex)
 Return a reference to the column at the specified index in the matrix. More...
 
const VectorND< T, numRows > & operator() (Index columnIndex) const
 Return a const reference to the column at the specified index in the matrix. More...
 
VectorND< T, numRows > & operator[] (Index columnIndex)
 Return a reference the column at the specified index in the matrix. More...
 
const VectorND< T, numRows > & operator[] (Index columnIndex) const
 Return a const reference to the column at the specified index in the matrix. More...
 
VectorND< T, numColumns > getRow (Index rowIndex) const
 Return the row at the specified index in the matrix. More...
 
T & get (Index rowIndex, Index columnIndex)
 Return the element at the specified (row, column) in the matrix. More...
 
const T & get (Index rowIndex, Index columnIndex) const
 Return the element at the specified (row, column) in the matrix. More...
 
T & operator() (Index rowIndex, Index columnIndex)
 Return the element at the specified (row, column) in the matrix. More...
 
const T & operator() (Index rowIndex, Index columnIndex) const
 Return the element at the specified (row, column) in the matrix. More...
 
void setColumn (Index columnIndex, const VectorND< T, numRows > &newColumn)
 Set the column vector at the specified index in the matrix. More...
 
void setRow (Index rowIndex, const VectorND< T, numColumns > &newRow)
 Set the row vector at the specified index in the matrix. More...
 
void set (Index rowIndex, Index columnIndex, T value)
 Get the element at the specified (row, column) in the matrix. More...
 
getDeterminant () const
 Get the determinant of the matrix. More...
 
MatrixND invert () const
 Get the inverse of the matrix if it has one. More...
 
MatrixND orthonormalize () const
 Return the orthonormalization of this matrix. More...
 
MatrixND< T, numColumns, numRows > transpose () const
 Return the transpose of this matrix. More...
 
Bool operator== (const MatrixND< T, numRows, numColumns > &matrix) const
 Return whether or not every component in this matrix is equal to that in another matrix. More...
 
Bool operator!= (const MatrixND< T, numRows, numColumns > &matrix) const
 Return whether or not some component in this matrix is not equal to that in another matrix. More...
 
MatrixND operator- () const
 Negate every element of this matrix and return the resulting matrix. More...
 
MatrixND operator+ () const
 'Positivate' every element of this matrix, returning a copy of the original matrix. More...
 
MatrixND operator+ (const MatrixND< T, numRows, numColumns > &matrix) const
 Add this matrix to another and return the resulting matrix. More...
 
MatrixND operator+ (const T &value) const
 Add a scalar to the elements of this matrix and return the resulting matrix. More...
 
MatrixND operator- (const MatrixND< T, numRows, numColumns > &matrix) const
 Add this matrix to another and return the resulting matrix. More...
 
MatrixND operator- (const T &value) const
 Subtract a scalar from the elements of this matrix and return the resulting matrix. More...
 
template<Size otherColumnDimension>
MatrixND< T, numRows, otherColumnDimension > operator* (const MatrixND< T, numColumns, otherColumnDimension > &matrix)
 Multiply a matrix by this matrix and return the result. More...
 
VectorND< T, numRows > operator* (const VectorND< T, numColumns > &vector)
 Multiply a vector/point by this matrix and return the result. More...
 
MatrixND operator* (const T &value) const
 Multiply the elements of this matrix by a scalar and return the resulting matrix. More...
 
MatrixND operator/ (const T &value) const
 Divide the elements of this matrix by a scalar and return the resulting matrix. More...
 
MatrixNDoperator+= (const MatrixND< T, numRows, numColumns > &matrix)
 Add the elements of another matrix to this matrix. More...
 
MatrixNDoperator+= (const T &value)
 Add a scalar value to the elements of this matrix. More...
 
MatrixNDoperator-= (const MatrixND< T, numRows, numColumns > &matrix)
 Subtract the elements of another matrix from this matrix. More...
 
MatrixNDoperator-= (const T &value)
 Subtract a scalar value from the elements of this matrix. More...
 
MatrixNDoperator*= (const T &value)
 Multiply the elements of this matrix by a scalar value. More...
 
MatrixNDoperator/= (const T &value)
 Divide the elements of this matrix by a scalar value. More...
 
data::String toString () const
 Convert this matrix into a human-readable string representation. More...
 
 operator data::String () const
 Convert this matrix into a human-readable string representation. More...
 

Static Public Attributes

static const MatrixND ZERO
 Constant matrix with all elements equal to zero. More...
 
static const MatrixND IDENTITY = MatrixND<T,numRows,numColumns>::getIdentity()
 Constant matrix that is the identity matrix. More...
 

Detailed Description

template<typename T, Size numRows, Size numColumns>
class om::math::MatrixND< T, numRows, numColumns >

A class that represents a matrix of a fixed arbitrary number of rows and columns.

Constructor & Destructor Documentation

template<typename T, Size numRows, Size numColumns>
om::math::MatrixND< T, numRows, numColumns >::MatrixND ( )
inline

Create a matrix with its elements all equal to zero.

template<typename T, Size numRows, Size numColumns>
om::math::MatrixND< T, numRows, numColumns >::MatrixND ( const T  array[numRows *numColumns])
inline

Create a matrix from a pointer to an array with elements specified in column-major order.

Member Function Documentation

template<typename T, Size numRows, Size numColumns>
T* om::math::MatrixND< T, numRows, numColumns >::toArrayColumnMajor ( )
inline

Return a pointer to the matrix's elements in colunn-major order.

Since matrix elements are stored in column-major order, no allocation is performed and the elements are accessed directly.

template<typename T, Size numRows, Size numColumns>
const T* om::math::MatrixND< T, numRows, numColumns >::toArrayColumnMajor ( ) const
inline

Return a pointer to the matrix's elements in colunn-major order.

Since matrix elements are stored in column-major order, no allocation is performed and the elements are accessed directly.

template<typename T, Size numRows, Size numColumns>
VectorND<T,numRows>& om::math::MatrixND< T, numRows, numColumns >::getColumn ( Index  columnIndex)
inline

Return a reference to the column at the specified index in the matrix.

template<typename T, Size numRows, Size numColumns>
const VectorND<T,numRows>& om::math::MatrixND< T, numRows, numColumns >::getColumn ( Index  columnIndex) const
inline

Return a const reference to the column at the specified index in the matrix.

template<typename T, Size numRows, Size numColumns>
VectorND<T,numRows>& om::math::MatrixND< T, numRows, numColumns >::operator() ( Index  columnIndex)
inline

Return a reference to the column at the specified index in the matrix.

template<typename T, Size numRows, Size numColumns>
const VectorND<T,numRows>& om::math::MatrixND< T, numRows, numColumns >::operator() ( Index  columnIndex) const
inline

Return a const reference to the column at the specified index in the matrix.

template<typename T, Size numRows, Size numColumns>
VectorND<T,numRows>& om::math::MatrixND< T, numRows, numColumns >::operator[] ( Index  columnIndex)
inline

Return a reference the column at the specified index in the matrix.

template<typename T, Size numRows, Size numColumns>
const VectorND<T,numRows>& om::math::MatrixND< T, numRows, numColumns >::operator[] ( Index  columnIndex) const
inline

Return a const reference to the column at the specified index in the matrix.

template<typename T, Size numRows, Size numColumns>
VectorND<T,numColumns> om::math::MatrixND< T, numRows, numColumns >::getRow ( Index  rowIndex) const
inline

Return the row at the specified index in the matrix.

template<typename T, Size numRows, Size numColumns>
T& om::math::MatrixND< T, numRows, numColumns >::get ( Index  rowIndex,
Index  columnIndex 
)
inline

Return the element at the specified (row, column) in the matrix.

template<typename T, Size numRows, Size numColumns>
const T& om::math::MatrixND< T, numRows, numColumns >::get ( Index  rowIndex,
Index  columnIndex 
) const
inline

Return the element at the specified (row, column) in the matrix.

template<typename T, Size numRows, Size numColumns>
T& om::math::MatrixND< T, numRows, numColumns >::operator() ( Index  rowIndex,
Index  columnIndex 
)
inline

Return the element at the specified (row, column) in the matrix.

template<typename T, Size numRows, Size numColumns>
const T& om::math::MatrixND< T, numRows, numColumns >::operator() ( Index  rowIndex,
Index  columnIndex 
) const
inline

Return the element at the specified (row, column) in the matrix.

template<typename T, Size numRows, Size numColumns>
void om::math::MatrixND< T, numRows, numColumns >::setColumn ( Index  columnIndex,
const VectorND< T, numRows > &  newColumn 
)
inline

Set the column vector at the specified index in the matrix.

template<typename T, Size numRows, Size numColumns>
void om::math::MatrixND< T, numRows, numColumns >::setRow ( Index  rowIndex,
const VectorND< T, numColumns > &  newRow 
)
inline

Set the row vector at the specified index in the matrix.

template<typename T, Size numRows, Size numColumns>
void om::math::MatrixND< T, numRows, numColumns >::set ( Index  rowIndex,
Index  columnIndex,
value 
)
inline

Get the element at the specified (row, column) in the matrix.

template<typename T, Size numRows, Size numColumns>
T om::math::MatrixND< T, numRows, numColumns >::getDeterminant ( ) const
inline

Get the determinant of the matrix.

template<typename T, Size numRows, Size numColumns>
MatrixND om::math::MatrixND< T, numRows, numColumns >::invert ( ) const
inline

Get the inverse of the matrix if it has one.

template<typename T, Size numRows, Size numColumns>
MatrixND om::math::MatrixND< T, numRows, numColumns >::orthonormalize ( ) const
inline

Return the orthonormalization of this matrix.

template<typename T, Size numRows, Size numColumns>
MatrixND<T,numColumns,numRows> om::math::MatrixND< T, numRows, numColumns >::transpose ( ) const
inline

Return the transpose of this matrix.

template<typename T, Size numRows, Size numColumns>
Bool om::math::MatrixND< T, numRows, numColumns >::operator== ( const MatrixND< T, numRows, numColumns > &  matrix) const
inline

Return whether or not every component in this matrix is equal to that in another matrix.

template<typename T, Size numRows, Size numColumns>
Bool om::math::MatrixND< T, numRows, numColumns >::operator!= ( const MatrixND< T, numRows, numColumns > &  matrix) const
inline

Return whether or not some component in this matrix is not equal to that in another matrix.

template<typename T, Size numRows, Size numColumns>
MatrixND om::math::MatrixND< T, numRows, numColumns >::operator- ( ) const
inline

Negate every element of this matrix and return the resulting matrix.

template<typename T, Size numRows, Size numColumns>
MatrixND om::math::MatrixND< T, numRows, numColumns >::operator+ ( ) const
inline

'Positivate' every element of this matrix, returning a copy of the original matrix.

template<typename T, Size numRows, Size numColumns>
MatrixND om::math::MatrixND< T, numRows, numColumns >::operator+ ( const MatrixND< T, numRows, numColumns > &  matrix) const
inline

Add this matrix to another and return the resulting matrix.

template<typename T, Size numRows, Size numColumns>
MatrixND om::math::MatrixND< T, numRows, numColumns >::operator+ ( const T &  value) const
inline

Add a scalar to the elements of this matrix and return the resulting matrix.

template<typename T, Size numRows, Size numColumns>
MatrixND om::math::MatrixND< T, numRows, numColumns >::operator- ( const MatrixND< T, numRows, numColumns > &  matrix) const
inline

Add this matrix to another and return the resulting matrix.

template<typename T, Size numRows, Size numColumns>
MatrixND om::math::MatrixND< T, numRows, numColumns >::operator- ( const T &  value) const
inline

Subtract a scalar from the elements of this matrix and return the resulting matrix.

template<typename T, Size numRows, Size numColumns>
template<Size otherColumnDimension>
MatrixND<T,numRows,otherColumnDimension> om::math::MatrixND< T, numRows, numColumns >::operator* ( const MatrixND< T, numColumns, otherColumnDimension > &  matrix)
inline

Multiply a matrix by this matrix and return the result.

template<typename T, Size numRows, Size numColumns>
VectorND<T,numRows> om::math::MatrixND< T, numRows, numColumns >::operator* ( const VectorND< T, numColumns > &  vector)
inline

Multiply a vector/point by this matrix and return the result.

template<typename T, Size numRows, Size numColumns>
MatrixND om::math::MatrixND< T, numRows, numColumns >::operator* ( const T &  value) const
inline

Multiply the elements of this matrix by a scalar and return the resulting matrix.

template<typename T, Size numRows, Size numColumns>
MatrixND om::math::MatrixND< T, numRows, numColumns >::operator/ ( const T &  value) const
inline

Divide the elements of this matrix by a scalar and return the resulting matrix.

template<typename T, Size numRows, Size numColumns>
MatrixND& om::math::MatrixND< T, numRows, numColumns >::operator+= ( const MatrixND< T, numRows, numColumns > &  matrix)
inline

Add the elements of another matrix to this matrix.

template<typename T, Size numRows, Size numColumns>
MatrixND& om::math::MatrixND< T, numRows, numColumns >::operator+= ( const T &  value)
inline

Add a scalar value to the elements of this matrix.

template<typename T, Size numRows, Size numColumns>
MatrixND& om::math::MatrixND< T, numRows, numColumns >::operator-= ( const MatrixND< T, numRows, numColumns > &  matrix)
inline

Subtract the elements of another matrix from this matrix.

template<typename T, Size numRows, Size numColumns>
MatrixND& om::math::MatrixND< T, numRows, numColumns >::operator-= ( const T &  value)
inline

Subtract a scalar value from the elements of this matrix.

template<typename T, Size numRows, Size numColumns>
MatrixND& om::math::MatrixND< T, numRows, numColumns >::operator*= ( const T &  value)
inline

Multiply the elements of this matrix by a scalar value.

template<typename T, Size numRows, Size numColumns>
MatrixND& om::math::MatrixND< T, numRows, numColumns >::operator/= ( const T &  value)
inline

Divide the elements of this matrix by a scalar value.

template<typename T, Size numRows, Size numColumns>
data::String om::math::MatrixND< T, numRows, numColumns >::toString ( ) const
inline

Convert this matrix into a human-readable string representation.

template<typename T, Size numRows, Size numColumns>
om::math::MatrixND< T, numRows, numColumns >::operator data::String ( ) const
inline

Convert this matrix into a human-readable string representation.

Member Data Documentation

template<typename T, Size numRows, Size numColumns>
const MatrixND< T, numRows, numColumns > om::math::MatrixND< T, numRows, numColumns >::ZERO
static

Constant matrix with all elements equal to zero.

template<typename T, Size numRows, Size numColumns>
const MatrixND< T, numRows, numColumns > om::math::MatrixND< T, numRows, numColumns >::IDENTITY = MatrixND<T,numRows,numColumns>::getIdentity()
static

Constant matrix that is the identity matrix.


The documentation for this class was generated from the following file: