RDK2::Geometry::DMatrix< X > Class Template Reference

#include <dmatrix.h>

Inheritance diagram for RDK2::Geometry::DMatrix< X >:

Inheritance graph
[legend]
Collaboration diagram for RDK2::Geometry::DMatrix< X >:

Collaboration graph
[legend]

Detailed Description

template<class X>
class RDK2::Geometry::DMatrix< X >

Attenzione al costruttore: rows,columns == height,width

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 &)
DMatrixoperator= (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
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

Constructor & Destructor Documentation

template<class X>
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.

template<class X>
RDK2::Geometry::DMatrix< X >::~DMatrix (  )  [inline]

template<class X>
RDK2::Geometry::DMatrix< X >::DMatrix ( const DMatrix< X > &  m  )  [inline]


Member Function Documentation

template<class X>
DMatrix< X > & RDK2::Geometry::DMatrix< X >::operator= ( const DMatrix< X > &  m  )  [inline]

template<class X>
X* RDK2::Geometry::DMatrix< X >::operator[] ( int  i  )  [inline]

Definition at line 67 of file dmatrix.h.

template<class X>
const X* RDK2::Geometry::DMatrix< X >::operator[] ( int  row  )  const [inline]

Definition at line 72 of file dmatrix.h.

template<class X>
int RDK2::Geometry::DMatrix< X >::rows (  )  const [inline]

template<class X>
int RDK2::Geometry::DMatrix< X >::columns (  )  const [inline]

template<class X>
DMatrix< X > RDK2::Geometry::DMatrix< X >::aPieceOfYou ( int  i,
int  j,
int  m,
int  n,
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().

Here is the call graph for this function:

template<class X>
DMatrix< X > RDK2::Geometry::DMatrix< X >::around ( int  i,
int  j,
int  m,
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().

Here is the call graph for this function:

template<class X>
X RDK2::Geometry::DMatrix< X >::at ( int  i,
int  j,
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().

Here is the call graph for this function:

template<class X>
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().

Here is the call graph for this function:

template<class X>
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.

Here is the call graph for this function:

template<class X>
X& RDK2::Geometry::DMatrix< X >::el ( const Point2< int > &  p  )  throw (std::invalid_argument) [inline]

Equivalent to el(p.y, p.x)

Definition at line 95 of file dmatrix.h.

template<class X>
const X& RDK2::Geometry::DMatrix< X >::el ( const Point2< int > &  p  )  const throw (std::invalid_argument) [inline]

Definition at line 99 of file dmatrix.h.

template<class X>
bool RDK2::Geometry::DMatrix< X >::isInside ( int  i,
int  j 
) const [inline]

template<class X>
bool RDK2::Geometry::DMatrix< X >::isInside ( const Point2< int > &  p  )  const [inline]

Equivalent to isInside(p.y, p.x)

Definition at line 107 of file dmatrix.h.

template<class X>
void RDK2::Geometry::DMatrix< X >::setAll ( const X &  x  )  [inline]

template<class X>
template<class Op>
void RDK2::Geometry::DMatrix< X >::applyAll ( Op &  op  )  [inline]

Applies an operation to all elements

Definition at line 115 of file dmatrix.h.

template<class X>
Point2<int> RDK2::Geometry::DMatrix< X >::begin (  )  [inline]

Definition at line 122 of file dmatrix.h.

template<class X>
Point2<int> RDK2::Geometry::DMatrix< X >::end (  )  [inline]

Definition at line 123 of file dmatrix.h.

Referenced by RDK2::Geometry::DMatrix< int >::next().

template<class X>
Point2<int> RDK2::Geometry::DMatrix< X >::next ( const Point2< int > &  prev  )  [inline]

Definition at line 124 of file dmatrix.h.

template<class X>
void RDK2::Geometry::DMatrix< X >::willModify (  )  [inline, protected]

template<class X>
void RDK2::Geometry::DMatrix< X >::detach (  )  [inline, protected]

template<class X>
template<class Y, class Z>
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().

Here is the call graph for this function:

template<class X>
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().

Here is the call graph for this function:

template<class X>
DMatrix< X > RDK2::Geometry::DMatrix< X >::transpose (  )  const [inline]

template<class X>
const X RDK2::Geometry::DMatrix< X >::det (  )  const [inline]

template<class X>
DMatrix< X > RDK2::Geometry::DMatrix< X >::inv (  )  const [inline]

template<class X>
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().

Here is the call graph for this function:

template<class X>
DMatrix< X > RDK2::Geometry::DMatrix< X >::operator* ( const DMatrix< X > &  m  )  const [inline]

template<class X>
DMatrix< X > RDK2::Geometry::DMatrix< X >::operator+ ( const DMatrix< X > &  m  )  const [inline]

template<class X>
DMatrix< X > RDK2::Geometry::DMatrix< X >::operator- ( const DMatrix< X > &  m  )  const [inline]

template<class X>
DMatrix< X > RDK2::Geometry::DMatrix< X >::operator* ( const X &  e  )  const [inline]

template<class X>
bool RDK2::Geometry::DMatrix< X >::operator== ( const DMatrix< X > &  m  )  const [inline]

template<class X>
X* RDK2::Geometry::DMatrix< X >::getElems (  )  [inline]

Definition at line 181 of file dmatrix.h.

Referenced by RDK2::Geometry::normalize().

template<class X>
const X* RDK2::Geometry::DMatrix< X >::getElems (  )  const [inline]

Definition at line 182 of file dmatrix.h.

template<class X>
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.

Here is the call graph for this function:


Field Documentation

template<class X>
int RDK2::Geometry::DMatrix< X >::nrows [protected]

template<class X>
int RDK2::Geometry::DMatrix< X >::ncols [protected]

template<class X>
X* RDK2::Geometry::DMatrix< X >::elems [protected]

template<class X>
X** RDK2::Geometry::DMatrix< X >::mrows [protected]

template<class X>
int* RDK2::Geometry::DMatrix< X >::shares [protected]


The documentation for this class was generated from the following files:

Generated on Tue Mar 3 15:05:53 2009 for OpenRDK by  doxygen 1.5.6