#include <Matrix.h>


Public Member Functions | |
| Matrix (unsigned long rows=0, unsigned long cols=0) | |
| Matrix (const FileName &f) | |
| Matrix (const FileName &f, const Config &c) | |
| template<class R > | |
| Matrix (const RealVector< R > &v) | |
| Matrix (const Feature &f) | |
| Matrix (const DoubleSquareMatrix &M) | |
| Matrix< T > & | operator= (const Matrix< T > &m) |
| bool | operator== (const Matrix< T > &m) const |
| bool | operator!= (const Matrix< T > &m) const |
| Matrix (const Matrix< T > &m) | |
| virtual | ~Matrix () |
| unsigned long | cols () const |
| unsigned long | rows () const |
| void | setDimensions (const unsigned long rows, const unsigned long cols) |
| template<class R > | |
| void | setAllValues (R v) |
| T & | operator() (unsigned long row, unsigned long col) |
| T | operator() (unsigned long row, unsigned long col) const |
| Matrix< T > & | transpose () |
| Matrix< T > | transpose () const |
| Matrix< T > & | invert () |
| Matrix< T > | invert () const |
| Matrix< T > | operator* (const Matrix< T > &m) const |
| Matrix< T > & | operator*= (const Matrix< T > &m) |
| Matrix< T > & | operator*= (double v) |
| Matrix< T > | operator* (double v) const |
| Matrix< T > | operator+ (const Matrix< T > &m) const |
| Matrix< T > & | operator+= (const Matrix< T > &m) |
| Matrix< T > | operator- (const Matrix< T > &m) const |
| Matrix< T > & | operator-= (const Matrix< T > &m) |
| void | save (const FileName &f) |
| void | save (const FileName &f, const Config &c) |
| void | saveDT (const FileName &f, const Config &c) |
| void | saveDB (const FileName &f, const Config &c) |
| void | load (const FileName &f) |
| void | load (const FileName &f, const Config &c) |
| void | loadDT (const FileName &f, const Config &c) |
| void | loadDB (const FileName &f, const Config &c) |
| void | randomInit () |
| T * | getArray () const |
| virtual String | toString () const |
| virtual String | getClassName () const |
| Matrix< T > | crop (unsigned long line, unsigned long col, unsigned long n_rows, unsigned long n_cols) |
| void | concatCols (const Matrix< T > &M1, const Matrix< T > &M2) |
| void | concatRows (const Matrix< T > &M1, const Matrix< T > &M2) |
Private Member Functions | |
| unsigned long | fabs (unsigned long x) |
| void | ludcmp (T **a, int n, int *indx, T *d) |
| void | lubksb (T **a, int n, int *indx, T b[]) |
Private Attributes | |
| unsigned long | _cols |
| unsigned long | _rows |
| RealVector< T > | _array |
Friends | |
| class | TestMatrix |
This template class implements a matrix of type-T values.
Inside the object, the matrix is stored as a single-dimension array.
WARNING : contrary to class DoubleSquareMatrix, row index is FIRST argument and column index is SECOND argument
This will probably change for class DoubleSquareMatrix in next release of Alize
Definition at line 111 of file Matrix.h.
| alize::Matrix< T >::Matrix | ( | unsigned long | rows = 0, |
| unsigned long | cols = 0 |
||
| ) | [inline] |
| alize::Matrix< T >::Matrix | ( | const FileName & | f ) | [inline, explicit] |
| alize::Matrix< T >::Matrix | ( | const FileName & | f, |
| const Config & | c | ||
| ) | [inline, explicit] |
| alize::Matrix< T >::Matrix | ( | const RealVector< R > & | v ) | [inline, explicit] |
Creates a matrix of type T with 1 row and v.size() rows
Copy content of v into this matrix
| v | the vector |
Definition at line 141 of file Matrix.h.
References alize::RealVector< T >::size().
| alize::Matrix< T >::Matrix | ( | const Feature & | f ) | [inline, explicit] |
Creates a matrix of type T with 1 row and f.getVectSize() rows
Copy content of the feature into this matrix
| f | the feature |
Definition at line 152 of file Matrix.h.
References alize::Feature::getVectSize().
| alize::Matrix< T >::Matrix | ( | const DoubleSquareMatrix< T > & | M ) | [inline, explicit] |
Creates a matrix of type T with from a DoubleSquareMatrix (idxs are inverted)
| f | the feature |
Definition at line 164 of file Matrix.h.
References alize::DoubleSquareMatrix::size().
| alize::Matrix< T >::Matrix | ( | const Matrix< T > & | m ) | [inline] |
| virtual alize::Matrix< T >::~Matrix | ( | ) | [inline, virtual] |
| unsigned long alize::Matrix< T >::cols | ( | ) | const [inline] |
Returns the number of columns of this matrix
Definition at line 198 of file Matrix.h.
Referenced by alize::Matrix< T >::concatCols(), and alize::Matrix< T >::concatRows().
| void alize::Matrix< T >::concatCols | ( | const Matrix< T > & | M1, |
| const Matrix< T > & | M2 | ||
| ) | [inline] |
Concatenate two matrices in column within the current one
| M1 | the first matrix to concatenate |
| M2 | the second matrix to concatenate |
Definition at line 635 of file Matrix.h.
References alize::Matrix< T >::cols(), alize::Matrix< T >::getArray(), and alize::Matrix< T >::rows().
| void alize::Matrix< T >::concatRows | ( | const Matrix< T > & | M1, |
| const Matrix< T > & | M2 | ||
| ) | [inline] |
Concatenate two matrices in line within the current one
| M1 | the first matrix to concatenate |
| M2 | the second matrix to concatenate |
Definition at line 661 of file Matrix.h.
References alize::Matrix< T >::cols(), alize::Matrix< T >::getArray(), and alize::Matrix< T >::rows().
| Matrix<T> alize::Matrix< T >::crop | ( | unsigned long | line, |
| unsigned long | col, | ||
| unsigned long | n_rows, | ||
| unsigned long | n_cols | ||
| ) | [inline] |
Extract a sub matrix from the current one
| line | line number of the first selected element |
| col | column number of the first selected element |
| n_rows | number of line of the sub matrix |
| n_cols | number of columns of the sub matrix |
Definition at line 612 of file Matrix.h.
References alize::Matrix< T >::getArray().
| unsigned long alize::Matrix< T >::fabs | ( | unsigned long | x ) | [inline, private] |
| T* alize::Matrix< T >::getArray | ( | ) | const [inline] |
Use this method to access directly to the internal vector
Definition at line 586 of file Matrix.h.
Referenced by alize::Matrix< T >::concatCols(), alize::Matrix< T >::concatRows(), and alize::Matrix< T >::crop().
| virtual String alize::Matrix< T >::getClassName | ( | ) | const [inline, virtual] |
Returns the name of the class
Implements alize::Object.
| Matrix<T> alize::Matrix< T >::invert | ( | ) | const [inline] |
Inverts this constant matrix into a new matrix
Definition at line 331 of file Matrix.h.
References alize::Matrix< T >::invert().
| Matrix<T>& alize::Matrix< T >::invert | ( | ) | [inline] |
Inverts this matrix
Definition at line 276 of file Matrix.h.
References NULL.
Referenced by alize::Matrix< T >::invert().
| void alize::Matrix< T >::load | ( | const FileName & | f ) | [inline] |
Loads a matrix depending on loadMatrixFormat
| f | file name |
Definition at line 504 of file Matrix.h.
References alize::Matrix< T >::load().
Referenced by alize::Matrix< T >::load().
| void alize::Matrix< T >::load | ( | const FileName & | f, |
| const Config & | c | ||
| ) | [inline] |
Loads a matrix depending on loadMatrixFormat
| f | file name |
| c | configuration |
Definition at line 511 of file Matrix.h.
References alize::Config::getParam().
| void alize::Matrix< T >::loadDB | ( | const FileName & | f, |
| const Config & | c | ||
| ) | [inline] |
Loads a matrix from a file (Dense Binary Matrix format)
| f | file name |
| c | configuration |
Definition at line 551 of file Matrix.h.
References alize::String::c_str(), and alize::Exception::toString().
| void alize::Matrix< T >::loadDT | ( | const FileName & | f, |
| const Config & | c | ||
| ) | [inline] |
Loads a matrix from a file (Dense Text Matrix File Format)
http://tedlab.mit.edu/~dr/SVDLIBC/SVD_F_DT.html
| f | file name |
| c | configuration |
Definition at line 523 of file Matrix.h.
References alize::XLine::getElement(), alize::XList::getLine(), alize::XList::rewind(), alize::String::toDouble(), and alize::String::toLong().
| void alize::Matrix< T >::lubksb | ( | T ** | a, |
| int | n, | ||
| int * | indx, | ||
| T | b[] | ||
| ) | [inline, private] |
| void alize::Matrix< T >::ludcmp | ( | T ** | a, |
| int | n, | ||
| int * | indx, | ||
| T * | d | ||
| ) | [inline, private] |
| bool alize::Matrix< T >::operator!= | ( | const Matrix< T > & | m ) | const [inline] |
| T alize::Matrix< T >::operator() | ( | unsigned long | row, |
| unsigned long | col | ||
| ) | const [inline] |
Overloaded operator() to access an element in this CONSTANT matrix.
| row | row of the element to access |
| col | column of the element to access |
| IndexOutOfBoundsException |
| T& alize::Matrix< T >::operator() | ( | unsigned long | row, |
| unsigned long | col | ||
| ) | [inline] |
Overloaded operator() to access an element in this matrix.
| row | row of the element to access |
| col | column of the element to access |
| IndexOutOfBoundsException |
| Matrix<T> alize::Matrix< T >::operator* | ( | double | v ) | const [inline] |
Multiplies this matrix by a scalar value and returns the result in another matrix
| v | the scalar value |
Definition at line 385 of file Matrix.h.
References alize::Matrix< T >::_array.
| Matrix<T> alize::Matrix< T >::operator* | ( | const Matrix< T > & | m ) | const [inline] |
Multiplies this matrix by an other matrix and returns the result in a new matrix (new matrix = this * m);
| m | the matrix |
Definition at line 342 of file Matrix.h.
References alize::Matrix< T >::_array, alize::Matrix< T >::_cols, alize::Matrix< T >::_rows, and alize::Matrix< T >::setAllValues().
| Matrix<T>& alize::Matrix< T >::operator*= | ( | double | v ) | [inline] |
| Matrix<T>& alize::Matrix< T >::operator*= | ( | const Matrix< T > & | m ) | [inline] |
| Matrix<T> alize::Matrix< T >::operator+ | ( | const Matrix< T > & | m ) | const [inline] |
Adds this matrix and an other matrix and returns the result in a new matrix (new matrix = this + m);
| m | the matrix |
Definition at line 397 of file Matrix.h.
References alize::Matrix< T >::_array.
| Matrix<T>& alize::Matrix< T >::operator+= | ( | const Matrix< T > & | m ) | [inline] |
Adds this matrix and an other matrix (this += m)
| m | a matrix |
Definition at line 408 of file Matrix.h.
References alize::Matrix< T >::_array, alize::Matrix< T >::_cols, and alize::Matrix< T >::_rows.
| Matrix<T> alize::Matrix< T >::operator- | ( | const Matrix< T > & | m ) | const [inline] |
Substracts a matrix from this matrix and returns the result in a new matrix (new matrix = this - m);
| m | the matrix |
Definition at line 421 of file Matrix.h.
References alize::Matrix< T >::_array.
| Matrix<T>& alize::Matrix< T >::operator-= | ( | const Matrix< T > & | m ) | [inline] |
Substracts a matrix from this matrix (this -= m)
| m | a matrix |
Definition at line 432 of file Matrix.h.
References alize::Matrix< T >::_array, alize::Matrix< T >::_cols, and alize::Matrix< T >::_rows.
| Matrix<T>& alize::Matrix< T >::operator= | ( | const Matrix< T > & | m ) | [inline] |
Copy operator. Copy a matrix into this matrix
| m | the matrix |
Definition at line 176 of file Matrix.h.
References alize::Matrix< T >::_array, alize::Matrix< T >::_cols, and alize::Matrix< T >::_rows.
| bool alize::Matrix< T >::operator== | ( | const Matrix< T > & | m ) | const [inline] |
Definition at line 184 of file Matrix.h.
References alize::Matrix< T >::_array, alize::Matrix< T >::_cols, and alize::Matrix< T >::_rows.
| void alize::Matrix< T >::randomInit | ( | ) | [inline] |
Random init of a matrix
Definition at line 572 of file Matrix.h.
References alize::String::c_str(), and alize::Exception::toString().
| unsigned long alize::Matrix< T >::rows | ( | ) | const [inline] |
Returns the number of rows of this matrix
Definition at line 202 of file Matrix.h.
Referenced by alize::Matrix< T >::concatCols(), and alize::Matrix< T >::concatRows().
| void alize::Matrix< T >::save | ( | const FileName & | f, |
| const Config & | c | ||
| ) | [inline] |
Saves a matrix depending on the saveMatrixFormat type
| f | file name |
| c | configuration |
Definition at line 451 of file Matrix.h.
References alize::Config::getParam().
| void alize::Matrix< T >::save | ( | const FileName & | f ) | [inline] |
Saves a matrix depending on the saveMatrixFormat type
| f | file name |
Definition at line 444 of file Matrix.h.
References alize::Matrix< T >::save().
Referenced by alize::Matrix< T >::save().
| void alize::Matrix< T >::saveDB | ( | const FileName & | f, |
| const Config & | c | ||
| ) | [inline] |
Save a matrix in a file (Dense Binary Matrix format)
| f | file name |
| c | configuration |
Definition at line 483 of file Matrix.h.
References alize::String::c_str(), and alize::Exception::toString().
| void alize::Matrix< T >::saveDT | ( | const FileName & | f, |
| const Config & | c | ||
| ) | [inline] |
Saves this matrix in a file (Dense Text Matrix File Format)
http://tedlab.mit.edu/~dr/SVDLIBC/SVD_F_DT.html
| f | file name |
| c | configuration |
Definition at line 464 of file Matrix.h.
References alize::XLine::addElement(), alize::XList::addLine(), and alize::XList::save().
Sets all the values to a a particular value
| v | the value to set |
Definition at line 218 of file Matrix.h.
Referenced by alize::Matrix< T >::operator*().
| void alize::Matrix< T >::setDimensions | ( | const unsigned long | rows, |
| const unsigned long | cols | ||
| ) | [inline] |
| virtual String alize::Matrix< T >::toString | ( | ) | const [inline, virtual] |
This method is frequently overridden in the derived classes. If it is not, it returns the name of the class of the object and the address of the object
Reimplemented from alize::Object.
| Matrix<T>& alize::Matrix< T >::transpose | ( | ) | [inline] |
Transposes this matrix
Definition at line 249 of file Matrix.h.
References alize::RealVector< T >::getArray().
Referenced by alize::Matrix< T >::transpose().
| Matrix<T> alize::Matrix< T >::transpose | ( | ) | const [inline] |
Transposes this constant matrix into a new matrix
Definition at line 267 of file Matrix.h.
References alize::Matrix< T >::transpose().
RealVector<T> alize::Matrix< T >::_array [private] |
Definition at line 691 of file Matrix.h.
Referenced by alize::Matrix< T >::operator*(), alize::Matrix< T >::operator+(), alize::Matrix< T >::operator+=(), alize::Matrix< T >::operator-(), alize::Matrix< T >::operator-=(), alize::Matrix< T >::operator=(), and alize::Matrix< T >::operator==().
unsigned long alize::Matrix< T >::_cols [private] |
Definition at line 689 of file Matrix.h.
Referenced by alize::Matrix< T >::operator*(), alize::Matrix< T >::operator+=(), alize::Matrix< T >::operator-=(), alize::Matrix< T >::operator=(), and alize::Matrix< T >::operator==().
unsigned long alize::Matrix< T >::_rows [private] |
Definition at line 690 of file Matrix.h.
Referenced by alize::Matrix< T >::operator*(), alize::Matrix< T >::operator+=(), alize::Matrix< T >::operator-=(), alize::Matrix< T >::operator=(), and alize::Matrix< T >::operator==().
1.7.2