opentl::math::Matrix Class Reference

matrix class for matrix operations. This class is based on opencv matrix class. More...

Inherited by opentl::math::SquareMatrix, opentl::math::Transform, and opentl::math::Vector.

List of all members.

Public Types


Public Member Functions

virtual void add (const double s, const opentl::math::Matrix &b, opentl::math::Matrix &c)
 this * s + B = C
virtual void add (const Matrix &b, Matrix &c)
 this + B = C
virtual double bhattacharyyaDistance (const math::Matrix &b)
 computes the bhattacharyya distance of this matrix and matrix B
virtual double * buffer () const
 returns data buffer
virtual std::size_t cols () const
 returns number of columns
virtual void columnSlice (std::size_t c, Vector &v) const
 get column c of matrix as Vector v copies the data!
virtual void copyFrom (const Matrix &b)
 set matrix from b
virtual void copyTo (Matrix &b) const
 copy this matrix to b
virtual double dotProduct (const Matrix &b) const
 calculated dot product -->
virtual bool equals (const Matrix &m, double tolerance=std::numeric_limits< double >::epsilon()) const
 compares this matrix with matrix M NOTE: compares the first 5 positions after decimal point
virtual void fill (double v)
 set all elements of matrix to the value v
virtual void fillZero ()
 set all elements of matrix to 0. Faster than fillZero()
virtual CvMat * getCvMat () const
 return opencv matrix DON'T USE THIS!! TODO MOVE THIS TO PROTECTED!!
virtual double l2Norm ()
 Matrix (const Matrix &m)
 Matrix (std::size_t rows=1, std::size_t cols=1)
virtual void matrixSlice (std::size_t startRow, std::size_t startCol, std::size_t height, std::size_t width, Matrix &m)
 copy subdata (a --> b) into submatrix m (x x x x x x) (x x a - - x) (x x - - - x) (x x - - b x) (x x x x x x)
virtual void mult (const Vector &b, Vector &c, const Transpose &flag=No_T) const
 this * b = c
virtual void mult (const Matrix &b, Matrix &c, const Transpose &flag=No_T) const
 this * B = C
virtual void mult (double alpha, const Matrix &b, Matrix &c, const Transpose &flag=No_T) const
 alpha * this * B = C
virtual void mult (double alpha, const Matrix &b, double beta, const Matrix &c, Matrix &d, const Transpose &flag=No_T) const
 alpha * this * B + beta * C = D
virtual void mult (double s, Matrix &c) const
 this * s = B
virtual bool operator!= (const Matrix &src) const
virtual double & operator() (std::size_t row, std::size_t col) const
 get random access data of matrix
virtual Matrix operator* (const double f)
virtual Matrix operator* (const Matrix &m)
virtual void operator*= (double &factor)
virtual void operator*= (const Matrix &m)
virtual Matrix operator+ (const Matrix &m)
virtual void operator+= (const Matrix &m)
virtual Matrix operator- (const Matrix &m)
virtual void operator-= (const Matrix &m)
virtual Matrix operator/ (const double f)
virtual Matrixoperator= (const Matrix &src)
 assignment copies the data!
virtual bool operator== (const Matrix &src) const
double * operator[] (std::size_t row) const
 get row data of matrix
virtual void power (double p)
 Raises every matrix element to the power p.
virtual void randomize (double mw, double saw, int mode=0)
virtual void resize (std::size_t rows, std::size_t cols=1)
virtual std::size_t rows () const
 returns number of rows
virtual void rowSlice (std::size_t r, Vector &v) const
 get row r of matrix as Vector v copies the data!
virtual void setColumnSlice (const Vector &v, std::size_t c)
 set column c with vector v copies the data!
virtual void setMatrixSlice (const Matrix &m, std::size_t row, std::size_t col)
 set submatrix with matrix M starting at (row, col) copies the data!
virtual void setRowSlice (const Vector &v, std::size_t r)
 set row r with vector v copies the data!
virtual bool solveLSE (const opentl::math::Matrix &B, opentl::math::Matrix &X, const InversionMethod &method=LU)
 Solve linear or LSE system this * X = B.
virtual void sub (const Matrix &b, Matrix &c) const
 this - B = C
virtual void svd (opentl::math::Vector &W, opentl::math::Matrix &U, opentl::math::Matrix &V) const
 single value decomposition: this = U W V^T
virtual void svd (opentl::math::Matrix &W, opentl::math::Matrix &U, opentl::math::Matrix &V, const SvdMethod &method=None) const
 single value decomposition: this = U W V^T NOTE: U, W, V will be resized automatically
virtual void transpose (Matrix &aT)
 this^T = aT
virtual ~Matrix ()

Protected Member Functions

virtual CvMat * cvMat () const
virtual void releaseData ()

Protected Attributes

CvMat cvmat
double * data

Friends

class CV
class SquareMatrix
class Transform
class Vector


Detailed Description

matrix class for matrix operations. This class is based on opencv matrix class.

Author:
Claus Lenz <lenz@in.tum.de>

Thorsten Roeder <roeder@in.tum.de>


Member Enumeration Documentation

Enumerator:
LU 
SVD 
SVD_SYM 

Enumerator:
None 
U_T 
V_T 
U_T_V_T 

Enumerator:
No_T 
A_T 
B_T 
C_T 
A_T_B_T 
A_T_C_T 
B_T_C_T 
A_T_B_T_C_T 


Constructor & Destructor Documentation

opentl::math::Matrix::Matrix ( std::size_t  rows = 1,
std::size_t  cols = 1 
)

opentl::math::Matrix::Matrix ( const Matrix m  ) 

virtual opentl::math::Matrix::~Matrix (  )  [virtual]


Member Function Documentation

virtual void opentl::math::Matrix::add ( const double  s,
const opentl::math::Matrix b,
opentl::math::Matrix c 
) [virtual]

this * s + B = C

virtual void opentl::math::Matrix::add ( const Matrix b,
Matrix c 
) [virtual]

this + B = C

virtual double opentl::math::Matrix::bhattacharyyaDistance ( const math::Matrix b  )  [virtual]

computes the bhattacharyya distance of this matrix and matrix B

Returns:
distance value

virtual double* opentl::math::Matrix::buffer (  )  const [virtual]

returns data buffer

virtual std::size_t opentl::math::Matrix::cols (  )  const [virtual]

returns number of columns

virtual void opentl::math::Matrix::columnSlice ( std::size_t  c,
Vector v 
) const [virtual]

get column c of matrix as Vector v copies the data!

virtual void opentl::math::Matrix::copyFrom ( const Matrix b  )  [virtual]

set matrix from b

virtual void opentl::math::Matrix::copyTo ( Matrix b  )  const [virtual]

copy this matrix to b

virtual CvMat* opentl::math::Matrix::cvMat (  )  const [protected, virtual]

virtual double opentl::math::Matrix::dotProduct ( const Matrix b  )  const [virtual]

calculated dot product -->

Returns:
= this . B

virtual bool opentl::math::Matrix::equals ( const Matrix m,
double  tolerance = std::numeric_limits< double >::epsilon() 
) const [virtual]

compares this matrix with matrix M NOTE: compares the first 5 positions after decimal point

virtual void opentl::math::Matrix::fill ( double  v  )  [virtual]

set all elements of matrix to the value v

virtual void opentl::math::Matrix::fillZero (  )  [virtual]

set all elements of matrix to 0. Faster than fillZero()

virtual CvMat* opentl::math::Matrix::getCvMat (  )  const [virtual]

return opencv matrix DON'T USE THIS!! TODO MOVE THIS TO PROTECTED!!

virtual double opentl::math::Matrix::l2Norm (  )  [virtual]

virtual void opentl::math::Matrix::matrixSlice ( std::size_t  startRow,
std::size_t  startCol,
std::size_t  height,
std::size_t  width,
Matrix m 
) [virtual]

copy subdata (a --> b) into submatrix m (x x x x x x) (x x a - - x) (x x - - - x) (x x - - b x) (x x x x x x)

virtual void opentl::math::Matrix::mult ( const Vector b,
Vector c,
const Transpose flag = No_T 
) const [virtual]

this * b = c

Parameters:
b Vector
c resulting vector

virtual void opentl::math::Matrix::mult ( const Matrix b,
Matrix c,
const Transpose flag = No_T 
) const [virtual]

this * B = C

virtual void opentl::math::Matrix::mult ( double  alpha,
const Matrix b,
Matrix c,
const Transpose flag = No_T 
) const [virtual]

alpha * this * B = C

virtual void opentl::math::Matrix::mult ( double  alpha,
const Matrix b,
double  beta,
const Matrix c,
Matrix d,
const Transpose flag = No_T 
) const [virtual]

alpha * this * B + beta * C = D

virtual void opentl::math::Matrix::mult ( double  s,
Matrix c 
) const [virtual]

this * s = B

virtual bool opentl::math::Matrix::operator!= ( const Matrix src  )  const [virtual]

virtual double& opentl::math::Matrix::operator() ( std::size_t  row,
std::size_t  col 
) const [virtual]

get random access data of matrix

Parameters:
row row number
col column number
Returns:
value at position (row,col)

virtual Matrix opentl::math::Matrix::operator* ( const double  f  )  [virtual]

virtual Matrix opentl::math::Matrix::operator* ( const Matrix m  )  [virtual]

virtual void opentl::math::Matrix::operator*= ( double &  factor  )  [virtual]

multiplication with a scalar value

Parameters:
factor scalar value

virtual void opentl::math::Matrix::operator*= ( const Matrix m  )  [virtual]

multiplication with a matrix.

Parameters:
m matrix

virtual Matrix opentl::math::Matrix::operator+ ( const Matrix m  )  [virtual]

virtual void opentl::math::Matrix::operator+= ( const Matrix m  )  [virtual]

virtual Matrix opentl::math::Matrix::operator- ( const Matrix m  )  [virtual]

virtual void opentl::math::Matrix::operator-= ( const Matrix m  )  [virtual]

virtual Matrix opentl::math::Matrix::operator/ ( const double  f  )  [virtual]

virtual Matrix& opentl::math::Matrix::operator= ( const Matrix src  )  [virtual]

assignment copies the data!

virtual bool opentl::math::Matrix::operator== ( const Matrix src  )  const [virtual]

double* opentl::math::Matrix::operator[] ( std::size_t  row  )  const

get row data of matrix

Parameters:
row row number
Returns:
row data

virtual void opentl::math::Matrix::power ( double  p  )  [virtual]

Raises every matrix element to the power p.

virtual void opentl::math::Matrix::randomize ( double  mw,
double  saw,
int  mode = 0 
) [virtual]

randomize matrix values with gaussian distribution

Parameters:
mw The first parameter of distribution. In case of uniform distribution it is the inclusive lower boundary of random numbers range. In case of normal distribution it is the mean value of random numbers.
saw The second parameter of distribution. In case of uniform distribution it is the exclusive upper boundary of random numbers range. In case of normal distribution it is the standard deviation of random numbers.
mode 0 = uniform distribution, 1 = Gaussian or Normal distribution

virtual void opentl::math::Matrix::releaseData (  )  [protected, virtual]

virtual void opentl::math::Matrix::resize ( std::size_t  rows,
std::size_t  cols = 1 
) [virtual]

virtual std::size_t opentl::math::Matrix::rows (  )  const [virtual]

returns number of rows

virtual void opentl::math::Matrix::rowSlice ( std::size_t  r,
Vector v 
) const [virtual]

get row r of matrix as Vector v copies the data!

virtual void opentl::math::Matrix::setColumnSlice ( const Vector v,
std::size_t  c 
) [virtual]

set column c with vector v copies the data!

virtual void opentl::math::Matrix::setMatrixSlice ( const Matrix m,
std::size_t  row,
std::size_t  col 
) [virtual]

set submatrix with matrix M starting at (row, col) copies the data!

virtual void opentl::math::Matrix::setRowSlice ( const Vector v,
std::size_t  r 
) [virtual]

set row r with vector v copies the data!

virtual bool opentl::math::Matrix::solveLSE ( const opentl::math::Matrix B,
opentl::math::Matrix X,
const InversionMethod method = LU 
) [virtual]

Solve linear or LSE system this * X = B.

Parameters:
method LU - Gaussian elimination with optimal pivot element chose; SVD - Singular value decomposition (SVD) method; SVD_SYM - SVD method for a symmetric positively-defined matrix
Returns:
was the solving successful?

virtual void opentl::math::Matrix::sub ( const Matrix b,
Matrix c 
) const [virtual]

this - B = C

virtual void opentl::math::Matrix::svd ( opentl::math::Vector W,
opentl::math::Matrix U,
opentl::math::Matrix V 
) const [virtual]

single value decomposition: this = U W V^T

Parameters:
W is a Vector (Nx1)

virtual void opentl::math::Matrix::svd ( opentl::math::Matrix W,
opentl::math::Matrix U,
opentl::math::Matrix V,
const SvdMethod method = None 
) const [virtual]

single value decomposition: this = U W V^T NOTE: U, W, V will be resized automatically

virtual void opentl::math::Matrix::transpose ( Matrix aT  )  [virtual]

this^T = aT


Friends And Related Function Documentation

friend class CV [friend]

friend class SquareMatrix [friend]

friend class Transform [friend]

friend class Vector [friend]


Member Data Documentation

CvMat opentl::math::Matrix::cvmat [protected]

double* opentl::math::Matrix::data [protected]


Generated on Thu Jun 10 21:08:09 2010 for OpenTL by  doxygen 1.5.8