#include <dmatrix.h>


Attenzione ai metodi di accesso: at(i,j) � l'elemento alla riga i e colonna j
Se state usando DMatrix per rappresentare mappe o altre cose spaziali, vi conviene usare la classe Viewport che ha implementato per bene i metodi per passare dalle coordinate mondo alla cella delle griglia e viceversa. (non ve ne pentirete)
Se volete usare x,y vi conviene accedere in questo modo: at(y, x) ovvero y->righe, x->colonne.
Questa classe implementa il copy-on-write. Da utente, � tutto nascosto ai vostri occhi. Se aggiungete metodi che cambiano i dati, ricordate di chiamare willModify() prima di modificare effettivamente.
Definition at line 58 of file dmatrix.h.
Public Member Functions | |
| DMatrix (int rows=1, int columns=1) | |
| COSTRUCTORS amd reference counting. | |
| ~DMatrix () | |
| DMatrix (const DMatrix &) | |
| DMatrix & | operator= (const DMatrix &) |
| X * | operator[] (int i) |
| const X * | operator[] (int row) const |
| int | rows () const |
| int | columns () const |
| DMatrix< X > | aPieceOfYou (int i, int j, int m, int n, X zero=0) const |
| DMatrix< X > | around (int i, int j, int m, X zero=0) const |
| X | at (int i, int j, X zero=0) const |
| X & | el (int i, int j) throw (std::invalid_argument) |
| const X & | el (int i, int j) const throw (std::invalid_argument) |
| X & | el (const Point2< int > &p) throw (std::invalid_argument) |
| const X & | el (const Point2< int > &p) const throw (std::invalid_argument) |
| bool | isInside (int i, int j) const |
| bool | isInside (const Point2< int > &p) const |
| void | setAll (const X &x) |
| template<class Op> | |
| void | applyAll (Op &op) |
| Point2< int > | begin () |
| Point2< int > | end () |
| Point2< int > | next (const Point2< int > &prev) |
| template<class Y, class Z> | |
| void | product (const DMatrix< Y > &, Z &z) const |
| void | multAll (const X &x) |
| DMatrix | transpose () const |
| const X | det () const |
| DMatrix | inv () const |
| DMatrix | operator* (const DMatrix &) const |
| DMatrix | operator+ (const DMatrix &) const |
| DMatrix | operator- (const DMatrix &) const |
| DMatrix | operator* (const X &) const |
| bool | operator== (const DMatrix &) const |
| X * | getElems () |
| const X * | getElems () const |
| std::string | outputSpaceSeparated () const |
Static Public Member Functions | |
| static DMatrix | I (int n) |
| Returns the identity matrix. | |
Protected Member Functions | |
| void | willModify () |
| These methods do the copy-on-write. | |
| void | detach () |
Protected Attributes | |
| int | nrows |
| int | ncols |
| X * | elems |
| X ** | mrows |
| int * | shares |
| RDK2::Geometry::DMatrix< X >::DMatrix | ( | int | rows = 1, |
|
| int | columns = 1 | |||
| ) | [inline] |
COSTRUCTORS amd reference counting.
Default constructor X() is called for every cell.
Definition at line 5 of file dmatrix_imp.hpp.
References RDK2::Geometry::DMatrix< X >::elems, RDK2::Geometry::DMatrix< X >::mrows, RDK2::Geometry::DMatrix< X >::ncols, RDK2::Geometry::DMatrix< X >::nrows, and RDK2::Geometry::DMatrix< X >::shares.
| RDK2::Geometry::DMatrix< X >::~DMatrix | ( | ) | [inline] |
Definition at line 28 of file dmatrix_imp.hpp.
References RDK2::Geometry::DMatrix< X >::elems, RDK2::Geometry::DMatrix< X >::mrows, and RDK2::Geometry::DMatrix< X >::shares.
| RDK2::Geometry::DMatrix< X >::DMatrix | ( | const DMatrix< X > & | m | ) | [inline] |
Definition at line 20 of file dmatrix_imp.hpp.
References RDK2::Geometry::DMatrix< X >::elems, RDK2::Geometry::DMatrix< X >::mrows, RDK2::Geometry::DMatrix< X >::ncols, RDK2::Geometry::DMatrix< X >::nrows, and RDK2::Geometry::DMatrix< X >::shares.
| DMatrix< X > & RDK2::Geometry::DMatrix< X >::operator= | ( | const DMatrix< X > & | m | ) | [inline] |
Definition at line 36 of file dmatrix_imp.hpp.
References RDK2::Geometry::DMatrix< X >::elems, RDK2::Geometry::DMatrix< X >::mrows, RDK2::Geometry::DMatrix< X >::ncols, RDK2::Geometry::DMatrix< X >::nrows, and RDK2::Geometry::DMatrix< X >::shares.
| X* RDK2::Geometry::DMatrix< X >::operator[] | ( | int | i | ) | [inline] |
| const X* RDK2::Geometry::DMatrix< X >::operator[] | ( | int | row | ) | const [inline] |
| int RDK2::Geometry::DMatrix< X >::rows | ( | ) | const [inline] |
Definition at line 74 of file dmatrix.h.
Referenced by RDK2::Geometry::Viewport::b2w(), RDK2::Geometry::convolve(), RDK2::Geometry::copy(), RDK2::Geometry::eig22_gsl(), RDK2::Geometry::getAsVector(), RDK2::Geometry::Viewport::getCellBoundingBox(), RDK2::Geometry::Viewport::getCellSize(), RDK2::Geometry::getWhiteningMatrix22(), RDK2::Geometry::DMatrix< int >::next(), RDK2::Geometry::normalize(), RDK2::Geometry::operator*(), RDK2::Geometry::DMatrix< X >::product(), and RDK2::Geometry::savePGM().
| int RDK2::Geometry::DMatrix< X >::columns | ( | ) | const [inline] |
Definition at line 75 of file dmatrix.h.
Referenced by RDK2::Geometry::Viewport::b2w(), RDK2::Geometry::convolve(), RDK2::Geometry::copy(), RDK2::Geometry::eig22_gsl(), RDK2::Geometry::getAsVector(), RDK2::Geometry::Viewport::getCellBoundingBox(), RDK2::Geometry::Viewport::getCellSize(), RDK2::Geometry::getWhiteningMatrix22(), RDK2::Geometry::DMatrix< int >::next(), RDK2::Geometry::normalize(), RDK2::Geometry::operator*(), RDK2::Geometry::DMatrix< X >::product(), and RDK2::Geometry::savePGM().
| DMatrix< X > RDK2::Geometry::DMatrix< X >::aPieceOfYou | ( | int | i, | |
| int | j, | |||
| int | m, | |||
| int | n, | |||
| X | zero = 0 | |||
| ) | const [inline] |
Returns a copy of the sub-matrix i,j-i+m,j+n. Can go over the borders, will be padded with zero.
Definition at line 82 of file dmatrix_imp.hpp.
References RDK2::Geometry::DMatrix< X >::at().
Referenced by RDK2::Geometry::DMatrix< X >::around(), and RDK2::Geometry::PoseNormalDist::getXYCov().

| DMatrix< X > RDK2::Geometry::DMatrix< X >::around | ( | int | i, | |
| int | j, | |||
| int | m, | |||
| X | zero = 0 | |||
| ) | const [inline] |
Returns the 2m+1 square sub-matrix around point i,j
Definition at line 92 of file dmatrix_imp.hpp.
References RDK2::Geometry::DMatrix< X >::aPieceOfYou().
Referenced by RDK2::Geometry::convolve().

| X RDK2::Geometry::DMatrix< X >::at | ( | int | i, | |
| int | j, | |||
| X | zero = 0 | |||
| ) | const [inline] |
Returns value at row=i,column=j of zero if out of borders
Definition at line 62 of file dmatrix_imp.hpp.
References RDK2::Geometry::DMatrix< X >::isInside(), and RDK2::Geometry::DMatrix< X >::mrows.
Referenced by RDK2::Geometry::DMatrix< X >::aPieceOfYou(), and RDK2::Geometry::DMatrix< X >::outputSpaceSeparated().

| X & RDK2::Geometry::DMatrix< X >::el | ( | int | i, | |
| int | j | |||
| ) | throw (std::invalid_argument) [inline] |
Access element at row=i=y,column=j=x; throws exception if out of borders
Definition at line 67 of file dmatrix_imp.hpp.
References RDK2::Geometry::DMatrix< X >::isInside(), and RDK2::Geometry::DMatrix< X >::mrows.
Referenced by RDK2::Geometry::DMatrix< int >::el(), RDK2::SensorData::LaserData::getFisher(), RDK2::SensorData::LaserData::getFisherForXY(), and RDK2::Geometry::reassembleFromEig().

| const X & RDK2::Geometry::DMatrix< X >::el | ( | int | i, | |
| int | j | |||
| ) | const throw (std::invalid_argument) [inline] |
Definition at line 74 of file dmatrix_imp.hpp.
References RDK2::Geometry::DMatrix< X >::isInside(), and RDK2::Geometry::DMatrix< X >::mrows.

| X& RDK2::Geometry::DMatrix< X >::el | ( | const Point2< int > & | p | ) | throw (std::invalid_argument) [inline] |
| const X& RDK2::Geometry::DMatrix< X >::el | ( | const Point2< int > & | p | ) | const throw (std::invalid_argument) [inline] |
| bool RDK2::Geometry::DMatrix< X >::isInside | ( | int | i, | |
| int | j | |||
| ) | const [inline] |
Checks whether point is inside the matrix.
Definition at line 98 of file dmatrix_imp.hpp.
References RDK2::Geometry::DMatrix< X >::ncols, and RDK2::Geometry::DMatrix< X >::nrows.
Referenced by RDK2::Geometry::DMatrix< X >::at(), RDK2::Geometry::DMatrix< X >::el(), and RDK2::Geometry::DMatrix< int >::isInside().
| bool RDK2::Geometry::DMatrix< X >::isInside | ( | const Point2< int > & | p | ) | const [inline] |
| void RDK2::Geometry::DMatrix< X >::setAll | ( | const X & | x | ) | [inline] |
Set all elements to value
Definition at line 103 of file dmatrix_imp.hpp.
References RDK2::Geometry::DMatrix< X >::ncols, RDK2::Geometry::DMatrix< X >::nrows, and RDK2::Geometry::DMatrix< X >::willModify().
Referenced by RDK2::SensorData::LaserData::getFisher(), RDK2::SensorData::LaserData::getFisherForXY(), and RDK2::Geometry::DMatrix< X >::I().

| void RDK2::Geometry::DMatrix< X >::applyAll | ( | Op & | op | ) | [inline] |
| Point2<int> RDK2::Geometry::DMatrix< X >::begin | ( | ) | [inline] |
| Point2<int> RDK2::Geometry::DMatrix< X >::end | ( | ) | [inline] |
| Point2<int> RDK2::Geometry::DMatrix< X >::next | ( | const Point2< int > & | prev | ) | [inline] |
| void RDK2::Geometry::DMatrix< X >::willModify | ( | ) | [inline, protected] |
These methods do the copy-on-write.
Call this method before modifying the data.
Definition at line 138 of file dmatrix.h.
Referenced by RDK2::Geometry::DMatrix< int >::applyAll(), RDK2::Geometry::DMatrix< int >::getElems(), RDK2::Geometry::DMatrix< X >::multAll(), RDK2::Geometry::DMatrix< int >::operator[](), and RDK2::Geometry::DMatrix< X >::setAll().
| void RDK2::Geometry::DMatrix< X >::detach | ( | ) | [inline, protected] |
Definition at line 52 of file dmatrix_imp.hpp.
References RDK2::Geometry::DMatrix< X >::elems, RDK2::Geometry::DMatrix< X >::ncols, and RDK2::Geometry::DMatrix< X >::nrows.
Referenced by RDK2::Geometry::DMatrix< X >::det(), and RDK2::Geometry::DMatrix< int >::willModify().
| void RDK2::Geometry::DMatrix< X >::product | ( | const DMatrix< Y > & | m, | |
| Z & | z | |||
| ) | const [inline] |
For matrixes holding numbers Correlation (sum of product of corresponding elements). Note that return value is passed as a reference beacause of compiler's problems with templates.
Definition at line 138 of file dmatrix_numeric.hpp.
References RDK2::Geometry::DMatrix< X >::columns(), RDK2::Geometry::DMatrix< X >::mrows, RDK2::Geometry::DMatrix< X >::ncols, RDK2::Geometry::DMatrix< X >::nrows, and RDK2::Geometry::DMatrix< X >::rows().
Referenced by RDK2::Geometry::convolve().

| void RDK2::Geometry::DMatrix< X >::multAll | ( | const X & | x | ) | [inline] |
Multiplies all elements by a value.
Definition at line 128 of file dmatrix_numeric.hpp.
References RDK2::Geometry::DMatrix< X >::ncols, RDK2::Geometry::DMatrix< X >::nrows, and RDK2::Geometry::DMatrix< X >::willModify().

| DMatrix< X > RDK2::Geometry::DMatrix< X >::transpose | ( | ) | const [inline] |
Definition at line 75 of file dmatrix_numeric.hpp.
References RDK2::Geometry::DMatrix< X >::mrows, RDK2::Geometry::DMatrix< X >::ncols, and RDK2::Geometry::DMatrix< X >::nrows.
| const X RDK2::Geometry::DMatrix< X >::det | ( | ) | const [inline] |
Definition at line 40 of file dmatrix_numeric.hpp.
References RDK2::RPrimitive::d, RDK2::Geometry::DMatrix< X >::detach(), RDK2::Geometry::DMatrix< X >::mrows, RDK2::Geometry::DMatrix< X >::ncols, and RDK2::Geometry::DMatrix< X >::nrows.

| DMatrix< X > RDK2::Geometry::DMatrix< X >::inv | ( | ) | const [inline] |
Definition at line 5 of file dmatrix_numeric.hpp.
References RDK2::Geometry::DMatrix< X >::I(), RDK2::Geometry::DMatrix< X >::mrows, RDK2::Geometry::DMatrix< X >::ncols, and RDK2::Geometry::DMatrix< X >::nrows.
Referenced by RDK2::SensorData::LaserData::getCRB(), RDK2::Geometry::getWhiteningMatrix22(), and RDK2::Geometry::reassembleFromEig().

| DMatrix< X > RDK2::Geometry::DMatrix< X >::I | ( | int | n | ) | [inline, static] |
Returns the identity matrix.
Definition at line 147 of file dmatrix_numeric.hpp.
References RDK2::Geometry::DMatrix< X >::setAll().
Referenced by RDK2::Geometry::DMatrix< X >::inv().

| DMatrix< X > RDK2::Geometry::DMatrix< X >::operator* | ( | const DMatrix< X > & | m | ) | const [inline] |
Definition at line 83 of file dmatrix_numeric.hpp.
References RDK2::Geometry::DMatrix< X >::mrows, RDK2::Geometry::DMatrix< X >::ncols, and RDK2::Geometry::DMatrix< X >::nrows.
| DMatrix< X > RDK2::Geometry::DMatrix< X >::operator+ | ( | const DMatrix< X > & | m | ) | const [inline] |
Definition at line 96 of file dmatrix_numeric.hpp.
References RDK2::Geometry::DMatrix< X >::elems, RDK2::Geometry::DMatrix< X >::ncols, and RDK2::Geometry::DMatrix< X >::nrows.
| DMatrix< X > RDK2::Geometry::DMatrix< X >::operator- | ( | const DMatrix< X > & | m | ) | const [inline] |
Definition at line 103 of file dmatrix_numeric.hpp.
References RDK2::Geometry::DMatrix< X >::elems, RDK2::Geometry::DMatrix< X >::ncols, and RDK2::Geometry::DMatrix< X >::nrows.
| DMatrix< X > RDK2::Geometry::DMatrix< X >::operator* | ( | const X & | e | ) | const [inline] |
Definition at line 110 of file dmatrix_numeric.hpp.
References RDK2::Geometry::DMatrix< X >::elems, RDK2::Geometry::DMatrix< X >::ncols, and RDK2::Geometry::DMatrix< X >::nrows.
| bool RDK2::Geometry::DMatrix< X >::operator== | ( | const DMatrix< X > & | m | ) | const [inline] |
Definition at line 116 of file dmatrix_numeric.hpp.
References RDK2::Geometry::DMatrix< X >::elems, RDK2::Geometry::DMatrix< X >::ncols, and RDK2::Geometry::DMatrix< X >::nrows.
| X* RDK2::Geometry::DMatrix< X >::getElems | ( | ) | [inline] |
| const X* RDK2::Geometry::DMatrix< X >::getElems | ( | ) | const [inline] |
| std::string RDK2::Geometry::DMatrix< X >::outputSpaceSeparated | ( | ) | const [inline] |
Output as space separated row1 .. rowN
Definition at line 111 of file dmatrix_imp.hpp.
References RDK2::Geometry::DMatrix< X >::at(), RDK2::Geometry::DMatrix< X >::ncols, and RDK2::Geometry::DMatrix< X >::nrows.

int RDK2::Geometry::DMatrix< X >::nrows [protected] |
Definition at line 173 of file dmatrix.h.
Referenced by RDK2::Geometry::DMatrix< int >::applyAll(), RDK2::Geometry::DMatrix< X >::det(), RDK2::Geometry::DMatrix< X >::detach(), RDK2::Geometry::DMatrix< X >::DMatrix(), RDK2::Geometry::DMatrix< X >::inv(), RDK2::Geometry::DMatrix< X >::isInside(), RDK2::Geometry::DMatrix< X >::multAll(), RDK2::Geometry::DMatrix< X >::operator*(), RDK2::Geometry::DMatrix< X >::operator+(), RDK2::Geometry::DMatrix< X >::operator-(), RDK2::Geometry::DMatrix< X >::operator=(), RDK2::Geometry::DMatrix< X >::operator==(), RDK2::Geometry::DMatrix< X >::outputSpaceSeparated(), RDK2::Geometry::DMatrix< X >::product(), RDK2::Geometry::DMatrix< int >::rows(), RDK2::Geometry::DMatrix< X >::setAll(), and RDK2::Geometry::DMatrix< X >::transpose().
int RDK2::Geometry::DMatrix< X >::ncols [protected] |
Definition at line 173 of file dmatrix.h.
Referenced by RDK2::Geometry::DMatrix< int >::applyAll(), RDK2::Geometry::DMatrix< int >::columns(), RDK2::Geometry::DMatrix< X >::det(), RDK2::Geometry::DMatrix< X >::detach(), RDK2::Geometry::DMatrix< X >::DMatrix(), RDK2::Geometry::DMatrix< X >::inv(), RDK2::Geometry::DMatrix< X >::isInside(), RDK2::Geometry::DMatrix< X >::multAll(), RDK2::Geometry::DMatrix< X >::operator*(), RDK2::Geometry::DMatrix< X >::operator+(), RDK2::Geometry::DMatrix< X >::operator-(), RDK2::Geometry::DMatrix< X >::operator=(), RDK2::Geometry::DMatrix< X >::operator==(), RDK2::Geometry::DMatrix< X >::outputSpaceSeparated(), RDK2::Geometry::DMatrix< X >::product(), RDK2::Geometry::DMatrix< X >::setAll(), and RDK2::Geometry::DMatrix< X >::transpose().
X* RDK2::Geometry::DMatrix< X >::elems [protected] |
Definition at line 174 of file dmatrix.h.
Referenced by RDK2::Geometry::DMatrix< int >::applyAll(), RDK2::Geometry::DMatrix< X >::detach(), RDK2::Geometry::DMatrix< X >::DMatrix(), RDK2::Geometry::DMatrix< int >::getElems(), RDK2::Geometry::DMatrix< X >::operator*(), RDK2::Geometry::DMatrix< X >::operator+(), RDK2::Geometry::DMatrix< X >::operator-(), RDK2::Geometry::DMatrix< X >::operator=(), RDK2::Geometry::DMatrix< X >::operator==(), and RDK2::Geometry::DMatrix< X >::~DMatrix().
X** RDK2::Geometry::DMatrix< X >::mrows [protected] |
Definition at line 175 of file dmatrix.h.
Referenced by RDK2::Geometry::DMatrix< X >::at(), RDK2::Geometry::DMatrix< X >::det(), RDK2::Geometry::DMatrix< X >::DMatrix(), RDK2::Geometry::DMatrix< X >::el(), RDK2::Geometry::DMatrix< X >::inv(), RDK2::Geometry::DMatrix< X >::operator*(), RDK2::Geometry::DMatrix< X >::operator=(), RDK2::Geometry::DMatrix< int >::operator[](), RDK2::Geometry::DMatrix< X >::product(), RDK2::Geometry::DMatrix< X >::transpose(), and RDK2::Geometry::DMatrix< X >::~DMatrix().
int* RDK2::Geometry::DMatrix< X >::shares [protected] |
Definition at line 177 of file dmatrix.h.
Referenced by RDK2::Geometry::DMatrix< X >::DMatrix(), RDK2::Geometry::DMatrix< X >::operator=(), RDK2::Geometry::DMatrix< int >::willModify(), and RDK2::Geometry::DMatrix< X >::~DMatrix().
1.5.6