#include <Matrix.h>
Public Member Functions | |
Matrix () | |
Creates a 0x0 empty matrix. | |
Matrix (int rows, int columns) | |
Creates a matrix with the specified number of rows and columns. | |
Matrix (const Matrix< T > &) | |
Copy constructor. | |
void | setZero () |
Sets all the values in this matrix to zero. | |
void | setIdentity () |
Sets the diagonal elements to 1, all other elements to zero. | |
virtual void | setSize (int rows, int columns) |
Changes the size dynamically. | |
int | getNumRows () const |
Returns the number of rows. | |
int | getNumColumns () const |
Returns the number of columns. | |
T & | operator() (int i, int j) |
Gets a reference to the element at row i, column j. | |
T | operator() (int i, int j) const |
Gets the element at row i, column j. | |
T & | operator[] (int i) |
Gets a reference to an element. | |
T | operator[] (int i) const |
Gets an element. | |
Matrix< T > & | operator= (const Matrix< T > &) |
Copies another matrix onto this matrix. | |
bool | operator== (const Matrix< T > &) const |
Tests whether two matrices are equal. | |
int | operator!= (const Matrix< T > &B) const |
Tests whether two matrices are not equal. | |
Matrix< T > | operator+ () const |
Unary plus operation. | |
Matrix< T > | operator- () const |
Unary minus operation. | |
Matrix< T > | operator+ (const Matrix< T > &) const |
Adds two matrices. | |
Matrix< T > | operator- (const Matrix< T > &) const |
Subtracts a matrix. | |
MVector< T > | operator* (const MVector< T > &) const |
Multiples the matrix by another matrix. | |
Matrix< T > | operator* (T) const |
Multiples the matrix by a scalar. | |
Matrix< T > | operator/ (T) const |
Divides the matrix by a scalar. | |
Matrix< T > | operator^ (int) const |
Calculates an integer power of the matrix. | |
Matrix< T > | operator* (const Matrix< T > &) const |
Multiplies the matrix by another matrix. | |
Matrix< T > & | operator+= (const Matrix< T > &) |
Adds a matrix. | |
Matrix< T > & | operator-= (const Matrix< T > &) |
Subtracts a matrix. | |
Matrix< T > & | operator*= (T) |
Multiplies by a scalar. | |
Matrix< T > & | operator/= (T) |
Divides by a scalar. | |
Matrix< T > & | operator*= (const Matrix< T > &B) |
Multiplies the matrix by another matrix. | |
Matrix< T > & | operator^= (int) |
Calculates an integer power. | |
Matrix< T > | operator~ () const |
Returns the transpose of this matrix. | |
Matrix< T > | minorMatrix (int row, int column) const |
Returns a matrix constructed by the removal of the specified row and column of this matrix. | |
T | trace () const |
Returns the trace. | |
T | det () const |
Returns the determinant. | |
void | invert () |
Inverts this matrix. | |
void | invert (const Matrix< T > &) |
Inverts the specified matrix and places new values into this matrix. | |
void | swapRows (int i, int j) |
Swaps two rows. | |
Protected Attributes | |
T * | x |
Array of matrix components. | |
int | numRows |
Number of rows. | |
int | numColumns |
Number of columns. | |
Friends | |
template<class T2> | |
Matrix< T2 > | operator* (T2 s, const Matrix< T2 > &A) |
Multiplies a scalar by a matrix. | |
template<class T2> | |
MVector< T2 > | operator* (const MVector< T2 > &, const Matrix< T2 > &) |
Multiplies the matrix by a scalar. | |
template<class T2> | |
MVector< T2 > | operator/ (const MVector< T2 > &, const Matrix< T2 > &) |
Solve linear system of equations. | |
template<class T2> | |
std::istream & | operator>> (std::istream &, Matrix< T2 > &) |
Reads a matrix from a stream. | |
template<class T2> | |
std::ostream & | operator<< (std::ostream &, const Matrix< T2 > &) |
Writes a matrix into a stream. |
gridripper::math::Matrix< T >::Matrix | ( | ) | [inline] |
Creates a 0x0 empty matrix.
gridripper::math::Matrix< T >::Matrix | ( | int | rows, | |
int | columns | |||
) |
Creates a matrix with the specified number of rows and columns.
gridripper::math::Matrix< T >::Matrix | ( | const Matrix< T > & | ) |
Copy constructor.
void gridripper::math::Matrix< T >::setZero | ( | ) |
Sets all the values in this matrix to zero.
void gridripper::math::Matrix< T >::setIdentity | ( | ) |
Sets the diagonal elements to 1, all other elements to zero.
virtual void gridripper::math::Matrix< T >::setSize | ( | int | rows, | |
int | columns | |||
) | [virtual] |
Changes the size dynamically.
int gridripper::math::Matrix< T >::getNumRows | ( | ) | const [inline] |
Returns the number of rows.
int gridripper::math::Matrix< T >::getNumColumns | ( | ) | const [inline] |
Returns the number of columns.
T& gridripper::math::Matrix< T >::operator[] | ( | int | i | ) | [inline] |
Gets a reference to an element.
i | element index, it must be less than the total number of elements (numRows*numColumns) |
T gridripper::math::Matrix< T >::operator[] | ( | int | i | ) | const [inline] |
Gets an element.
i | element index, it must be less than the total number of elements (numRows*numColumns) |
Matrix<T>& gridripper::math::Matrix< T >::operator= | ( | const Matrix< T > & | ) |
Copies another matrix onto this matrix.
bool gridripper::math::Matrix< T >::operator== | ( | const Matrix< T > & | ) | const |
Tests whether two matrices are equal.
int gridripper::math::Matrix< T >::operator!= | ( | const Matrix< T > & | B | ) | const [inline] |
Tests whether two matrices are not equal.
Matrix<T> gridripper::math::Matrix< T >::operator+ | ( | ) | const [inline] |
Unary plus operation.
Matrix<T> gridripper::math::Matrix< T >::operator- | ( | ) | const |
Unary minus operation.
Matrix<T> gridripper::math::Matrix< T >::operator+ | ( | const Matrix< T > & | ) | const |
Adds two matrices.
Matrix<T> gridripper::math::Matrix< T >::operator- | ( | const Matrix< T > & | ) | const |
Subtracts a matrix.
MVector<T> gridripper::math::Matrix< T >::operator* | ( | const MVector< T > & | ) | const |
Multiples the matrix by another matrix.
Matrix<T> gridripper::math::Matrix< T >::operator* | ( | T | ) | const |
Multiples the matrix by a scalar.
Matrix<T> gridripper::math::Matrix< T >::operator/ | ( | T | ) | const |
Divides the matrix by a scalar.
Matrix<T> gridripper::math::Matrix< T >::operator^ | ( | int | ) | const |
Calculates an integer power of the matrix.
Matrix<T> gridripper::math::Matrix< T >::operator* | ( | const Matrix< T > & | ) | const |
Multiplies the matrix by another matrix.
Matrix<T>& gridripper::math::Matrix< T >::operator+= | ( | const Matrix< T > & | ) |
Adds a matrix.
Matrix<T>& gridripper::math::Matrix< T >::operator-= | ( | const Matrix< T > & | ) |
Subtracts a matrix.
Matrix<T>& gridripper::math::Matrix< T >::operator*= | ( | T | ) |
Multiplies by a scalar.
Matrix<T>& gridripper::math::Matrix< T >::operator/= | ( | T | ) |
Divides by a scalar.
Matrix<T>& gridripper::math::Matrix< T >::operator*= | ( | const Matrix< T > & | B | ) | [inline] |
Multiplies the matrix by another matrix.
Matrix<T>& gridripper::math::Matrix< T >::operator^= | ( | int | ) |
Calculates an integer power.
Matrix<T> gridripper::math::Matrix< T >::operator~ | ( | ) | const |
Returns the transpose of this matrix.
T gridripper::math::Matrix< T >::trace | ( | ) | const |
Returns the trace.
T gridripper::math::Matrix< T >::det | ( | ) | const |
Returns the determinant.
void gridripper::math::Matrix< T >::invert | ( | ) | [inline] |
Inverts this matrix.
void gridripper::math::Matrix< T >::invert | ( | const Matrix< T > & | ) |
Inverts the specified matrix and places new values into this matrix.
void gridripper::math::Matrix< T >::swapRows | ( | int | i, | |
int | j | |||
) |
Swaps two rows.
Multiplies a scalar by a matrix.
MVector<T2> operator* | ( | const MVector< T2 > & | , | |
const Matrix< T2 > & | ||||
) | [friend] |
Multiplies the matrix by a scalar.
MVector<T2> operator/ | ( | const MVector< T2 > & | , | |
const Matrix< T2 > & | ||||
) | [friend] |
Solve linear system of equations.
std::istream& operator>> | ( | std::istream & | , | |
Matrix< T2 > & | ||||
) | [friend] |
Reads a matrix from a stream.
std::ostream& operator<< | ( | std::ostream & | , | |
const Matrix< T2 > & | ||||
) | [friend] |
Writes a matrix into a stream.
T* gridripper::math::Matrix< T >::x [protected] |
Array of matrix components.
int gridripper::math::Matrix< T >::numRows [protected] |
Number of rows.
int gridripper::math::Matrix< T >::numColumns [protected] |
Number of columns.