latest version v1.9 - last update 10 Apr 2010 |
This template class allows the use of matrices which change its dimensions without losing any data. More...
#include <ltiDynamicMatrix.h>
Public Types | |
typedef point | size_type |
typedef std::list< int > | stdIndexList |
Public Member Functions | |
dynamicMatrix () | |
dynamicMatrix (const dynamicMatrix< T > &other) | |
~dynamicMatrix () | |
unsigned int | rows () const |
unsigned int | columns () const |
size_type | size () const |
bool | isRowValid (const int theRow) const |
bool | isColumnValid (const int theColumn) const |
bool | addRow (const int theRow, const T initialValue=T()) |
bool | addColumn (const int theColumn, const T initialValue=T()) |
bool | deleteRow (const int theRow) |
bool | deleteColumn (const int theColumn) |
T & | at (const int &theRow, const int &theColumn) |
const T & | at (const int &theRow, const int &theColumn) const |
dynamicMatrix & | operator= (const dynamicMatrix< T > &theMatrix) |
dynamicMatrix & | copy (const dynamicMatrix< T > &theMatrix) |
mathObject * | clone () const |
void | setErrorValue (T error) |
void | clear () |
const stdIndexList & | getUsedRows () const |
const stdIndexList & | getUsedColumns () const |
Protected Types | |
typedef std::map< int, T > | stdRowMap |
typedef std::map< int, stdRowMap > | stddynamicMatrix |
Protected Attributes | |
stdIndexList | theRowIdx |
stdIndexList | theColIdx |
stddynamicMatrix | theMatrix |
T | errorValue |
This template class allows the use of matrices which change its dimensions without losing any data.
They are base on the STL-maps. The intention of this class is to provide a base data-structure for the generation of classification statistics (confusion-matrices). This is a VERY SLOW class, but highly confortable for dynamically growing matrices.
typedef point lti::dynamicMatrix< T >::size_type |
Return type of the size() member.
typedef std::map<int,stdRowMap> lti::dynamicMatrix< T >::stddynamicMatrix [protected] |
the matrix-data type
typedef std::list<int> lti::dynamicMatrix< T >::stdIndexList |
list of integers, used to indicate the used indices in the matrix
typedef std::map<int,T> lti::dynamicMatrix< T >::stdRowMap [protected] |
type of a "dynamic"-row
lti::dynamicMatrix< T >::dynamicMatrix | ( | ) |
default constructor (create an empty matrix)
lti::dynamicMatrix< T >::dynamicMatrix | ( | const dynamicMatrix< T > & | other | ) |
copy constructor
lti::dynamicMatrix< T >::~dynamicMatrix | ( | ) |
destructor
bool lti::dynamicMatrix< T >::addColumn | ( | const int | theColumn, | |
const T | initialValue = T() | |||
) |
insert a column with index "theColumn" on the matrix, and initialize its contents with "initialValue"
bool lti::dynamicMatrix< T >::addRow | ( | const int | theRow, | |
const T | initialValue = T() | |||
) |
insert a row with index "theRow" on the matrix, and initialize its contents with "initialValue"
const T& lti::dynamicMatrix< T >::at | ( | const int & | theRow, | |
const int & | theColumn | |||
) | const [inline] |
read only access operator
T& lti::dynamicMatrix< T >::at | ( | const int & | theRow, | |
const int & | theColumn | |||
) | [inline] |
read-write access operator
void lti::dynamicMatrix< T >::clear | ( | ) |
clear the contents of the matrix
mathObject* lti::dynamicMatrix< T >::clone | ( | ) | const [virtual] |
clone member
Implements lti::mathObject.
unsigned int lti::dynamicMatrix< T >::columns | ( | ) | const [inline] |
get the number of columns actually being stored
dynamicMatrix& lti::dynamicMatrix< T >::copy | ( | const dynamicMatrix< T > & | theMatrix | ) | [inline] |
copy operator
Reimplemented from lti::ioObject.
Referenced by lti::dynamicMatrix< double >::operator=().
bool lti::dynamicMatrix< T >::deleteColumn | ( | const int | theColumn | ) |
delete the given column if it exists
bool lti::dynamicMatrix< T >::deleteRow | ( | const int | theRow | ) |
delete the given row if it exists
const stdIndexList& lti::dynamicMatrix< T >::getUsedColumns | ( | ) | const [inline] |
returns a list of integers with the used column indices
const stdIndexList& lti::dynamicMatrix< T >::getUsedRows | ( | ) | const [inline] |
returns a list of integers with the used row indices
bool lti::dynamicMatrix< T >::isColumnValid | ( | const int | theColumn | ) | const |
bool lti::dynamicMatrix< T >::isRowValid | ( | const int | theRow | ) | const |
check if the given row exist on the matrix
dynamicMatrix& lti::dynamicMatrix< T >::operator= | ( | const dynamicMatrix< T > & | theMatrix | ) | [inline] |
assignment operator
Reimplemented from lti::ioObject.
unsigned int lti::dynamicMatrix< T >::rows | ( | ) | const [inline] |
get number of rows actually being stored
void lti::dynamicMatrix< T >::setErrorValue | ( | T | error | ) | [inline] |
the value given here will be return if the content of a non existent cell is requested
size_type lti::dynamicMatrix< T >::size | ( | ) | const [inline] |
return the size of the matrix (number of used rows and columns) as a point.
The "x" member contains the used columns and "y" the used rows.
T lti::dynamicMatrix< T >::errorValue [protected] |
value used when unexistent cells are accessed.
Referenced by lti::dynamicMatrix< double >::setErrorValue().
stdIndexList lti::dynamicMatrix< T >::theColIdx [protected] |
the list of column indices
stddynamicMatrix lti::dynamicMatrix< T >::theMatrix [protected] |
the matrix data
stdIndexList lti::dynamicMatrix< T >::theRowIdx [protected] |
the list of row indices
Referenced by lti::dynamicMatrix< double >::getUsedRows(), and lti::dynamicMatrix< double >::rows().