AURobotServers  4
Public Member Functions | Private Member Functions | Private Attributes | List of all members
UMatrix4 Class Reference

#include <umatrix.h>

Inheritance diagram for UMatrix4:
Inheritance graph

Public Member Functions

UMatrix4 col (int c)
 
double density (UMatrix4 v, UMatrix4 vm, bool *isOK=NULL)
 
double densityQi (UMatrix4 vd, double det, bool *isOK=NULL)
 
double det (int *error=NULL)
 
UMatrix4 eig2x2 (bool *complex, UMatrix4 *eigenvectors)
 
UMatrix4 inversed ()
 
UMatrix4 operator* (UMatrix4 B)
 
UMatrix4 operator* (const double scale)
 
UPosition operator* (UPosition pos)
 
UMatrix4 operator+ (UMatrix4 B)
 
UMatrix4 operator+ (const double val)
 
UMatrix4 operator- (UMatrix4 B)
 
UMatrix4 operator- (const double val)
 
UMatrix4 operator= (UMatrix4 V)
 
UMatrix4 row (int r)
 
UMatrix4 transposed ()
 
 UMatrix4 ()
 
 UMatrix4 (const unsigned int rows, const unsigned int cols)
 
 UMatrix4 (const unsigned int cols)
 
 UMatrix4 (const unsigned int rows, const unsigned int cols, const double i)
 
- Public Member Functions inherited from UMatrix
void add (UMatrix *A, UMatrix *B)
 
void add (UMatrix *A)
 
void add (const double val)
 
void clear ()
 
unsigned int cols ()
 
void copy (UMatrix *source)
 
CvArr * cvArr ()
 
CvMat * cvMat ()
 
double det (int *error)
 
void eig (UMatrix *W, UMatrix *U, UMatrix *V, int flag=CV_SVD_V_T)
 
int elements ()
 
void error (const int ierr, const char *message)
 
bool expand (const unsigned int iRows, const unsigned int iCols)
 
bool expand (const unsigned int iRows, const unsigned int iCols, const double iVal)
 
double get (const unsigned int at)
 
double get (int row, int col)
 
double * getData ()
 
virtual const char * getDataType ()
 
double * getRow (int row)
 
bool init (const unsigned int rows, const unsigned int cols)
 
bool init (const unsigned int rows, const unsigned int cols, const double i)
 
bool init (const unsigned int iRows, const unsigned int iCols, double *data, unsigned int bufferSizeInDoubles)
 
void inverse (UMatrix *B, int method=CV_SVD)
 
virtual bool isAlsoA (const char *typeString)
 
bool isCol ()
 
bool isRow ()
 
int maxSize ()
 
int mult (UMatrix *A, UMatrix *B)
 
void mult (const double scale)
 
bool normalize ()
 
void print (const char *prestring)
 
unsigned int rows ()
 
int save (char *filename, char delim= ' ')
 
bool save (FILE *f, const char *name)
 
void set (const double value0, const double value1, const double value2=0.0, const double value3=0.0)
 
bool setAt (const unsigned int at, const double value)
 
int setCol (unsigned int col, const double value0, const double value1=0.0, const double value2=0.0, const double value3=0.0)
 
int setDiag (double value0, double value1, double value2=0.0, double value3=0.0)
 
bool setMat (const int rCnt, const int cCnt, double *values)
 
int setMinor (UMatrix *mA, const unsigned int ar, const unsigned int ac)
 
int setRC (const unsigned int row, const unsigned int col, const double value)
 
int setRow (unsigned int row, const double value0, const double value1=0.0, const double value2=0.0, const double value3=0.0)
 
int setRow (unsigned int row, unsigned int valCnt, const double val[])
 
bool setSize (const unsigned int iRows, const unsigned int iCols)
 
unsigned int size ()
 
virtual void snprint (const char *prestring, char *buff, const int buffCnt)
 
virtual void snprintMaple (const char *prestring, char *s, const int length)
 
bool solve (UMatrix *iB, UMatrix *X)
 
double sqSum ()
 
void sub (UMatrix *A, UMatrix *B)
 
void sub (UMatrix *A)
 
double trace ()
 
void transpose (UMatrix *B=NULL)
 
bool valid ()
 
- Public Member Functions inherited from UDataBase
bool isA (const char *typeString)
 
 UDataBase ()
 
virtual ~UDataBase ()
 

Private Member Functions

void connect ()
 

Private Attributes

double d [MAX_VECTOR4_SIZE *MAX_VECTOR4_SIZE]
 

Additional Inherited Members

- Public Attributes inherited from UMatrix
int err
 
- Protected Attributes inherited from UMatrix
CvMat mat
 
unsigned int matrixSize
 

Detailed Description

Class for 3d matrices with up to 4 rows and 4 columns. Actual size may be smaller but not bigger than this size. The memory allocation is static in the class members, so no heap space is used.

Constructor & Destructor Documentation

UMatrix4::UMatrix4 ( )

Constructor of a matrix of this type with size (0,0).

References UMatrix::err, UMatrix::mat, UMatrix::matrixSize, and MAX_VECTOR4_SIZE.

UMatrix4::UMatrix4 ( const unsigned int  rows,
const unsigned int  cols 
)
UMatrix4::UMatrix4 ( const unsigned int  cols)

Constructor of a vector with one row of this size

References UMatrix::cols(), UMatrix::err, UMatrix::error(), UMatrix::mat, UMatrix::matrixSize, and MAX_VECTOR4_SIZE.

UMatrix4::UMatrix4 ( const unsigned int  rows,
const unsigned int  cols,
const double  i 
)

Constructor of matrix with this size and initial value i along the main diagonal (and other elements zero).

References UMatrix::err, UMatrix::init(), UMatrix::mat, UMatrix::matrixSize, and MAX_VECTOR4_SIZE.

Member Function Documentation

UMatrix4 UMatrix4::col ( int  c)

Get collumn as vector

References UMatrix::rows(), and UMatrix::set().

void UMatrix4::connect ( )
private

Reconnect matrix pointer to data area

References UMatrix::cols(), and UMatrix::mat.

Referenced by operator*(), operator+(), operator-(), and operator=().

double UMatrix4::density ( UMatrix4  v,
UMatrix4  vm,
bool *  isOK = NULL 
)

Find density value for a vector position 'v', when this matrix is assumed to be a covariance matrix.
The mean is in vector vm.

References UMatrix::cols(), densityQi(), UMatrix::det(), UMatrix::err, and UMatrix::rows().

double UMatrix4::densityQi ( UMatrix4  vd,
double  det,
bool *  isOK = NULL 
)

Find density function at point 'v', for a distribution with 'this' as inverse covariance matrix and determinant of covariance matrix of 'det'. Mean value of distribution is assumed to be zero.
On return is 'isOK' false if function failed.

References UMatrix::cols(), UMatrix::rows(), and transposed().

Referenced by density().

double UMatrix4::det ( int *  error = NULL)

Solve a equation set. solve matrix (this) x vector (result) = vector (B) Find determinant of matrix

References UMatrix::cols(), UMatrix::det(), det(), UMatrix::err, UMatrix::rows(), and UMatrix::setMinor().

Referenced by UFuzzySplit::classifyOld(), det(), UFuzzySplit::getCovariance(), harris(), UPoseQ::makeQi(), testEigenvector(), and testLinearAlgebra().

UMatrix4 UMatrix4::eig2x2 ( bool *  complex,
UMatrix4 eigenvectors 
)

Find eigenvalues and eigenvectors for 2x2 matrix. If matrix A is larger than 2x2, then solution is found for the 2x2 formed by the first 2 rows and columns. If roots are complex, the 'complex' flag is set true and the returned eigenvalues and vectors are the real part only. The eigenvalues are returned in a vector (size 2) and the eigenvectors are returned in 'eigenvectors' as columns corresponding to the elements in this vector of eigenvalues.

References a, absf(), UMatrix::cols(), UMatrix::err, UMatrix::get(), UMatrix::rows(), UMatrix::set(), UMatrix::setRC(), and sqr().

Referenced by UClientFuncImgGui::paintClustEllipse(), UFuncFz::paintClustEllipse(), testEigenvector(), testEigenvector2x2(), UFuncLoca2::updateCovStatus(), and UFuncLocalize::updateCovStatus().

UMatrix4 UMatrix4::inversed ( )
UMatrix4 UMatrix4::operator* ( UMatrix4  B)

Returns a vector that is the produvt of this and the vextor V. result = this * V. Returns a matrix that is the matrix product of this and B. result = this * B.

References UMatrix::cols(), connect(), and UMatrix::rows().

UMatrix4 UMatrix4::operator* ( const double  scale)

Returns a matrix tith all elements are from this matrix multiplied with scale. result = this * scale.

References connect(), and UMatrix::mult().

UPosition UMatrix4::operator* ( UPosition  pos)

Multiply a position with this matrix and obtain a new (rotated translated) position

References UPosition::transferred().

UMatrix4 UMatrix4::operator+ ( UMatrix4  B)

Returns the sum of this and B.

References UMatrix::add(), UMatrix::cols(), connect(), and UMatrix::rows().

UMatrix4 UMatrix4::operator+ ( const double  val)

Returns a this matrix with all elements added the value val. result = this + val

References UMatrix::add(), and connect().

UMatrix4 UMatrix4::operator- ( UMatrix4  B)

Returns the element difference of this and B. result = this - B.

References UMatrix::cols(), connect(), UMatrix::rows(), and UMatrix::sub().

UMatrix4 UMatrix4::operator- ( const double  val)

Returns a this matrix with all elements subtracted the value val. result = this - val

References UMatrix::add(), and connect().

UMatrix4 UMatrix4::operator= ( UMatrix4  V)

Expand current matrix to new size maintaining current content in place. New positions will be zero filled except main diagonal, that will be filled with 'iVal'. The size can also be smaller than original size. Returns a copy of V as this, with pointers corrected. result (this) = V.

References connect().

UMatrix4 UMatrix4::row ( int  r)

Get row as vector

References UMatrix::cols(), and UMatrix::set().

UMatrix4 UMatrix4::transposed ( )

Returns a transposed copy of this.

References UMatrix::cols(), UMatrix::rows(), and UMatrix::transpose().

Referenced by densityQi(), testEigenvector(), testLinearAlgebra(), and testMatrixDensity().

Member Data Documentation

double UMatrix4::d[MAX_VECTOR4_SIZE *MAX_VECTOR4_SIZE]
private

Data area for matrix of max size 4x4


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