The Fib multimedia system
Fib is a system for storing multimedia data (like images or films).
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
fib::algorithms::nD2::cMatrix2D< tValue > Class Template Reference

#include <cMatrix2D.h>

Collaboration diagram for fib::algorithms::nD2::cMatrix2D< tValue >:

List of all members.

Public Member Functions

 cMatrix2D (unsigned long ulInSizeX, unsigned long ulInSizeY, const tValue &initValue=0)
 cMatrix2D (const cMatrix2D &inMatrix)
tValue & get (unsigned long ulX, unsigned long ulY)
const tValue & get (unsigned long ulX, unsigned long ulY) const
bool set (unsigned long ulX, unsigned long ulY, const tValue &value)
pair< unsigned long, unsigned
long > 
size () const
void resize (unsigned long ulInSizeX, unsigned long ulInSizeY, const tValue &initValue=0)
cMatrix2D< tValue > & operator= (const cMatrix2D &inMatrix)
cMatrix2D< tValue > & operator+= (const cMatrix2D &inMatrix)
cMatrix2D< tValue > & operator-= (const cMatrix2D &inMatrix)
cMatrix2D< tValue > & operator*= (const cMatrix2D &inMatrix)
cMatrix2D< tValue > & operator/= (const cMatrix2D &inMatrix)
cMatrix2D< tValue > & apply (tValue func(const tValue &))
tValue min () const
tValue max () const
tValue sum () const
cMatrix2D< tValue > & derivate (unsigned int direction=1)
cMatrix2D< tValue > & derivateDirection1 ()
cMatrix2D< tValue > & derivateDirection2 ()
unsigned long count (bool condition(const tValue &)) const
unsigned long countNull () const
cMatrix2D< bool > evalueCondition (bool condition(const tValue &)) const
void print (ostream &outStream) const

Static Protected Member Functions

static bool isNullD (const double &value)
static bool isNullLD (const long double &value)
static bool isNull (const tValue &value)

Protected Attributes

valarray< tValue > matrix
unsigned long ulSizeX
unsigned long ulSizeY

Detailed Description

template<class tValue>
class fib::algorithms::nD2::cMatrix2D< tValue >

Definition at line 54 of file cMatrix2D.h.


Constructor & Destructor Documentation

template<class tValue>
fib::algorithms::nD2::cMatrix2D< tValue >::cMatrix2D ( unsigned long  ulInSizeX,
unsigned long  ulInSizeY,
const tValue &  initValue = 0 
)

standardconstructor

Parameters:
ulInSizeXthe size of the matrix in the x (first) direction
ulInSizeYthe size of the matrix in the y (second) direction
initValuethe value, with which to initialisize the matrix
template<class tValue>
fib::algorithms::nD2::cMatrix2D< tValue >::cMatrix2D ( const cMatrix2D< tValue > &  inMatrix)

copyconstructor

Parameters:
inMatrixthe matrix to copy

Member Function Documentation

template<class tValue>
cMatrix2D<tValue>& fib::algorithms::nD2::cMatrix2D< tValue >::apply ( tValue   funcconst tValue &)

This operator applies the values of the given function to the values of this matrix.

Returns:
a reference to this matrix
template<class tValue>
unsigned long fib::algorithms::nD2::cMatrix2D< tValue >::count ( bool   conditionconst tValue &) const
Parameters:
conditionthe condition which should hold for counted values
Returns:
the number of values for which the given condition is true
template<class tValue>
unsigned long fib::algorithms::nD2::cMatrix2D< tValue >::countNull ( ) const
Returns:
the number of values which are 0
template<class tValue>
cMatrix2D<tValue>& fib::algorithms::nD2::cMatrix2D< tValue >::derivate ( unsigned int  direction = 1)

This method evalues the derivate of this matrix in the given direction. For this, from each element the higer neibourelement value in the direction will be subtracted. The last element in the direction is eleminated. The size of the matrix is reduced with 1 in the direction.

Parameters:
directionthe direction in which to evalue the derivate
  • 1: the position in the x (first) direction
  • 2: the position in the y (second) direction
Returns:
a reference to this matrix
template<class tValue>
cMatrix2D<tValue>& fib::algorithms::nD2::cMatrix2D< tValue >::derivateDirection1 ( )

This method evalues the derivate of this matrix in the x (first) direction. For this, from each element the higer neibourelement value in the x direction will be subtracted. The last element in the x direction is eleminated. The size of the matrix is reduced with 1 in the x direction.

Returns:
a reference to this matrix
template<class tValue>
cMatrix2D<tValue>& fib::algorithms::nD2::cMatrix2D< tValue >::derivateDirection2 ( )

This method evalues the derivate of this matrix in the y (second) direction. For this, from each element the higer neibourelement value in the y direction will be subtracted. The last element in the y direction is eleminated. The size of the matrix is reduced with 1 in the y direction.

Returns:
a reference to this matrix
template<class tValue>
cMatrix2D<bool> fib::algorithms::nD2::cMatrix2D< tValue >::evalueCondition ( bool   conditionconst tValue &) const
Parameters:
conditionthe condition which should hold for the values
Returns:
a matrix with the bool values, which are the result of the given condition on the values of this matrix
template<class tValue>
tValue& fib::algorithms::nD2::cMatrix2D< tValue >::get ( unsigned long  ulX,
unsigned long  ulY 
)

This method retuns the a reference to the value on the given position (ulX, ulY) . Beware: It won't be checked, if the position is out of bounds.

Parameters:
ulXthe position in the x (first) direction
ulYthe position in the y (second) direction
Returns:
a reference to the value on the given position (ulX, ulY)
template<class tValue>
const tValue& fib::algorithms::nD2::cMatrix2D< tValue >::get ( unsigned long  ulX,
unsigned long  ulY 
) const

This method retuns the a reference to the value on the given position (ulX, ulY) . Beware: It won't be checked, if the position is out of bounds.

Parameters:
ulXthe position in the x (first) direction
ulYthe position in the y (second) direction
Returns:
a reference to the value on the given position (ulX, ulY)
template<class tValue>
static bool fib::algorithms::nD2::cMatrix2D< tValue >::isNull ( const tValue &  value)
inlinestaticprotected
Parameters:
valuethe value for which to check, if it is 0
Returns:
true if the given value is 0, else false

Definition at line 307 of file cMatrix2D.h.

template<class tValue>
static bool fib::algorithms::nD2::cMatrix2D< tValue >::isNullD ( const double &  value)
inlinestaticprotected
Parameters:
valuethe value for which to check, if it is 0
Returns:
true if the given value is 0, else false

Definition at line 284 of file cMatrix2D.h.

template<class tValue>
static bool fib::algorithms::nD2::cMatrix2D< tValue >::isNullLD ( const long double &  value)
inlinestaticprotected
Parameters:
valuethe value for which to check, if it is 0
Returns:
true if the given value is 0, else false

Definition at line 295 of file cMatrix2D.h.

template<class tValue>
tValue fib::algorithms::nD2::cMatrix2D< tValue >::max ( ) const
Returns:
the maximum value in this matrix
template<class tValue>
tValue fib::algorithms::nD2::cMatrix2D< tValue >::min ( ) const
Returns:
the minimum value in this matrix
template<class tValue>
cMatrix2D<tValue>& fib::algorithms::nD2::cMatrix2D< tValue >::operator*= ( const cMatrix2D< tValue > &  inMatrix)

This operator multiplys the values of the given matrix to the values of this matrix. Position not in both matrixes will be ignored.

Parameters:
inMatrixthe matrix to multiply with
Returns:
a reference to this matrix
template<class tValue>
cMatrix2D<tValue>& fib::algorithms::nD2::cMatrix2D< tValue >::operator+= ( const cMatrix2D< tValue > &  inMatrix)

This operator adds the values of the given matrix to the values of this matrix. Position not in both matrixes will be ignored.

Parameters:
inMatrixthe matrix to add
Returns:
a reference to this matrix
template<class tValue>
cMatrix2D<tValue>& fib::algorithms::nD2::cMatrix2D< tValue >::operator-= ( const cMatrix2D< tValue > &  inMatrix)

This operator subtracts the values of the given matrix from the values of this matrix. Position not in both matrixes will be ignored.

Parameters:
inMatrixthe matrix to subtracts
Returns:
a reference to this matrix
template<class tValue>
cMatrix2D<tValue>& fib::algorithms::nD2::cMatrix2D< tValue >::operator/= ( const cMatrix2D< tValue > &  inMatrix)

This operator divides the values of the given matrix with the values of this matrix. Position not in both matrixes will be ignored.

Parameters:
inMatrixthe matrix to divide with
Returns:
a reference to this matrix
template<class tValue>
cMatrix2D<tValue>& fib::algorithms::nD2::cMatrix2D< tValue >::operator= ( const cMatrix2D< tValue > &  inMatrix)

assignment operator This operator copies the given matrixdata into this matrix.

Parameters:
inMatrixthe matrix to copy
Returns:
a reference to this matrix, with the copied values
template<class tValue>
void fib::algorithms::nD2::cMatrix2D< tValue >::print ( ostream &  outStream) const

This method prints this matrix in an readebel for to the given stream.

Parameters:
outStreamthe stream wher to print this matrix to
template<class tValue>
void fib::algorithms::nD2::cMatrix2D< tValue >::resize ( unsigned long  ulInSizeX,
unsigned long  ulInSizeY,
const tValue &  initValue = 0 
)
Parameters:
ulInSizeXthe new size of the matrix in the x (first) direction
ulInSizeYthe new size of the matrix in the y (second) direction
initValuethe value, with which to initialisize the matrix new values
template<class tValue>
bool fib::algorithms::nD2::cMatrix2D< tValue >::set ( unsigned long  ulX,
unsigned long  ulY,
const tValue &  value 
)

This method sets the the given value on the given position (ulX, ulY) .

Parameters:
ulXthe position in the x (first) direction
ulYthe position in the y (second) direction
valuethe value to set
Returns:
true if the value was set, else false (e.g. if the position is out of bounds)
template<class tValue>
pair< unsigned long, unsigned long > fib::algorithms::nD2::cMatrix2D< tValue >::size ( ) const
Returns:
a pair (x, y) with the size of the matrix in x (first) and y (second) direction
template<class tValue>
tValue fib::algorithms::nD2::cMatrix2D< tValue >::sum ( ) const
Returns:
the sum of all values in this matrix

Member Data Documentation

template<class tValue>
valarray< tValue > fib::algorithms::nD2::cMatrix2D< tValue >::matrix
protected

Matrix with its values. Position (x,y) is element: x + y * ulSizeX

Definition at line 61 of file cMatrix2D.h.

template<class tValue>
unsigned long fib::algorithms::nD2::cMatrix2D< tValue >::ulSizeX
protected

The size of the matrix in the x (first) direction.

Definition at line 66 of file cMatrix2D.h.

template<class tValue>
unsigned long fib::algorithms::nD2::cMatrix2D< tValue >::ulSizeY
protected

The size of the matrix in the y (second) direction.

Definition at line 71 of file cMatrix2D.h.


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