Home > class_c_nokia_c_v_matrix.html

Home > Research Areas > Projects > Nokia CV > Documentation > class_c_nokia_c_v_matrix.html

Fixed point matrix representation. A standard matrix is initialized as a zero matrix. Special cases are Eye (Identity matrix) and Ones (all ones). Usage:. More...

#include <ncvMatrix.h>

Inheritance diagram for CNokiaCVMatrix:

Inheritance graph


[legend]

Collaboration diagram for CNokiaCVMatrix:Collaboration graph




[legend]

List of all members.


Public Member Functions

IMPORT_C TInt Cols ()
Getter for the columnsize of the matrix.
IMPORT_C TInt Rows ()
Getter for the rowsize of the matrix.
IMPORT_C CNokiaCVMatrix * Inverse () const
Calculates the inverse matrix of this matrix.
IMPORT_C CNokiaCVMatrix * Transpose () const
Calculates the transpose matrix of this matrix.
IMPORT_C CFixed ** Eigenvalues ()
Calculates the eigenvalues of this matrix.
IMPORT_C CFixed * Singularvalues ()
Calculates the singular values of this matrix using ncvSVD.
IMPORT_C CFixed Det () const
Calculates the determinant of this matrix.
IMPORT_C TBool IsSquare () const
Checks if this matrix is a square matrix.
IMPORT_C TBool IsSingular () const
Checks if this matrix is singular.
IMPORT_C TBool IsSymmetric () const
Checks if this matrix is s symmetric.
IMPORT_C TInt Pivot (TInt aRow, CNokiaCVMatrix *aMatrix)
Partial pivoting method.
IMPORT_C TInt Pivot (int row)
Partial pivoting method.
IMPORT_C CFixed ** Matrix ()
Getter for the matrix table.
Operations
Matrix operations. Every operation throws an KErrArgument error, if the operation is not allowed for the given matrices e.g. when columnsize dose not match.


IMPORT_C CFixed & operator() (const TInt aRow, const TInt aCol)
Getter and setter for the element at the give index.

IMPORT_C CNokiaCVMatrix &
operator= (const CNokiaCVMatrix &aMatrix)

IMPORT_C TBool
operator== (const CNokiaCVMatrix &aMatrix)

IMPORT_C TBool
operator!= (const CNokiaCVMatrix &aMatrix)

IMPORT_C CNokiaCVMatrix *
operator+ (const CNokiaCVMatrix &aMatrix)

IMPORT_C CNokiaCVMatrix &
operator+= (const CNokiaCVMatrix &aMatrix)

IMPORT_C CNokiaCVMatrix *
operator- (const CNokiaCVMatrix &aMatrix)

IMPORT_C CNokiaCVMatrix &
operator-= (const CNokiaCVMatrix &aMatrix)

IMPORT_C CNokiaCVMatrix *
operator * (const CNokiaCVMatrix &aMatrix)

IMPORT_C CNokiaCVMatrix &
operator *= (const CNokiaCVMatrix &aMatrix)

IMPORT_C CNokiaCVMatrix *
operator * (const CFixed aScalar)

IMPORT_C CNokiaCVMatrix &
operator *= (const CFixed aScalar)

IMPORT_C CNokiaCVMatrix *
operator/ (const CNokiaCVMatrix &aMatrix)

IMPORT_C CNokiaCVMatrix &
operator/= (const CNokiaCVMatrix &aMatrix)

IMPORT_C CNokiaCVMatrix *
operator/ (const CFixed aScalar)

IMPORT_C CNokiaCVMatrix &
operator/= (const CFixed aScalar)
Matrix Norms
IMPORT_C CFixed Norm (TNorm aNormType)
Calculates the norm of this matrix of the given type.
IMPORT_C CFixed NormF ()
Calculates the Frobenius norm of this matrix.

IMPORT_C CFixed
NormInf ()
Calculates the infinity norm of this matrix.

IMPORT_C CFixed
Norm ()
Calculates the number one norm of this matrix.
IMPORT_C CFixed Norm2 ()
Calculates the number two norm of this matrix.

Static Public Member Functions

static IMPORT_C CNokiaCVMatrix * NewL (const CFixed **array)
Creates a new matrix according to the given array.
static IMPORT_C CNokiaCVMatrix * NewL (const TInt aRows, const TInt aCols)
Creates a new matrix according to size given with initial value zero.
static IMPORT_C CNokiaCVMatrix * NewL (const CNokiaCVMatrix &aMatrix)
Creates a new matrix according to the given matrix.
static IMPORT_C CNokiaCVMatrix * Zeros (const TInt aRows, const TInt aCols)
Same as NewL.
static IMPORT_C CNokiaCVMatrix * Eye (const TInt aRows, const TInt aCols)
Constructs a new matrix having ones on its diagonal, if aCols == aRows constructs an Identity matrix.
static IMPORT_C CNokiaCVMatrix * Ones (const TInt aRows, const TInt aCols)
Creates a new matrix according to size given with initial value of each element is one.
static IMPORT_C CFixed Pythag (CFixed a, CFixed b)
Helper method calculates hypotenuse between two points.

Protected Member Functions

void ConstructL (const TInt aRows, const TInt aCols)
The actual constructor for NewL(const TInt aRows, const TInt aCols) and the corresponding special cases.
void ConstructL (const CNokiaCVMatrix &aMatrix)
The actual constructor for NewL(const CNokiaCVMatrix &aMatrix) and the corresponding special cases.
void ConstructL (const CFixed **array)
The actual constructor for NewL(const CFixed** array) and the corresponding special cases.

Protected Attributes


TInt
iCols

TInt
iRows

CFixed **
iMatrix


Detailed Description

Fixed point matrix representation. A standard matrix is initialized as a zero matrix. Special cases are Eye (Identity matrix) and Ones (all ones). Usage:.

 CNokiaCVMatrix* m = CNokiaCVMatrix->NewL(5,5);
 CleanupStack::PushL(m);
 (*m)(3,3) = 2;
 (*m)(2,3) = 4.23;
 CNokiaCVMatrix* n = CNokiaCVMatrix->Ones(5,5);
 CleanupStack::PushL(n);
 CNokiaCVMatrix *res = (*m)*(*n)*5;
 CleanupStack::PushL(res);
 CFixed det = res->Det();
 ...
 CleanupStack::Pop(m);
 CleanupStack::Pop(n);
 CleanupStack::Pop(res);
 delete m;
 delete n;
 delete res;

Definition at line 54 of file ncvMatrix.h.


Member Function Documentation

void CNokiaCVMatrix::ConstructL ( const TInt aRows,
const TInt aCols
) [protected]

The actual constructor for NewL(const TInt aRows, const TInt aCols) and the corresponding special cases.

Parameters:
aRows - the number of rows in the matrix
aCols - the number of columns in the matrix
Returns:
A pointer to the created matrix
Note:
the function can leave

void CNokiaCVMatrix::ConstructL ( const CNokiaCVMatrix & aMatrix ) [protected]

The actual constructor for NewL(const CNokiaCVMatrix &aMatrix) and the corresponding special cases.

Parameters:
aRows - the number of rows in the matrix
aCols - the number of columns in the matrix
Returns:
A pointer to the created matrix
Note:
the function can leave

void CNokiaCVMatrix::ConstructL ( const CFixed ** array ) [protected]

The actual constructor for NewL(const CFixed** array) and the corresponding special cases.

Parameters:
aRows - the number of rows in the matrix
aCols - the number of columns in the matrix
Returns:
A pointer to the created matrix
Note:
the function can leave

static IMPORT_C CNokiaCVMatrix* CNokiaCVMatrix::NewL ( const CFixed ** array ) [static]

Creates a new matrix according to the given array.

Parameters:
array - the array from which the matrix is constructed
Returns:
A pointer to the created array
Note:
the function can leave

static IMPORT_C CNokiaCVMatrix* CNokiaCVMatrix::NewL ( const TInt aRows,
const TInt aCols
) [static]

Creates a new matrix according to size given with initial value zero.

Parameters:
aRows - the number of rows in the matrix
aCols - the number of columns in the matrix
Returns:
A pointer to the created matrix
Note:
the function can leave

static IMPORT_C CNokiaCVMatrix* CNokiaCVMatrix::NewL ( const CNokiaCVMatrix & aMatrix ) [static]

Creates a new matrix according to the given matrix.

Parameters:
aMatrix - the matrix from which the matrix is constructed (cloned)
Returns:
A pointer to the created matrix
Note:
the function can leave

static IMPORT_C CNokiaCVMatrix* CNokiaCVMatrix::Zeros ( const TInt aRows,
const TInt aCols
) [static]

Same as NewL.

Returns:
A pointer to the created matrix
Note:
the function can leave

static IMPORT_C CNokiaCVMatrix* CNokiaCVMatrix::Eye ( const TInt aRows,
const TInt aCols
) [static]

Constructs a new matrix having ones on its diagonal, if aCols == aRows constructs an Identity matrix.

Parameters:
aRows - the number of rows in the matrix
aCols - the number of columns in the matrix
Returns:
A pointer to the created matrix
Note:
the function can leave

static IMPORT_C CNokiaCVMatrix* CNokiaCVMatrix::Ones ( const TInt aRows,
const TInt aCols
) [static]

Creates a new matrix according to size given with initial value of each element is one.

Parameters:
aRows - the number of rows in the matrix
aCols - the number of columns in the matrix
Returns:
A pointer to the created matrix
Note:
the function can leave

IMPORT_C TInt CNokiaCVMatrix::Cols ( )

Getter for the columnsize of the matrix.

Returns:
iCols - the number of columns in this matrix

IMPORT_C TInt CNokiaCVMatrix::Rows ( )

Getter for the rowsize of the matrix.

Returns:
iRows - the number of rows in this matrix

IMPORT_C CFixed& CNokiaCVMatrix::operator() ( const TInt aRow,
const TInt aCol
)

Getter and setter for the element at the give index.

Parameters:
aRow - the row number (starting from zero) from where to set/get an element
aCol - the columns number (starting from zero) from where to set/get an element
Returns:
the corresponding element in the matrix

IMPORT_C CFixed CNokiaCVMatrix::Norm ( TNorm aNormType )

Calculates the norm of this matrix of the given type.

Parameters:
aNormType - the type of the norm, see TNorm for more information
Returns:
the value of the norm.
Note:
An exception is thrown in Norm2() if it fails to find the singular values of this matrix

the function can leave

IMPORT_C CFixed CNokiaCVMatrix::NormF ( )

Calculates the Frobenius norm of this matrix.

Note:
the function can leave

IMPORT_C CFixed CNokiaCVMatrix::Norm2 ( )

Calculates the number two norm of this matrix.

Note:
Exception is thrown if SVD fails

the function can leave

Reimplemented in CNokiaCVVector.

IMPORT_C CNokiaCVMatrix* CNokiaCVMatrix::Inverse ( ) const

Calculates the inverse matrix of this matrix.

Note:
KErrArgument is thrown if inversion not allowed
Returns:
the inverse matrix
Note:
the function can leave

IMPORT_C CNokiaCVMatrix* CNokiaCVMatrix::Transpose ( ) const

Calculates the transpose matrix of this matrix.

Returns:
the inverse matrix
Note:
the function can leave

Reimplemented in CNokiaCVVector.

IMPORT_C CFixed** CNokiaCVMatrix::Eigenvalues ( )

Calculates the eigenvalues of this matrix.

Returns:
the eigenvalues in a 2xCols table, where the real part of the eigenvalue is stored in the 0 row and the corresponding imaginary part in the number 1 row
Note:
An exception is thrown, if the eigenvalue decomposition fails e.g. because the given matrix isn't square

the function can leave

IMPORT_C CFixed* CNokiaCVMatrix::Singularvalues ( )

Calculates the singular values of this matrix using ncvSVD.

Returns:
the singular values in a corresponding table
Note:
An excption is thorwn, if the svd fails
See also:
CSVD for more details
Note:
the function can leave

IMPORT_C CFixed CNokiaCVMatrix::Det ( ) const

Calculates the determinant of this matrix.

Returns:
the determinant of this matrix, or zero if it can't be calculated

IMPORT_C TBool CNokiaCVMatrix::IsSquare ( ) const

Checks if this matrix is a square matrix.

Returns:
ETrue if square, false otherwise

IMPORT_C TBool CNokiaCVMatrix::IsSingular ( ) const

Checks if this matrix is singular.

Returns:
ETrue if singular, false otherwise

IMPORT_C TBool CNokiaCVMatrix::IsSymmetric ( ) const

Checks if this matrix is s symmetric.

Returns:
ETrue if symmetric, false otherwise

static IMPORT_C CFixed CNokiaCVMatrix::Pythag ( CFixed a,
CFixed b
) [static]

Helper method calculates hypotenuse between two points.

Returns:
The hypotenuse between two points

IMPORT_C TInt CNokiaCVMatrix::Pivot ( TInt aRow,
CNokiaCVMatrix * aMatrix
)

Partial pivoting method.

Parameters:
aRow - the row to pivot
aMatrix - the matrix to pivot
Returns:
The index of the pivot element

IMPORT_C TInt CNokiaCVMatrix::Pivot ( int row )

Partial pivoting method.

Parameters:
the row to pivot
Returns:
The index of the pivot element

IMPORT_C CFixed** CNokiaCVMatrix::Matrix ( )

Getter for the matrix table.

Returns:
The CFixed** iMatrix variable


The documentation for this class was generated from the following file:
Generated on Tue Jul 10 22:58:43 2007 for NokiaComputerVisionLibrary by doxygen 1.5.2
Terms Of Use | Privacy Policy | Copyright © 2009 Nokia. All rights reserved.