A two-dimensional distance matrix, similar to OpenMS::Matrix. More...
#include <OpenMS/DATASTRUCTURES/DistanceMatrix.h>
Public Types | |
STL compliance type definitions | |
| typedef Value | value_type |
OpenMS compliance type definitions | |
| typedef Size | SizeType |
| typedef value_type | ValueType |
Public Member Functions | |
| DistanceMatrix () | |
| default constructor | |
| DistanceMatrix (SizeType dimensionsize, Value value=Value()) | |
| detailed constructor | |
| DistanceMatrix (const DistanceMatrix &source) | |
| copy constructor | |
| ~DistanceMatrix () | |
| destructor | |
| const ValueType | operator() (SizeType i, SizeType j) const |
| gets a value at a given position (read only): | |
| ValueType | operator() (SizeType i, SizeType j) |
| gets a value at a given position (read only): | |
| const ValueType | getValue (SizeType i, SizeType j) const |
| gets a value at a given position: | |
| ValueType | getValue (SizeType i, SizeType j) |
| gets a value at a given position: | |
| void | setValue (SizeType i, SizeType j, ValueType value) |
| sets a value at a given position: | |
| void | setValueQuick (SizeType i, SizeType j, ValueType value) |
| sets a value at a given position: | |
| void | clear () |
| reset all | |
| void | resize (SizeType dimensionsize, Value value=Value()) |
| resizing the container | |
| void | reduce (SizeType j) |
| reduces DistanceMatrix by one dimension. first the jth row, then jth column | |
| SizeType | dimensionsize () const |
| gives the number of rows (i.e. number of columns) | |
| void | updateMinElement () |
| keep track of the actual minimum element after altering the matrix | |
| bool | operator== (DistanceMatrix< ValueType > const &rhs) const |
| Equality comparator. | |
| std::pair< SizeType, SizeType > | getMinElementCoordinates () const |
| Indexpair of minimal element. | |
Protected Attributes | |
| ValueType ** | matrix_ |
| sparse element not to be included in base container | |
| SizeType | init_size_ |
| number of actually stored rows | |
| SizeType | dimensionsize_ |
| number of accessably stored rows (i.e. number of columns) | |
| std::pair< SizeType, SizeType > | min_element_ |
| index of minimal element(i.e. number in underlying SparseVector) | |
Private Member Functions | |
| DistanceMatrix & | operator= (const DistanceMatrix &rhs) |
| assignment operator (unsafe) | |
Related Functions | |
(Note that these are not member functions.) | |
| template<typename Value > | |
| std::ostream & | operator<< (std::ostream &os, const DistanceMatrix< Value > &matrix) |
| Print the contents to a stream. | |
A two-dimensional distance matrix, similar to OpenMS::Matrix.
similar to OpenMS::Matrix, but contains only elements above the main diagonal, hence translating access with operator(,) for elements of above the main diagonal to corresponing elements below the main diagonal and returning 0 for requested elements in the main diagonal, since selfdistance is assumed to be 0. Keeps track of the minimal element in the Matrix with OpenMS::DistanceMatrix::min_element_ if only for setting a value OpenMS::DistanceMatrix::setValue is used. Other OpenMS::DistanceMatrix altering methods may require a maual update by call of OpenMS::DistanceMatrix::updateMinElement, see the respective methods documentation.
| typedef Value value_type |
| typedef value_type ValueType |
| DistanceMatrix | ( | ) | [inline] |
default constructor
| DistanceMatrix | ( | SizeType | dimensionsize, | |
| Value | value = Value() | |||
| ) | [inline] |
detailed constructor
| dimensionsize | the number of rows (and therewith cols) | |
| value | DistanceMatrix will be filled with this element (main diagonal will still "hold" only zeros) |
| Exception::OutOfMemory | if requested dimensionsize is to big to fit into memory |
References DistanceMatrix< Value >::dimensionsize_, DistanceMatrix< Value >::init_size_, DistanceMatrix< Value >::matrix_, DistanceMatrix< Value >::min_element_, and NULL.
| DistanceMatrix | ( | const DistanceMatrix< Value > & | source | ) | [inline] |
copy constructor
| source | this DistanceMatrix will be copied |
| Exception::OutOfMemory | if requested dimensionsize is to big to fit into memory |
References DistanceMatrix< Value >::dimensionsize_, DistanceMatrix< Value >::init_size_, DistanceMatrix< Value >::matrix_, DistanceMatrix< Value >::min_element_, and NULL.
| ~DistanceMatrix | ( | ) | [inline] |
destructor
References DistanceMatrix< Value >::init_size_, and DistanceMatrix< Value >::matrix_.
| void clear | ( | ) | [inline] |
reset all
References DistanceMatrix< Value >::dimensionsize_, DistanceMatrix< Value >::init_size_, DistanceMatrix< Value >::matrix_, and DistanceMatrix< Value >::min_element_.
Referenced by ClusterHierarchical::cluster().
| SizeType dimensionsize | ( | ) | const [inline] |
gives the number of rows (i.e. number of columns)
References DistanceMatrix< Value >::dimensionsize_.
Referenced by ClusterHierarchical::cluster(), and DistanceMatrix< Value >::operator==().
Indexpair of minimal element.
| Exception::OutOfRange | thrown if there is no element to access |
References DistanceMatrix< Value >::dimensionsize_, and DistanceMatrix< Value >::min_element_.
gets a value at a given position:
| i | the i-th row | |
| j | the j-th col |
| Exception::OutOfRange | if given coordinates are out of range |
References DistanceMatrix< Value >::dimensionsize_, and DistanceMatrix< Value >::matrix_.
gets a value at a given position:
| i | the i-th row | |
| j | the j-th col |
| Exception::OutOfRange | if given coordinates are out of range |
References DistanceMatrix< Value >::dimensionsize_, and DistanceMatrix< Value >::matrix_.
Referenced by DistanceMatrix< Value >::operator()().
gets a value at a given position (read only):
| i | the i-th row | |
| j | the j-th col |
References DistanceMatrix< Value >::getValue().
gets a value at a given position (read only):
| i | the i-th row | |
| j | the j-th col |
References DistanceMatrix< Value >::getValue().
| DistanceMatrix& operator= | ( | const DistanceMatrix< Value > & | rhs | ) | [inline, private] |
assignment operator (unsafe)
References DistanceMatrix< Value >::dimensionsize_, DistanceMatrix< Value >::init_size_, DistanceMatrix< Value >::matrix_, and DistanceMatrix< Value >::min_element_.
| bool operator== | ( | DistanceMatrix< ValueType > const & | rhs | ) | const [inline] |
Equality comparator.
| Exception::Precondition | thrown if given DistanceMatrix is not compatible in size |
References DistanceMatrix< Value >::dimensionsize(), DistanceMatrix< Value >::dimensionsize_, DistanceMatrix< Value >::matrix_, and OPENMS_PRECONDITION.
| void reduce | ( | SizeType | j | ) | [inline] |
reduces DistanceMatrix by one dimension. first the jth row, then jth column
| j | the jth row (and therewith also jth col) to be removed |
| Exception::OutOfRange | if j is grater than the greatest row number |
may invalidates min_element_, make sure to update min_element_ if neccessary before used
References DistanceMatrix< Value >::dimensionsize_, DistanceMatrix< Value >::matrix_, and NULL.
| void resize | ( | SizeType | dimensionsize, | |
| Value | value = Value() | |||
| ) | [inline] |
resizing the container
| dimensionsize | the desired number of rows (and therewith cols) | |
| value | which the matrix will be filled with |
| Exception::OutOfMemory | thrown if size of DistanceMatrix requested does not fit into memory |
invalidates all content
References DistanceMatrix< Value >::dimensionsize_, DistanceMatrix< Value >::init_size_, OpenMS::Constants::k, DistanceMatrix< Value >::matrix_, DistanceMatrix< Value >::min_element_, and NULL.
Referenced by ClusterHierarchical::cluster().
sets a value at a given position:
| i | the i-th row | |
| j | the j-th col | |
| value | the set-value |
| Exception::OutOfRange | if given coordinates are out of range |
References DistanceMatrix< Value >::dimensionsize_, DistanceMatrix< Value >::matrix_, DistanceMatrix< Value >::min_element_, and DistanceMatrix< Value >::updateMinElement().
Referenced by ClusterHierarchical::cluster().
sets a value at a given position:
| i | the i-th row | |
| j | the j-th col | |
| value | the set-value |
| Exception::OutOfRange | if given coordinates are out of range |
possible invalidation of min_element_ - make sure to update before further usage of matrix
References DistanceMatrix< Value >::dimensionsize_, and DistanceMatrix< Value >::matrix_.
Referenced by ClusterHierarchical::cluster().
| void updateMinElement | ( | ) | [inline] |
keep track of the actual minimum element after altering the matrix
| Exception::OutOfRange | thrown if there is no element to access |
References DistanceMatrix< Value >::dimensionsize_, DistanceMatrix< Value >::matrix_, and DistanceMatrix< Value >::min_element_.
Referenced by DistanceMatrix< Value >::setValue().
| std::ostream & operator<< | ( | std::ostream & | os, | |
| const DistanceMatrix< Value > & | matrix | |||
| ) | [related] |
Print the contents to a stream.
SizeType dimensionsize_ [protected] |
number of accessably stored rows (i.e. number of columns)
Referenced by DistanceMatrix< Value >::clear(), DistanceMatrix< Value >::dimensionsize(), DistanceMatrix< Value >::DistanceMatrix(), DistanceMatrix< Value >::getMinElementCoordinates(), DistanceMatrix< Value >::getValue(), DistanceMatrix< Value >::operator=(), DistanceMatrix< Value >::operator==(), DistanceMatrix< Value >::reduce(), DistanceMatrix< Value >::resize(), DistanceMatrix< Value >::setValue(), DistanceMatrix< Value >::setValueQuick(), and DistanceMatrix< Value >::updateMinElement().
SizeType init_size_ [protected] |
number of actually stored rows
Referenced by DistanceMatrix< Value >::clear(), DistanceMatrix< Value >::DistanceMatrix(), DistanceMatrix< Value >::operator=(), DistanceMatrix< Value >::resize(), and DistanceMatrix< Value >::~DistanceMatrix().
sparse element not to be included in base container
Referenced by DistanceMatrix< Value >::clear(), DistanceMatrix< Value >::DistanceMatrix(), DistanceMatrix< Value >::getValue(), DistanceMatrix< Value >::operator=(), DistanceMatrix< Value >::operator==(), DistanceMatrix< Value >::reduce(), DistanceMatrix< Value >::resize(), DistanceMatrix< Value >::setValue(), DistanceMatrix< Value >::setValueQuick(), DistanceMatrix< Value >::updateMinElement(), and DistanceMatrix< Value >::~DistanceMatrix().
std::pair<SizeType, SizeType> min_element_ [protected] |
index of minimal element(i.e. number in underlying SparseVector)
Referenced by DistanceMatrix< Value >::clear(), DistanceMatrix< Value >::DistanceMatrix(), DistanceMatrix< Value >::getMinElementCoordinates(), DistanceMatrix< Value >::operator=(), DistanceMatrix< Value >::resize(), DistanceMatrix< Value >::setValue(), and DistanceMatrix< Value >::updateMinElement().
| OpenMS / TOPP release 1.10.0 | Documentation generated on Thu Mar 7 2013 09:42:52 using doxygen 1.7.1 |