Matrix class implements a template for operations on matrices. More...
#include <Matrix.h>
Public Member Functions | |
| Matrix (Integer rows=0, Integer cols=0) | |
| Default constructor. | |
| Matrix (Const Matrix &m) | |
| Copy constructor. | |
| Void | SetSize (Integer rows, Integer cols) |
| Set the size of a matrix. | |
| List< Type > & | operator[] (Integer index) |
| Indexing operator for matrix. | |
| Matrix & | operator= (Const Matrix &m) |
| Assignment/copy operator for matrix. | |
| Bool | operator== (Const Matrix &m) |
| Equality of two matrices. | |
| Bool | operator!= (Const Matrix &m) |
| Inequality of two matrices. | |
| Const Matrix | operator+ (Const Matrix &m) |
| Add two identical matrices. | |
| Const Matrix | operator- (Const Matrix &m) |
| Subtract two identical matrices. | |
| Const Matrix | operator* (Const Integer R) |
| Multiply matrix by a constant Integer. | |
| Const Matrix | operator* (Const Real R) |
| Multiply matrix by a constant Real. | |
| Const Matrix | operator+ (Const Integer R) |
| Add constant Integer to matrix. | |
| Const Matrix | operator+ (Const Real R) |
| Add constant Real to matrix. | |
| Const Matrix | operator- (Const Integer R) |
| Subtract constant Integer from matrix. | |
| Const Matrix | operator- (Const Real R) |
| Subtract constant Real from matrix. | |
| Const Matrix | operator* (Matrix &m) |
| Matrix multiplication. Columns of first matrix must be same size as rows of second. | |
| Void | print (String s=0) |
| Print a row of a matrix. | |
| Type | rows () |
| Return the number of rows in the Matrix. | |
| Type | cols () |
| Return the number of columns in the Matrix. | |
| Void | length (Integer &r, Integer &c) |
| Return the number of rows and columns in the Matrix by reference. | |
Friends | |
| ostream & | operator<< (ostream &os, Const Matrix &m) |
| Print a matrix to stdout. | |
| istream & | operator>> (istream &is, Matrix &m) |
| Scan a matrix from stdin. | |
Matrix class implements a template for operations on matrices.
Definition at line 27 of file Matrix.h.
Default constructor.
Definition at line 50 of file Matrix.h.
References Matrix< Type >::cols(), Matrix< Type >::rows(), and Matrix< Type >::SetSize().
Copy constructor.
Definition at line 55 of file Matrix.h.
References Matrix< Type >::SetSize().
: m_matrix(NULL) {
SetSize(m.m_lenRow, m.m_lenCol);
for (Integer r=0; r < m_lenRow; r++)
m_matrix[r]=List<Type>(m.m_matrix[r]);
}
| Type Matrix< Type >::cols | ( | ) | [inline] |
Return the number of columns in the Matrix.
Definition at line 221 of file Matrix.h.
References Return.
Referenced by Matrix< Type >::length(), Matrix< Type >::Matrix(), and Matrix< Type >::SetSize().
{ Return m_lenCol; }
Return the number of rows and columns in the Matrix by reference.
| r | Number of rows, returned by reference |
| c | Number of columns, returned by reference |
Definition at line 226 of file Matrix.h.
References Matrix< Type >::cols(), and Matrix< Type >::rows().
| Type Matrix< Type >::rows | ( | ) | [inline] |
Return the number of rows in the Matrix.
Definition at line 218 of file Matrix.h.
References Return.
Referenced by Matrix< Type >::length(), Matrix< Type >::Matrix(), and Matrix< Type >::SetSize().
{ Return m_lenRow; }
Set the size of a matrix.
| rows | Number of rows |
| cols | Number of columns |
Definition at line 64 of file Matrix.h.
References And, Matrix< Type >::cols(), Else, If, and Matrix< Type >::rows().
Referenced by Matrix< Type >::Matrix(), and Matrix< Type >::operator=().
| ostream& operator<< | ( | ostream & | os, |
| Const Matrix< Type > & | m | ||
| ) | [friend] |
| istream& operator>> | ( | istream & | is, |
| Matrix< Type > & | m | ||
| ) | [friend] |
1.7.2