#include <Base/Math/Matrix.hh>


Public Types | |
| typedef const T * | const_iterator |
| typedef const T & | const_reference |
| typedef T | element_type |
| typedef T * | iterator |
| typedef T * | pointer |
| typedef T & | reference |
| typedef Subscript | size_type |
| typedef T | value_type |
Public Member Functions | |
| Matrix< T > | Adjoint () const |
| computes the adjoint matrix | |
| Subscript | dim (Subscript d) const |
| void | GaussJordan () |
| use the Gauss Jordan Algrithm to transform the matrix to reduced row echelon form. | |
| template<> | |
| void | GetAbsMaxMin (double &max, double &min) const |
| template<> | |
| bool | IsIdentity (double eps) const |
| bool | IsIdentity (double eps=0.0) const |
| Checks if the matrix a an identity. | |
| template<> | |
| bool | IsZero (double eps) const |
| bool | IsZero (double eps=0.0) const |
| Checks if the matrix is a null matrix. | |
| void | Kronecker (Matrix< T > const B, Matrix< T > &dest) const |
| Kronecker-product with matrix, result in dest. | |
| Subscript | lbound () const |
| Matrix (const Vector< T > &v) | |
| constructs Nx1 Matrix from N-Vector | |
| Matrix (const TNT::Matrix< T > &A) | |
| Matrix (const Matrix< T > &A) | |
| Matrix (const int rows, const int cols, const std::string &s) | |
| DEPRECATED due to instantiation problem. | |
| Matrix (int rows, int cols, const MatrixInitType &i) | |
| init with standard form | |
| Matrix (int rows, int cols, const T value) | |
| assignment with a constant values for all elements (=set) | |
| Matrix (int rows, int cols) | |
| Matrix (const Matrix3x3< T > &mat) | |
| Matrix () | |
| Matrix< T > & | newsize (Subscript M, Subscript N) |
| Subscript | num_cols () const |
| Subscript | num_rows () const |
| const_reference | operator() (Subscript i, Subscript j) const |
| reference | operator() (Subscript i, Subscript j) |
| const_reference | operator() (Subscript i) const |
| reference | operator() (Subscript i) |
| const T * | operator[] (Subscript i) const |
| T * | operator[] (Subscript i) |
| std::ostream & | Print (std::ostream &s, const bool intCastOutput=false, const bool binaryOutput=false, const bool forceFullPrecision=false) const |
| std::istream & | Read (std::istream &s, const bool intCastInput=false, const bool binaryInput=false) |
| JW. | |
| Subscript | size () const |
| void | SwapRows (const int i, const int r) |
| swaps two rows | |
| Matrix< T > | Transpose () const |
| transpose function, storing data destination matrix | |
| void | Vec (Vector< T > &dest) const |
| vec-operator returns the elements of the matrix columwise as vector | |
| virtual | ~Matrix () |
Arithmetic | |
| void | Add (const T &scalar, Matrix< T > &dest) const |
| addition function, storing data destination matrix | |
| void | AddIP (const Matrix< T > &arg) |
| Adds arg to this. | |
| void | AddIP (const T &scalar) |
| in place addition function | |
| void | Divide (const T &scalar, Matrix< T > &dest) const |
| division function, storing data destination matrix | |
| void | DivideIP (const T &scalar) |
| in place division function | |
| void | GetSystemMatrix (Matrix< T > &dest) const |
| compute square system matrix dest = A^T * A | |
| void | Mult (const Vector< T > &arg, Vector< T > &result) const |
| matrix vector multiplication, result is not allocated | |
| void | Mult (const Matrix< T > &arg) |
| in Place matrix multiplication this is equal to M = M * arg, but faster | |
| void | Mult (const Matrix< T > &arg, Matrix< T > &result) const |
| matrix multiplication, result is not allocated | |
| void | Multiply (const T &scalar, Matrix< T > &dest) const |
| multiplication function, storing data destination matrix | |
| void | MultiplyIP (const T &scalar) |
| in place multiplication function | |
| void | MultLeft (const Vector< T > &arg, Vector< T > &result) const |
| vector matrix multiplication result=arg*this. | |
| void | MultLeft (const Matrix< T > &arg) |
| in Place matrix multiplication this is equal to M = arg*M, but faster | |
| Matrix< T > & | operator= (const Matrix< T > &mat) |
| Matrix< T > & | operator= (const TNT::Matrix< T > &mat) |
| assignment operators calling corresponding operator from base class if appropriate | |
| void | Sub (const T &scalar, Matrix< T > &dest) const |
| substraction function, storing data destination matrix | |
| void | SubIP (const T &scalar) |
| in place subtraction function | |
| void | SubIP (const Matrix< T > &arg) |
| Subtracts arg from this this -= arg. | |
Input / Output | |
| bool | BinRead (const char *filename) const |
| This method reads a matrix from a given file in binary format. | |
| bool | BinWrite (const char *filename) const |
| This method writes a matrix to a given file in binary format. | |
| bool | Load (const std::string &filename) |
| method to load directly from a given filename. | |
| bool | Save (const std::string &filename) const |
| method to save directly to a given filename. | |
| int | WriteMatlab (std::ostream &ostr, const std::string &name) const |
| Write the matrix in Matlab format to the given stream. | |
Set Functions | |
| virtual void | clear () |
| stl conform interface destroys Matrix JW | |
| void | Fill (const T &scalar) |
| Takes the elements of a Vector and put them as diagonal elements into a matrix. | |
| void | MakeSymmetric () |
| componentwise: this = 0.5(this + this^T) yields symmetric matrix only allowed for square shaped matrices | |
| void | SetIdentity () |
| Converts matrix to identity matrix. | |
| void | SetZero () |
| Sets all values to zero. | |
Get Functions | |
| T | DetSquare () const |
| void | GetAbsMaxMin (T &max, T &min) const |
| return biggest and smallest absolute values | |
| Vector< T > | GetCol (const int &col) const |
| return a copy of column "col", zero based counting | |
| unsigned int | GetCols () const |
| const T * | GetData () const |
| T * | GetData () |
| get the pointer to the data array of the matrix (for faster direct memeory access) | |
| T ** | GetDataArray () |
| const T ** | GetDataArray () const |
| returns zero based arry for data access | |
| T ** | GetDataArray1 () const |
| returns 1 based array to data access | |
| T * | GetDataLast () |
| const T * | GetDataLast () const |
| Get a pointer to the last data element Do not use this on unitilized matrices with <= on pointers because on an unitilized matrix GetData() will be NULL and last Element < (typically FFFFF8) We don't want an if here for performance reasons of the innerst loop. | |
| T | GetMax () const |
| Returns the maximum value of the matrix elements. | |
| void | GetMaxMin (T &max, T &min) const |
| return biggest and smallest entry | |
| T | GetMean () const |
| Returns the mean value of the matrix elements. | |
| T | GetMin () const |
| Returns the minimum value of the matrix elements. | |
| int | GetNumElements () const |
| Returns the total number of elements. | |
| Vector< T > | GetRow (const int &row) const |
| return a copy of row "row" of this matrix, zero based counting | |
| unsigned int | GetRows () const |
| double | NormFrobenius () const |
| Return Frobenius norm = sqrt(trace(A^t * A)). | |
| T | NormL1 () const |
| Return the L1 norm: |a| + |b| + |c| + . | |
| double | NormL2 () const |
| Return the L2 norm: a^2 + b^2 + c^2 + . | |
| void | Set (const int row, const int col, const Vector< T > &data) |
| Copies the contents of data into this at the position indicated by row and col. | |
| void | Set (const int row, const int col, const Matrix< T > &data) |
| Copies the contents of data into this at the position indicated by row and col. | |
| void | SetCol (const int row, const Vector< T > &data) |
| set a col of matrix from vector | |
| void | SetRow (const int row, const Vector< T > &data) |
| set a row of matrix from vector | |
| void | SetTranspose (const int row, const int col, const Vector< T > &data) |
| Copies the contents of data into this at the position indicated by row and col. | |
| T | Trace () const |
Scaling and Normalization | |
| T | Normalize () |
| Normalizes the matrix by the entry with the biggest absolute value by dividing all elements with this one. | |
| void | NormalizeCols () |
| Normalizes each coloumn to L_2 norm one. | |
| void | NormalizeColsToOne (const int norm_row_index) |
| divides each column of the matrix through the element norm_row_index. | |
| void | NormalizeRows () |
| Normalizes each row to L2 norm one. | |
| void | NormalizeRowsToOne (const int norm_col_index) |
| divides each row of the matrix through the element norm_col_index. | |
| void | ScaleCol (int NoCol, T scale) |
| Scales column NoCol with scale. | |
| void | ScaleRow (int NoRow, T scale) |
| Scales row NoRow with scale. | |
Protected Member Functions | |
| void | copy (const T *v) |
| void | destroy () |
| void | initialize (Subscript M, Subscript N) |
| void | set (const T &val) |
Protected Attributes | |
| Subscript | m_ |
| Subscript | mn_ |
| Subscript | n_ |
| T ** | row_ |
| T ** | rowm1_ |
| T * | v_ |
| T * | vm1_ |
Related Functions | |
| (Note that these are not member functions.) | |
| template<class T > | |
| void | Conv (const Matrix< T > &left, const Matrix< T > &right, Matrix< T > &res) |
| zero padded convolution of two matrices | |
| template<class T > | |
| bool | operator!= (const Matrix< T > &argl, const Matrix< T > &argr) |
| template<class T > | |
| Vector< T > | operator* (const Matrix< T > &A, const Vector< T > &x) |
| template<class T > | |
| Matrix< T > | operator* (const Matrix< T > &A, const Matrix< T > &B) |
| template<class T > | |
| Matrix< T > | operator* (const Matrix3x3< T > &argLeft, const Matrix< T > &argMat) |
| template<class T > | |
| Matrix< T > | operator* (const T &scalar, const Matrix< T > &mat) |
| template<class T > | |
| Matrix< T > | operator* (const Matrix< T > &mat, const T &scalar) |
| template<class T > | |
| Matrix< T > & | operator*= (Matrix< T > &mat, const T &scalar) |
| template<class T > | |
| Matrix< T > | operator+ (const Matrix< T > &A, const Matrix< T > &B) |
| template<class T > | |
| Matrix< T > | operator+ (const T &scalar, const Matrix< T > &mat) |
| template<class T > | |
| Matrix< T > | operator+ (const Matrix< T > &mat, const T &scalar) |
| template<class T > | |
| Matrix< T > & | operator+= (Matrix< T > &mat, const Matrix< T > &arg) |
| template<class T > | |
| Matrix< T > & | operator+= (Matrix< T > &mat, const T &scalar) |
| operators | |
| template<class T > | |
| Matrix< T > | operator- (const Matrix< T > &A, const Matrix< T > &B) |
| template<class T > | |
| Matrix< T > | operator- (const T &scalar, const Matrix< T > &mat) |
| template<class T > | |
| Matrix< T > | operator- (const Matrix< T > &mat, const T &scalar) |
| template<class T > | |
| Matrix< T > & | operator-= (Matrix< T > &mat, const T &scalar) |
| template<class T > | |
| Matrix< T > & | operator-= (Matrix< T > &mat, const Matrix< T > &arg) |
| template<class T > | |
| Matrix< T > | operator/ (const Matrix< T > &mat, const T &scalar) |
| template<class T > | |
| Matrix< T > & | operator/= (Matrix< T > &mat, const T &scalar) |
| template<class T > | |
| std::ostream & | operator<< (std::ostream &s, const Matrix< T > &A) |
| std::ostream & | operator<< (std::ostream &s, const Matrix< unsigned char > &A) |
| std::ostream & | operator<< (std::ostream &s, const Matrix< char > &A) |
| template<class T > | |
| bool | operator== (const Matrix< T > &argl, const Matrix< T > &argr) |
| template<class T > | |
| std::istream & | operator>> (std::istream &s, Matrix< T > &A) |
| std::istream & | operator>> (std::istream &s, Matrix< char > &A) |
| std::istream & | operator>> (std::istream &s, Matrix< unsigned char > &A) |
Access the data by M[row][col].
class Matrix is the matrix class that should be used by common BIAS algorithms and data structures with arbitrary size
Access the data simply by M[row][col].
It is derived from TNT::Matrix to inherit the basic operations and algorithm. special implementations should be done here and NOT in TNT:Matrix because the true 'base' Matrix class "TNT::Matrix" should be interchangeable and aside from this maintained by NIST.
Note the specialized fixed size classes Matrix3x3, Matrix3x4, ... with more efficient memory layout.
moved from MIP to BIAS (11/05/2002) operators are no longer class members, they are defined outside the class.
Definition at line 86 of file Matrix.hh.
typedef const T* TNT::Matrix< T >::const_iterator [inherited] |
typedef const T& TNT::Matrix< T >::const_reference [inherited] |
typedef T TNT::Matrix< T >::element_type [inherited] |
typedef T* TNT::Matrix< T >::iterator [inherited] |
typedef T* TNT::Matrix< T >::pointer [inherited] |
typedef T& TNT::Matrix< T >::reference [inherited] |
typedef Subscript TNT::Matrix< T >::size_type [inherited] |
typedef T TNT::Matrix< T >::value_type [inherited] |
| BIAS::Matrix< T >::~Matrix | ( | ) | [inline, virtual] |
| BIAS::Matrix< T >::Matrix | ( | ) | [inline] |
| BIAS::Matrix< T >::Matrix | ( | const Matrix3x3< T > & | mat | ) | [inline, explicit] |
| BIAS::Matrix< T >::Matrix | ( | int | rows, | |
| int | cols | |||
| ) | [inline] |
| BIAS::Matrix< T >::Matrix | ( | int | rows, | |
| int | cols, | |||
| const T | value | |||
| ) | [inline] |
| BIAS::Matrix< T >::Matrix | ( | int | rows, | |
| int | cols, | |||
| const MatrixInitType & | i | |||
| ) | [inline] |
| BIAS::Matrix< T >::Matrix | ( | const int | rows, | |
| const int | cols, | |||
| const std::string & | s | |||
| ) | [inline, explicit] |
| BIAS::Matrix< T >::Matrix | ( | const Matrix< T > & | A | ) | [inline] |
| BIAS::Matrix< T >::Matrix | ( | const TNT::Matrix< T > & | A | ) | [inline] |
| BIAS::Matrix< T >::Matrix | ( | const Vector< T > & | v | ) | [inline] |
| void BIAS::Matrix< T >::Add | ( | const T & | scalar, | |
| Matrix< T > & | dest | |||
| ) | const [inline] |
addition function, storing data destination matrix
implementation
Definition at line 668 of file Matrix.hh.
References BIAS::Matrix< T >::GetData(), BIAS::Matrix< T >::GetDataLast(), TNT::Matrix< T >::newsize(), TNT::Matrix< T >::num_cols(), TNT::Matrix< T >::num_rows(), and T.
Referenced by BIAS::Matrix< T >::operator+().
| void BIAS::Matrix< T >::AddIP | ( | const Matrix< T > & | arg | ) | [inline] |
Adds arg to this.
Definition at line 907 of file Matrix.hh.
References BIASABORT, BIASERR, BIAS::Matrix< T >::GetData(), TNT::Matrix< T >::num_cols(), TNT::Matrix< T >::num_rows(), TNT::Matrix< T >::size(), and T.
| void BIAS::Matrix< T >::AddIP | ( | const T & | scalar | ) | [inline] |
in place addition function
Definition at line 339 of file Matrix.hh.
Referenced by BIAS::Matrix< T >::operator+=(), and BIAS::Matrix< T >::operator-=().
| Matrix< T > BIAS::Matrix< T >::Adjoint | ( | ) | const [inline] |
computes the adjoint matrix
Definition at line 734 of file Matrix.hh.
References BIASASSERT, BIAS::Matrix< T >::DetSquare(), j, TNT::Matrix< T >::num_cols(), TNT::Matrix< T >::num_rows(), and r.
| bool BIAS::Matrix< T >::BinRead | ( | const char * | filename | ) | const [inline] |
This method reads a matrix from a given file in binary format.
The file is not human read-/editable but provides full precision. A dimension check is performed.
Definition at line 425 of file Matrix.cpp.
References BIASERR, j, TNT::Matrix< T >::m_, TNT::Matrix< T >::n_, and T.
| bool BIAS::Matrix< T >::BinWrite | ( | const char * | filename | ) | const [inline] |
This method writes a matrix to a given file in binary format.
The file is not human read-/editable but provides full precision.
Definition at line 460 of file Matrix.cpp.
References j, TNT::Matrix< T >::m_, TNT::Matrix< T >::n_, and T.
| virtual void BIAS::Matrix< T >::clear | ( | ) | [inline, virtual] |
stl conform interface destroys Matrix JW
Reimplemented in BIAS::Matrix2x2< T >, BIAS::Matrix3x4< T >, BIAS::Matrix4x4< T >, BIAS::Matrix2x2< KLT_TYPE >, BIAS::Matrix2x2< double >, BIAS::Matrix3x4< double >, BIAS::Matrix3x4< PMATRIX_TYPE >, BIAS::Matrix4x4< double >, BIAS::Matrix4x4< QUADRIC3D_TYPE >, BIAS::Matrix4x4< PLUECKERMATRIX_TYPE >, and BIAS::Matrix4x4< PMATRIX_TYPE >.
Definition at line 449 of file Matrix.hh.
Referenced by BIAS::ExtendedKalman::Update().
| void TNT::Matrix< T >::copy | ( | const T * | v | ) | [inline, protected, inherited] |
Definition at line 121 of file cmat.h.
Referenced by TNT::Matrix< BIAS::Vector< int > >::Matrix(), and TNT::Matrix< BIAS::Vector< int > >::operator=().
| void TNT::Matrix< T >::destroy | ( | ) | [inline, protected, inherited] |
Definition at line 180 of file cmat.h.
Referenced by TNT::Matrix< BIAS::Vector< int > >::newsize(), TNT::Matrix< BIAS::Vector< int > >::operator=(), and TNT::Matrix< BIAS::Vector< int > >::~Matrix().
| T BIAS::Matrix< T >::DetSquare | ( | ) | const [inline] |
Definition at line 293 of file Matrix.hh.
Referenced by BIAS::Matrix< T >::Adjoint(), and BIAS::Matrix< EP_TYPE >::DetSquare().
| Subscript TNT::Matrix< T >::dim | ( | Subscript | d | ) | const [inline, inherited] |