Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends

alize::DistribGF Class Reference

#include <DistribGF.h>

Inheritance diagram for alize::DistribGF:
Inheritance graph
[legend]
Collaboration diagram for alize::DistribGF:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 DistribGF (const DistribGF &d)
 DistribGF (const unsigned long vectSize)
 DistribGF (const Config &config)
virtual const Distriboperator= (const Distrib &d)
const DistribGFoperator= (const DistribGF &d)
virtual bool operator== (const Distrib &d) const
virtual ~DistribGF ()
virtual void reset ()
virtual lk_t computeLK (const Feature &) const
virtual lk_t computeLK (const Feature &, unsigned long idx) const
void setCov (const real_t value, const unsigned long col, const unsigned long row)
virtual void computeAll ()
real_t getCov (const unsigned long col, const unsigned long row) const
real_t getCovInv (const unsigned long col, const unsigned long row) const
DoubleSquareMatrixgetCovMatrix ()
const DoubleSquareMatrixgetCovMatrix () const
DoubleSquareMatrixgetCovInvMatrix ()
const DoubleSquareMatrixgetCovInvMatrix () const
virtual String getClassName () const
virtual String toString () const
void setCovInv (const K &, real_t value, const unsigned long col, const unsigned long row)
DistribGFduplicate (const K &) const

Static Public Member Functions

static DistribGFcreate (const K &, const unsigned long vectSize)
static DistribGFcreate (const K &, const Config &config)

Private Member Functions

virtual Distribclone () const

Private Attributes

DoubleSquareMatrix _covMatr
DoubleSquareMatrix _covInvMatr
real_t _cst
DoubleVector _tmpVect

Friends

class TestDistribGF
class TestMixtureGF
class TestMixtureGFStat

Detailed Description

Class for a distribution GF (gaussian with full matrix)

Just after creation, all the values are randomly initialized.

To build a valid distribution, you have to set all the covariance and mean values and call computeAll() to compute inverse covariance values, the constante and the determinant.
A temporary array is used to store covariance values. This array is destroyed after calling computeAll(). Before calling computeAll(), the distribution is not valid for some methods.

Author:
Frederic Wils frederic.wils@lia.univ-avignon.fr
Date:
2003

Definition at line 91 of file DistribGF.h.


Constructor & Destructor Documentation

DistribGF::DistribGF ( const DistribGF d )

Copy constructor

Parameters:
dthe distribution GF to copy.
Exceptions:
Exceptioncan be thrown if the dimension of d does not match the dimension of this distribution

Definition at line 123 of file DistribGF.cpp.

References alize::Distrib::_det, and alize::Distrib::_meanVect.

Referenced by clone(), and create().

DistribGF::DistribGF ( const unsigned long  vectSize ) [explicit]

Creates a new DistribGF object. All the values are randomly initialized.

Parameters:
vectSizedimension of the distribution

Definition at line 85 of file DistribGF.cpp.

DistribGF::DistribGF ( const Config config ) [explicit]

Creates a new DistribGF object. All the values are randomly initialized.

Parameters:
configparameters used to build the distribution

Definition at line 89 of file DistribGF.cpp.

DistribGF::~DistribGF (  ) [virtual]

Definition at line 293 of file DistribGF.cpp.


Member Function Documentation

Distrib & DistribGF::clone (  ) const [private, virtual]

Implements alize::Distrib.

Definition at line 168 of file DistribGF.cpp.

References alize::Object::assertMemoryIsAllocated(), and DistribGF().

Referenced by duplicate().

void DistribGF::computeAll (  ) [virtual]

Computes internal data (determinant of the matrix, inverse covariance matrix and a constante used for likelihood computation)

Implements alize::Distrib.

Definition at line 218 of file DistribGF.cpp.

References _covInvMatr, _covMatr, _cst, alize::Distrib::_det, alize::Distrib::_vectSize, alize::Object::EPS_LK, alize::DoubleSquareMatrix::invert(), alize::Object::PI2, and alize::DoubleSquareMatrix::setSize().

lk_t DistribGF::computeLK ( const Feature frame ) const [virtual]

Computes the likelihood between this distribution and a Feature object.

Returns:
the likelihood
Exceptions:
Exceptionif the feature vectSize does not match the distribution vectSize

Implements alize::Distrib.

Definition at line 177 of file DistribGF.cpp.

References _covInvMatr, _cst, alize::Distrib::_meanVect, _tmpVect, alize::Distrib::_vectSize, alize::Object::EPS_LK, alize::DoubleSquareMatrix::getArray(), alize::RealVector< T >::getArray(), alize::Feature::getDataVector(), alize::Feature::getVectSize(), and alize::String::valueOf().

lk_t DistribGF::computeLK ( const Feature frame,
unsigned long  idx 
) const [virtual]

Implements alize::Distrib.

Definition at line 209 of file DistribGF.cpp.

References _covInvMatr, _cst, alize::Distrib::_meanVect, and alize::Object::EPS_LK.

DistribGF & DistribGF::create ( const K ,
const unsigned long  vectSize 
) [static]

Creates a new DistribGF object. Call the constructor and returns the object. internal usage ***

Parameters:
vectSizedimension of the distribution
Returns:
the new DistribGF object

Definition at line 113 of file DistribGF.cpp.

References alize::Object::assertMemoryIsAllocated(), and DistribGF().

Referenced by create(), alize::Distrib::create(), and alize::MixtureGF::MixtureGF().

DistribGF & DistribGF::create ( const K ,
const Config config 
) [static]

Creates a new DistribGF object. Call the constructor and returns the object. internal usage ***

Parameters:
configparameters used to build the distribution
Returns:
the new DistribGF object

Definition at line 120 of file DistribGF.cpp.

References create(), alize::Config::getParam_vectSize(), and alize::K::k.

DistribGF & DistribGF::duplicate ( const K  ) const

Duplicates this DistribGF Object. See copy contructor internal usage ***

Returns:
a reference to the copy

Reimplemented from alize::Distrib.

Definition at line 165 of file DistribGF.cpp.

References clone().

String DistribGF::getClassName (  ) const [virtual]

Returns the name of the class

Returns:
the name of the class of the object as a String

Implements alize::Distrib.

Definition at line 265 of file DistribGF.cpp.

Referenced by alize::MixtureGF::toString().

real_t DistribGF::getCov ( const unsigned long  col,
const unsigned long  row 
) const

Gets a value in the covariance matrix. WARNING : contrary to class Matrix, colum index is FIRST argument and row index is SECOND argument
This will probably change in next release of Alize

Parameters:
colcolumn index
rowrow index
Returns:
the value of the covariance
Exceptions:
IndexOutOfBoundsException

Definition at line 247 of file DistribGF.cpp.

References _covMatr, alize::Distrib::_vectSize, and alize::DoubleSquareMatrix::setSize().

real_t DistribGF::getCovInv ( const unsigned long  col,
const unsigned long  row 
) const

Gets a value in the inverse covariance matrix WARNING : contrary to class Matrix, colum index is FIRST argument and row index is SECOND argument
This will probably change in next release of Alize

Parameters:
colcolumn index
rowrow index
Returns:
the value of the inverse covariance
Exceptions:
IndexOutOfBoundsException

Definition at line 253 of file DistribGF.cpp.

References _covInvMatr.

DoubleSquareMatrix & DistribGF::getCovInvMatrix (  )

Returns a reference to the inverse covariance matrix

Returns:
a reference to the inverse covariance matrix

Definition at line 257 of file DistribGF.cpp.

References _covInvMatr.

const DoubleSquareMatrix & DistribGF::getCovInvMatrix (  ) const

Definition at line 259 of file DistribGF.cpp.

References _covInvMatr.

DoubleSquareMatrix & DistribGF::getCovMatrix (  )

Returns a reference to the covariance matrix.

Returns:
a reference to the covariance matrix

Definition at line 261 of file DistribGF.cpp.

References _covMatr.

const DoubleSquareMatrix & DistribGF::getCovMatrix (  ) const

Definition at line 263 of file DistribGF.cpp.

References _covMatr.

const Distrib & DistribGF::operator= ( const Distrib d ) [virtual]

Copy data members of a distribution in this distribution.

Parameters:
dthe distribution source
Returns:
this distribution as a generic distribution
Exceptions:
Exceptionif the dimension of d does not match the dimension of this distribution or if d is not a DistribGF object.

Implements alize::Distrib.

Definition at line 131 of file DistribGF.cpp.

References NULL.

const DistribGF & DistribGF::operator= ( const DistribGF d )

Copy data members of a distribution GF in this distribution

Parameters:
dthe distribution GF source
Returns:
this distribution
Exceptions:
Exceptioncan be thrown if the dimension of d does not match the dimension of this distribution

Definition at line 139 of file DistribGF.cpp.

References _covInvMatr, _covMatr, _cst, alize::Distrib::_det, alize::Distrib::_meanVect, alize::Distrib::_vectSize, and alize::String::valueOf().

bool DistribGF::operator== ( const Distrib d ) const [virtual]

Compares the distribution d to this one.

Parameters:
dthe generic distribution to compare to this one.
Returns:
false if :
> d is not a DistribGF object or
> dimension of d does not match dimension of this distribution or
> one of the inverse covariance values in d does not match the corresponding value in this distribution or
> one of the mean values in d does not match the corresponding value in this distribution
Otherwise return true.

Implements alize::Distrib.

Definition at line 153 of file DistribGF.cpp.

References _covInvMatr, _covMatr, alize::Distrib::_meanVect, NULL, and alize::DoubleSquareMatrix::size().

void DistribGF::reset (  ) [virtual]

Resets the distribution (as creation)

Implements alize::Distrib.

Definition at line 93 of file DistribGF.cpp.

void DistribGF::setCov ( const real_t  value,
const unsigned long  col,
const unsigned long  row 
)

Sets a value in the covariance matrix. WARNING : contrary to class Matrix, colum index is FIRST argument and row index is SECOND argument
This will probably change in next release of Alize A zero value is automatically replaced by a positive-and-non-zero value near to zero.

Parameters:
valuevalue to set
colcolumn index
rowrow index
Exceptions:
IndexOutOfBoundsException

Definition at line 235 of file DistribGF.cpp.

References _covMatr, alize::Distrib::_vectSize, alize::Object::MIN_COV, and alize::DoubleSquareMatrix::setSize().

void DistribGF::setCovInv ( const K ,
real_t  value,
const unsigned long  col,
const unsigned long  row 
)

Sets a value in the inverse covariance matrix. internal usage ***

Parameters:
valuevalue to set
colcolumn index
rowrow index
Exceptions:
IndexOutOfBoundsException

Definition at line 243 of file DistribGF.cpp.

References _covInvMatr.

String DistribGF::toString (  ) const [virtual]

This method is frequently overridden in the derived classes. If it is not, it returns the name of the class of the object and the address of the object

Returns:
a description of the object

Implements alize::Distrib.

Definition at line 267 of file DistribGF.cpp.

References _covInvMatr, _covMatr, _cst, alize::Distrib::_det, alize::Distrib::_meanVect, alize::Distrib::_vectSize, alize::DoubleSquareMatrix::size(), and alize::String::valueOf().


Friends And Related Function Documentation

friend class TestDistribGF [friend]

Reimplemented from alize::Distrib.

Definition at line 93 of file DistribGF.h.

friend class TestMixtureGF [friend]

Reimplemented from alize::Distrib.

Definition at line 94 of file DistribGF.h.

friend class TestMixtureGFStat [friend]

Definition at line 95 of file DistribGF.h.


Member Data Documentation

inverse covariance matrix

Definition at line 257 of file DistribGF.h.

Referenced by computeAll(), computeLK(), getCovInv(), getCovInvMatrix(), operator=(), operator==(), setCovInv(), and toString().

temporary covariance matrix. The matrix is cleared after calling computeAll()

Definition at line 254 of file DistribGF.h.

Referenced by computeAll(), getCov(), getCovMatrix(), operator=(), operator==(), setCov(), and toString().

constante

Reimplemented from alize::Distrib.

Definition at line 258 of file DistribGF.h.

Referenced by computeAll(), computeLK(), operator=(), and toString().

Definition at line 259 of file DistribGF.h.

Referenced by computeLK().


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