An implementation of a matrix class using Vector<T> as its internal basis. This class is STL compliant with the iterator proceeding in row major order. Operators +=, -=, *= and /= are implemented in RefMatrixBase.
Definition at line 72 of file Matrix.hpp.
#include <Matrix.hpp>
Public Types | |
typedef Vector< T >::const_iterator | const_iterator |
STL const iterator type. More... | |
typedef Vector< T >::const_reference | const_reference |
STL const reference type. More... | |
typedef Vector< T >::iterator | iterator |
STL iterator type. More... | |
typedef Vector< T >::reference | reference |
STL reference type. More... | |
typedef Vector< T >::value_type | value_type |
STL value_type. More... | |
Public Member Functions | |
iterator | begin () |
STL begin. More... | |
const_iterator | begin () const |
STL const begin. More... | |
ConstMatrixColSlice< T > | col (size_t colNum, const std::slice &s) const |
A const reference column with a given slice. More... | |
ConstMatrixColSlice< T > | col (size_t colNum, size_t rowNum=0) const |
A const reference column with a starting row number (i.e. sub-column) More... | |
MatrixColSlice< T > | colRef (size_t colNum, const std::slice &s) |
A reference column with a given slice. More... | |
MatrixColSlice< T > | colRef (size_t colNum, size_t rowNum=0) |
A reference column with a starting row number (i.e. sub-column) More... | |
size_t | cols () const |
The number of columns in the matrix. More... | |
bool | empty () const |
STL empty. More... | |
iterator | end () |
STL end. More... | |
const_iterator | end () const |
STL const end. More... | |
value_type | front () |
STL front. More... | |
const_reference | front () const |
STL const front. More... | |
Matrix () | |
default constructor More... | |
template<class BaseClass > | |
Matrix (const ConstMatrixBase< T, BaseClass > &mat) | |
constructor for a ConstMatrixBase object More... | |
template<class BaseClass > | |
Matrix (const ConstMatrixBase< T, BaseClass > &mat, size_t topRow, size_t topCol, size_t numRows, size_t numCols) | |
submatrix constructor More... | |
Matrix (size_t rows, size_t cols) | |
constructor given an initial size More... | |
template<class BaseClass > | |
Matrix (size_t rows, size_t cols, const ConstVectorBase< T, BaseClass > &vec) | |
copies out the contents of vec to initialize the matrix More... | |
Matrix (size_t rows, size_t cols, const T *vec) | |
copies out the contents of vec to initialize the matrix More... | |
Matrix (size_t rows, size_t cols, T initialValue) | |
constructor for an initial size and value More... | |
size_t | max_size () const |
STL max size. More... | |
T & | operator() (size_t rowNum, size_t colNum) |
Non-const matrix operator(row,col) More... | |
T | operator() (size_t rowNum, size_t colNum) const |
Const matrix operator(row,col) More... | |
template<class BaseClass > | |
Matrix & | operator= (const ConstMatrixBase< T, BaseClass > &mat) |
Copies from any matrix. More... | |
template<class BaseClass > | |
Matrix & | operator= (const ConstVectorBase< T, BaseClass > &mat) |
Copies from any vector. More... | |
Matrix & | operator= (const Matrix &mat) |
Copies the other matrix. More... | |
Matrix & | operator= (const std::valarray< T > array) |
Matrix & | operator= (const T *array) |
Matrix & | operator= (const T t) |
Assigns all elements of the matrix to t . More... | |
MatrixRowSlice< T > | operator[] (size_t row) |
operator[] that returns a row slice More... | |
ConstMatrixRowSlice< T > | operator[] (size_t rowNum) const |
const operator[] that returns a const row slice More... | |
Matrix & | resize (size_t rows, size_t cols) |
Matrix & | resize (size_t rows, size_t cols, const T initialValue) |
ConstMatrixRowSlice< T > | row (size_t rowNum, const std::slice &s) const |
A const reference slice of a row with a given std::slice. More... | |
ConstMatrixRowSlice< T > | row (size_t rowNum, size_t colNum=0) const |
A const reference slice of a row with a starting column (i.e. sub-row) More... | |
MatrixRowSlice< T > | rowRef (size_t rowNum, const std::slice &s) |
A reference slice of a row with a given std::slice. More... | |
MatrixRowSlice< T > | rowRef (size_t rowNum, size_t colNum=0) |
A reference slice of a row with a starting column (i.e. sub-row) More... | |
size_t | rows () const |
The number of rows in the matrix. More... | |
size_t | size () const |
STL size. More... | |
virtual | ~Matrix () |
![]() | |
Matrix< T > & | assignFrom (const ConstMatrixBase< T, E > &x) |
Matrix< T > & | assignFrom (const ConstVectorBase< T, E > &x) |
Matrix< T > & | assignFrom (const std::valarray< T > &x) |
Matrix< T > & | assignFrom (const T *x) |
Matrix< T > & | assignFrom (T x) |
size_t | cols () const |
returns the number of columns in the matrix More... | |
T & | operator() (size_t i, size_t j) |
returns a reference to the (i,j) element of the matrix. More... | |
Matrix< T > & | operator*= (const T x) |
multiplies each element in this matrix by x. More... | |
Matrix< T > & | operator+= (const ConstMatrixBase< T, E > &x) |
Matrix< T > & | operator+= (const ConstVectorBase< T, E > &x) |
Matrix< T > & | operator+= (const std::valarray< T > &x) |
Matrix< T > & | operator+= (const T *x) |
Matrix< T > & | operator+= (T x) |
const Matrix< T > | operator- () |
unary minus: multiplies each element in this matrix by -1. More... | |
Matrix< T > & | operator-= (const ConstMatrixBase< T, E > &x) |
Matrix< T > & | operator-= (const ConstVectorBase< T, E > &x) |
Matrix< T > & | operator-= (const std::valarray< T > &x) |
Matrix< T > & | operator-= (const T *x) |
Matrix< T > & | operator-= (T x) |
Matrix< T > & | operator/= (const T x) |
divides each element in this matrix by x. More... | |
RefMatrixBase () | |
default constructor More... | |
size_t | rows () const |
returns the number of rows in the matrix More... | |
size_t | size () const |
returns the rows()*cols() size of the matrix More... | |
Matrix< T > & | swapCols (size_t col1, size_t col2) |
Matrix< T > & | swapRows (size_t row1, size_t row2) |
Matrix< T > & | zeroize () |
Matrix< T > & | zeroizeCol (size_t c) |
Matrix< T > & | zeroizeRow (size_t r) |
virtual | ~RefMatrixBase () |
![]() | |
Vector< T > | colCopy (size_t c, size_t r=0) const |
size_t | cols () const |
the number of columns in the matrix More... | |
ConstMatrixBase () | |
default constructor More... | |
Vector< T > | diagCopy (void) const |
bool | isDiagonal () const |
returns true if this is a diagonal matrix More... | |
bool | isLT () const |
returns true if this is a lower triangular matrix. More... | |
bool | isSquare () const |
returns true if this is a square matrix (false for a null matrix). More... | |
bool | isSymmetric () const |
bool | isUT () const |
returns true if this is an upper triangular matrix. More... | |
T | operator() (size_t i, size_t j) const |
Vector< T > | rowCopy (size_t r, size_t c=0) const |
size_t | rows () const |
the number of rows in the matrix More... | |
size_t | size () const |
the rows()*cols() size of the matrix. More... | |
virtual | ~ConstMatrixBase () |
Private Attributes | |
size_t | c |
the number of columns More... | |
size_t | r |
the number of rows More... | |
size_t | s |
the overall size More... | |
Vector< T > | v |
the matrix stored in column major order More... | |
Additional Inherited Members | |
![]() | |
T | constMatrixRef (size_t i, size_t j) const |
typedef Vector<T>::const_iterator gnsstk::Matrix< T >::const_iterator |
STL const iterator type.
Definition at line 86 of file Matrix.hpp.
typedef Vector<T>::const_reference gnsstk::Matrix< T >::const_reference |
STL const reference type.
Definition at line 81 of file Matrix.hpp.
typedef Vector<T>::iterator gnsstk::Matrix< T >::iterator |
STL iterator type.
Definition at line 84 of file Matrix.hpp.
typedef Vector<T>::reference gnsstk::Matrix< T >::reference |
STL reference type.
Definition at line 78 of file Matrix.hpp.
typedef Vector<T>::value_type gnsstk::Matrix< T >::value_type |
STL value_type.
Definition at line 76 of file Matrix.hpp.
gnsstk::Matrix< T >::Matrix | ( | size_t | rows, |
size_t | cols | ||
) |
constructor given an initial size
Definition at line 60 of file MatrixImplementation.hpp.
gnsstk::Matrix< T >::Matrix | ( | size_t | rows, |
size_t | cols, | ||
T | initialValue | ||
) |
constructor for an initial size and value
Definition at line 65 of file MatrixImplementation.hpp.
gnsstk::Matrix< T >::Matrix | ( | size_t | rows, |
size_t | cols, | ||
const T * | vec | ||
) |
copies out the contents of vec to initialize the matrix
Definition at line 71 of file MatrixImplementation.hpp.
|
inline |
copies out the contents of vec to initialize the matrix
Definition at line 98 of file Matrix.hpp.
|
inline |
constructor for a ConstMatrixBase object
Definition at line 104 of file Matrix.hpp.
|
inline |
submatrix constructor
Definition at line 115 of file Matrix.hpp.
|
inlinevirtual |
Definition at line 140 of file Matrix.hpp.
|
inline |
STL begin.
Definition at line 144 of file Matrix.hpp.
|
inline |
STL const begin.
Definition at line 146 of file Matrix.hpp.
|
inline |
A const reference column with a given slice.
Definition at line 120 of file MatrixImplementation.hpp.
|
inline |
A const reference column with a starting row number (i.e. sub-column)
Definition at line 127 of file MatrixImplementation.hpp.
|
inline |
A reference column with a given slice.
Definition at line 107 of file MatrixImplementation.hpp.
|
inline |
A reference column with a starting row number (i.e. sub-column)
Definition at line 113 of file MatrixImplementation.hpp.
|
inline |
The number of columns in the matrix.
Definition at line 167 of file Matrix.hpp.
|
inline |
STL empty.
Definition at line 158 of file Matrix.hpp.
|
inline |
STL end.
Definition at line 148 of file Matrix.hpp.
|
inline |
STL const end.
Definition at line 150 of file Matrix.hpp.
|
inline |
STL front.
Definition at line 152 of file Matrix.hpp.
|
inline |
STL const front.
Definition at line 155 of file Matrix.hpp.
|
inline |
STL max size.
Definition at line 162 of file Matrix.hpp.
|
inline |
Non-const matrix operator(row,col)
Definition at line 187 of file Matrix.hpp.
|
inline |
Const matrix operator(row,col)
Definition at line 190 of file Matrix.hpp.
|
inline |
Copies from any matrix.
Definition at line 224 of file Matrix.hpp.
|
inline |
Copies from any vector.
Definition at line 234 of file Matrix.hpp.
|
inline |
Copies the other matrix.
Definition at line 220 of file Matrix.hpp.
|
inline |
Assigns the contents of this matrix to those in array in column major order.
Definition at line 214 of file Matrix.hpp.
|
inline |
Assigns this matrix to a T* in column major order.
Definition at line 210 of file Matrix.hpp.
|
inline |
Assigns all elements of the matrix to t
.
Definition at line 217 of file Matrix.hpp.
|
inline |
operator[] that returns a row slice
Definition at line 193 of file Matrix.hpp.
|
inline |
const operator[] that returns a const row slice
Definition at line 196 of file Matrix.hpp.
|
inline |
Resizes the matrix to rows*cols.
Definition at line 135 of file MatrixImplementation.hpp.
|
inline |
Definition at line 145 of file MatrixImplementation.hpp.
|
inline |
A const reference slice of a row with a given std::slice.
Definition at line 92 of file MatrixImplementation.hpp.
|
inline |
A const reference slice of a row with a starting column (i.e. sub-row)
Definition at line 99 of file MatrixImplementation.hpp.
|
inline |
A reference slice of a row with a given std::slice.
Definition at line 79 of file MatrixImplementation.hpp.
|
inline |
A reference slice of a row with a starting column (i.e. sub-row)
Definition at line 85 of file MatrixImplementation.hpp.
|
inline |
The number of rows in the matrix.
Definition at line 165 of file Matrix.hpp.
|
inline |
STL size.
Definition at line 160 of file Matrix.hpp.
|
private |
the number of columns
Definition at line 241 of file Matrix.hpp.
|
private |
the number of rows
Definition at line 240 of file Matrix.hpp.
|
private |
the overall size
Definition at line 242 of file Matrix.hpp.
|
private |
the matrix stored in column major order
Definition at line 239 of file Matrix.hpp.