Public Member Functions | Protected Member Functions | Protected Attributes

zeus::TMatrix Class Reference

#include <Matrix.h>

Inheritance diagram for zeus::TMatrix:
zeus::IMatrix

List of all members.

Public Member Functions

 TMatrix (Int iRowsColumns=1)
 TMatrix (Int iRows, Int iColumns)
 TMatrix (const Float **aafData, Int iRows, Int iColumns)
 TMatrix (Float **aafData, Int iRows, Int iColumns, bool bAdoptPointer)
 TMatrix (const TString &rstrValues)
 TMatrix (const TMatrix &rMatrix)
 Protected copy constructor.
 TMatrix (const IMatrix &rMatrix)
 Constructor taking interface type matrix.
virtual ~TMatrix ()
 Virtual destructor.
void assign (Float **aafData, Int iRows, Int iColumns, bool bAdoptPointer)
void assign (const TMatrix &rMatrix)
const Float ** getCells () const
bool reduce (Int iRow, Int iColumn, TMatrix &rMatrix) const
bool pow (Int iExp, TMatrix &rMatrix) const
TString toString () const
virtual void MQUALIFIER assign (const IMatrix &rMatrix)
virtual Float MQUALIFIER calcDeterminant () const
virtual bool MQUALIFIER calcInverse (IMatrix &rInverseMatrix) const
virtual void MQUALIFIER calcTransposed (IMatrix &rTransposedMatrix) const
virtual bool MQUALIFIER equals (const IMatrix &rMatrix, Float fPrecision=FLOAT_PRECISION) const
virtual Float MQUALIFIER getCell (Int iRow, Int iColumn, bool *pbError=NULL) const
virtual bool MQUALIFIER getRow (Int iRow, IVector &rVector) const
virtual bool MQUALIFIER getColumn (Int iColumn, IVector &rVector) const
virtual bool MQUALIFIER getDiagonalVector (IVector &rDiagVector) const
virtual Int MQUALIFIER getRowCount () const
virtual Int MQUALIFIER getColumnCount () const
virtual void MQUALIFIER initAsIdentityMatrix ()
virtual void MQUALIFIER initAsZeroMatrix ()
virtual bool MQUALIFIER invert ()
virtual bool MQUALIFIER isIdentityMatrix () const
virtual bool MQUALIFIER isInvertible () const
virtual bool MQUALIFIER isSquaredMatrix () const
virtual bool MQUALIFIER isZeroMatrix () const
virtual bool MQUALIFIER setCell (Int iRow, Int iColumn, const Float &rValue)
virtual bool MQUALIFIER setRow (Int iRow, const IVector &rVector)
virtual bool MQUALIFIER setColumn (Int iColumn, const IVector &rVector)
virtual void MQUALIFIER setDiagonalValue (const Float &fValue)
virtual void MQUALIFIER setDiagonalVector (const IVector &rDiagVector)
virtual Retval MQUALIFIER setDimensions (Int iRows, Int iColumns)
virtual bool MQUALIFIER swapCells (Int iRow1, Int iColumn1, Int iRow2, Int iColumn2)
virtual void MQUALIFIER transpose ()
virtual Float MQUALIFIER getEntropy () const
virtual void MQUALIFIER addConstant (Float fConstant)
virtual void MQUALIFIER multiplyConstant (Float fConstant)
TMatrix operator+ (const Float &f) const
TMatrix operator- (const Float &f) const
TVector operator* (const IVector &rVector) const
TMatrix operator* (const TMatrix &rMatrix) const
TMatrix operator* (const Float &f) const
TMatrix operator/ (const Float &f) const
const TMatrixoperator+= (const Float &f)
const TMatrixoperator-= (const Float &f)
const TMatrixoperator*= (const Float &f)
const TMatrixoperator/= (const Float &f)
const TMatrixoperator= (const TMatrix &rMatrix)
const TMatrixoperator= (const IMatrix &rMatrix)
bool operator== (const IMatrix &rMatrix) const
bool operator!= (const IMatrix &rMatrix) const
Float * operator[] (Int iIndex)

Protected Member Functions

void createDataArray ()
void createDataArray (const Float **aafData)
void releaseDataArray ()

Protected Attributes

Float ** m_aafData
 Data of the matrix.
Int m_iRows
 Number of rows.
Int m_iColumns
 Number if columns.

Detailed Description

This class implements the generic matrix class containing float values.


Constructor & Destructor Documentation

zeus::TMatrix::TMatrix ( Int  iRowsColumns = 1 )

Creates a matrix of size iRowsColumns x iRowsColumns. The matrix is initialized with zero values

Parameters:
iRowsColumns: number of rows and columns
zeus::TMatrix::TMatrix ( Int  iRows,
Int  iColumns 
)

Creates a matrix of size iRows x iColumns. The matrix is initialized with zero values

Parameters:
iRows: number of rows
iColumns: number of columns
zeus::TMatrix::TMatrix ( const Float **  aafData,
Int  iRows,
Int  iColumns 
)

Creates a matrix of size iRows x iColumns. The matrix is initialized with values given by the double array aafData

Parameters:
aafData: data to assign
iRows: number of rows
iColumns: number of columns
zeus::TMatrix::TMatrix ( Float **  aafData,
Int  iRows,
Int  iColumns,
bool  bAdoptPointer 
)

Creates a matrix of size iRows x iColumns. The matrix is initialized with values given by the double array aafData. The pointer of the double array might be adapted (managed and released by the Matrix object)

Parameters:
aafData: data to assign
iRows: number of rows
iColumns: number of columns
bAdoptPointer: Flag if the pointer should be adapted
zeus::TMatrix::TMatrix ( const TString &  rstrValues )

creates a matrix out of a string representation. The notation is [a11, a12], [a21, a22]

Parameters:
rstrValues: string representing the matrix
zeus::TMatrix::TMatrix ( const TMatrix rMatrix ) [inline]

Protected copy constructor.

zeus::TMatrix::TMatrix ( const IMatrix rMatrix ) [inline]

Constructor taking interface type matrix.

virtual zeus::TMatrix::~TMatrix (  ) [inline, virtual]

Virtual destructor.


Member Function Documentation

void MQUALIFIER zeus::TMatrix::addConstant ( Float  fConstant ) [virtual]
See also:
IMatrix::addConstant

Implements zeus::IMatrix.

void zeus::TMatrix::assign ( Float **  aafData,
Int  iRows,
Int  iColumns,
bool  bAdoptPointer 
)

Assigns two dimensional float array to the matrix.

Parameters:
aafData: Pointer of data to assign
iRows: Number of rows
iColumns: Number of columns
bAdoptPointer: Flag if the pointer should be adapted (=true) or just copied (=false).
void zeus::TMatrix::assign ( const TMatrix rMatrix )

Assigns a matrix

Parameters:
rMatrix: Matrix to assign
void MQUALIFIER zeus::TMatrix::assign ( const IMatrix rMatrix ) [virtual]
See also:
IMatrix::assign

Implements zeus::IMatrix.

Float MQUALIFIER zeus::TMatrix::calcDeterminant (  ) const [virtual]
bool MQUALIFIER zeus::TMatrix::calcInverse ( IMatrix rInverseMatrix ) const [virtual]
See also:
IMatrix::calcInverse

Implements zeus::IMatrix.

void MQUALIFIER zeus::TMatrix::calcTransposed ( IMatrix rTransposedMatrix ) const [virtual]
See also:
IMatrix::calcTransposed

Implements zeus::IMatrix.

void zeus::TMatrix::createDataArray (  ) [protected]

creates the array and initializes the array with zeros

void zeus::TMatrix::createDataArray ( const Float **  aafData ) [protected]

creates the array and initializes the data array with the given values from aafData

Parameters:
aafData: data array
bool MQUALIFIER zeus::TMatrix::equals ( const IMatrix rMatrix,
Float  fPrecision = FLOAT_PRECISION 
) const [virtual]
See also:
IMatrix::equals

Implements zeus::IMatrix.

Float MQUALIFIER zeus::TMatrix::getCell ( Int  iRow,
Int  iColumn,
bool *  pbError = NULL 
) const [virtual]
See also:
IMatrix::getCell

Implements zeus::IMatrix.

const Float ** zeus::TMatrix::getCells (  ) const [inline]

Reading cell values as an array of floats.

Returns:
: const pointer to internal array of cell value floats.
bool MQUALIFIER zeus::TMatrix::getColumn ( Int  iColumn,
IVector rVector 
) const [virtual]
See also:
IMatrix::getColumn

Implements zeus::IMatrix.

Int MQUALIFIER zeus::TMatrix::getColumnCount (  ) const [inline, virtual]
See also:
IMatrix::getColumnCount

Implements zeus::IMatrix.

bool MQUALIFIER zeus::TMatrix::getDiagonalVector ( IVector rDiagVector ) const [virtual]
Float MQUALIFIER zeus::TMatrix::getEntropy (  ) const [virtual]
See also:
IMatrix::getEntropy

Implements zeus::IMatrix.

bool MQUALIFIER zeus::TMatrix::getRow ( Int  iRow,
IVector rVector 
) const [virtual]
See also:
IMatrix::getRow

Implements zeus::IMatrix.

Int MQUALIFIER zeus::TMatrix::getRowCount (  ) const [inline, virtual]
See also:
IMatrix::getRowCount

Implements zeus::IMatrix.

void MQUALIFIER zeus::TMatrix::initAsIdentityMatrix (  ) [virtual]
void MQUALIFIER zeus::TMatrix::initAsZeroMatrix (  ) [virtual]
bool MQUALIFIER zeus::TMatrix::invert (  ) [virtual]
See also:
IMatrix::invert

Implements zeus::IMatrix.

bool MQUALIFIER zeus::TMatrix::isIdentityMatrix (  ) const [virtual]
bool MQUALIFIER zeus::TMatrix::isInvertible (  ) const [virtual]
See also:
IMatrix::isInvertible

Implements zeus::IMatrix.

bool MQUALIFIER zeus::TMatrix::isSquaredMatrix (  ) const [inline, virtual]
bool MQUALIFIER zeus::TMatrix::isZeroMatrix (  ) const [virtual]
See also:
IMatrix::isZeroMatrix

Implements zeus::IMatrix.

void MQUALIFIER zeus::TMatrix::multiplyConstant ( Float  fConstant ) [virtual]
bool zeus::TMatrix::operator!= ( const IMatrix rMatrix ) const [inline]

Equality to another matrix?

Parameters:
rMatrix[IN]: The other matrix.
Returns:
Equality.
TMatrix zeus::TMatrix::operator* ( const TMatrix rMatrix ) const

Matrix multiplication.

Parameters:
rMatrix[IN]: Matrix to be multiplied with this matrix.
Returns:
Resulting matrix.
TMatrix zeus::TMatrix::operator* ( const Float &  f ) const

Scalar multiplication.

Parameters:
f[IN]: Multiplication factor to apply to all cells.
Returns:
Multiplied matrix.
TVector zeus::TMatrix::operator* ( const IVector rVector ) const

Vector multiplication.

Parameters:
rVector[IN]: Vector to be multiplied with this matrix.
Returns:
Resulting vector.
const TMatrix & zeus::TMatrix::operator*= ( const Float &  f ) [inline]

Multiply this matrix by a float value, and assign the result to this matrix.

Parameters:
f[IN]: Float value.
Returns:
const reference to this matrix after the assignment.
TMatrix zeus::TMatrix::operator+ ( const Float &  f ) const

Adds a value to each cell

Parameters:
f[IN]: constant to apply to all cells.
Returns:
Added matrix.
const TMatrix & zeus::TMatrix::operator+= ( const Float &  f ) [inline]

adds a float value to this matrix .

Parameters:
f[IN]: Float value.
Returns:
const reference to this matrix after the assignment.
TMatrix zeus::TMatrix::operator- ( const Float &  f ) const [inline]

Subtracts a value from each cell

Parameters:
f[IN]: constant to apply to all cells.
Returns:
Resulting matrix.
const TMatrix & zeus::TMatrix::operator-= ( const Float &  f ) [inline]

subtracts a float value from this matrix .

Parameters:
f[IN]: Float value.
Returns:
const reference to this matrix after the assignment.
TMatrix zeus::TMatrix::operator/ ( const Float &  f ) const [inline]

Divides each component of the matrix by a float value, and returns the resulting matrix

Parameters:
f[IN]: Float value.
Returns:
Resulting matrix
const TMatrix & zeus::TMatrix::operator/= ( const Float &  f ) [inline]

Divides each component of the matrix by a float value, and assigns the result to this matrix.

Parameters:
f[IN]: Float value.
Returns:
const reference to this matrix after the assignment.
const TMatrix & zeus::TMatrix::operator= ( const IMatrix rMatrix ) [inline]

Assignment of interface type object.

Parameters:
rMatrix[IN]: Matrix to be assigned to this matrix.
Returns:
const reference to this matrix after the assignment.
const TMatrix & zeus::TMatrix::operator= ( const TMatrix rMatrix ) [inline]

Assignment of matrix object.

Parameters:
rMatrix[IN]: Matrix to be assigned to this matrix.
Returns:
const reference to this matrix after the assignment.
bool zeus::TMatrix::operator== ( const IMatrix rMatrix ) const [inline]

Equality to another matrix?

Parameters:
rMatrix[IN]: The other matrix.
Returns:
Equality.
Float * zeus::TMatrix::operator[] ( Int  iIndex ) [inline]

Used to access the data array directly. Be aware that using wrong indecies might cause an access violation.

Parameters:
iIndex: Index of the data
Returns:
Retrns the ith-row of the matrix
bool zeus::TMatrix::pow ( Int  iExp,
TMatrix rMatrix 
) const

This is the power function of the matrix, meaning M^2 = M*M

Parameters:
iExp: exponent
rMatrix: Return value of the calculated matrix
Return values:
true: matrix calculated
false: invalid exponent ( < 0)
bool zeus::TMatrix::reduce ( Int  iRow,
Int  iColumn,
TMatrix rMatrix 
) const

Reduces the matrix by the selected column and row. The returned matrix is therefore by one dimension smaller

Parameters:
iRow: reducing row
iColumn: reducing column
rMatrix: return value
Return values:
true: Could reduce the matrix
false,:Unable to reduce the matrix
void zeus::TMatrix::releaseDataArray (  ) [protected]

Releases the array

bool MQUALIFIER zeus::TMatrix::setCell ( Int  iRow,
Int  iColumn,
const Float &  rValue 
) [virtual]
See also:
IMatrix::setCell

Implements zeus::IMatrix.

bool MQUALIFIER zeus::TMatrix::setColumn ( Int  iColumn,
const IVector rVector 
) [virtual]
See also:
IMatrix::setRow

Implements zeus::IMatrix.

void MQUALIFIER zeus::TMatrix::setDiagonalValue ( const Float &  fValue ) [virtual]
void MQUALIFIER zeus::TMatrix::setDiagonalVector ( const IVector rDiagVector ) [virtual]
Retval MQUALIFIER zeus::TMatrix::setDimensions ( Int  iRows,
Int  iColumns 
) [virtual]
See also:
IMatrix::setDimensions

Implements zeus::IMatrix.

bool MQUALIFIER zeus::TMatrix::setRow ( Int  iRow,
const IVector rVector 
) [virtual]
See also:
IMatrix::setRow

Implements zeus::IMatrix.

bool MQUALIFIER zeus::TMatrix::swapCells ( Int  iRow1,
Int  iColumn1,
Int  iRow2,
Int  iColumn2 
) [virtual]
See also:
IMatrix::swapCells

Implements zeus::IMatrix.

TString zeus::TMatrix::toString (  ) const

Returns a matrix in string notation

Returns:
string notation, like [1,2,3],[1,2,3]
void MQUALIFIER zeus::TMatrix::transpose (  ) [inline, virtual]
See also:
IMatrix::transpose

Implements zeus::IMatrix.


Member Data Documentation

Float** zeus::TMatrix::m_aafData [protected]

Data of the matrix.

Int zeus::TMatrix::m_iColumns [protected]

Number if columns.

Int zeus::TMatrix::m_iRows [protected]

Number of rows.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


Written by Benjamin Hadorn http://www.xatlantis.ch.
Last change made on Sun Jan 22 2012 15:32:27