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

alize::DistribGD Class Reference

#include <DistribGD.h>

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

List of all members.

Public Member Functions

 DistribGD (const DistribGD &d)
 DistribGD (unsigned long vectSize)
 DistribGD (const Config &config)
virtual const Distriboperator= (const Distrib &d)
const DistribGDoperator= (const DistribGD &d)
virtual bool operator== (const Distrib &d) const
virtual ~DistribGD ()
virtual void reset ()
virtual lk_t computeLK (const Feature &) const
virtual lk_t computeLK (const Feature &, unsigned long idx) const
void setCov (real_t value, unsigned long index)
virtual void computeAll ()
real_t getCov (unsigned long index)
real_t getCov (unsigned long index) const
real_t getCovInv (unsigned long index) const
DoubleVectorgetCovVect ()
const DoubleVectorgetCovVect () const
DoubleVectorgetCovInvVect ()
const DoubleVectorgetCovInvVect () const
virtual String getClassName () const
virtual String toString () const
void setCovInv (const K &, real_t value, unsigned long index)
DistribGDduplicate (const K &) const

Static Public Member Functions

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

Private Member Functions

virtual Distribclone () const

Private Attributes

DoubleVector _covVect
DoubleVector _covInvVect

Friends

class TestDistribGD
class TestMixtureGD

Detailed Description

Class for a distribution GD (gaussian with diagonal 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 90 of file DistribGD.h.


Constructor & Destructor Documentation

DistribGD::DistribGD ( const DistribGD d )

Copy constructor

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

Definition at line 114 of file DistribGD.cpp.

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

Referenced by clone(), and create().

DistribGD::DistribGD ( unsigned long  vectSize ) [explicit]

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

Parameters:
vectSizedimension of the distribution

Definition at line 83 of file DistribGD.cpp.

References reset().

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

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

Parameters:
configparameters used to build the distribution

Definition at line 87 of file DistribGD.cpp.

References reset().

DistribGD::~DistribGD (  ) [virtual]

Definition at line 302 of file DistribGD.cpp.


Member Function Documentation

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

Implements alize::Distrib.

Definition at line 154 of file DistribGD.cpp.

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

Referenced by duplicate().

void DistribGD::computeAll (  ) [virtual]

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

Implements alize::Distrib.

Definition at line 192 of file DistribGD.cpp.

References _covInvVect, _covVect, alize::Distrib::_cst, alize::Distrib::_det, alize::Distrib::_vectSize, alize::Object::EPS_LK, alize::RealVector< T >::getArray(), getCovVect(), NULL, alize::Object::PI2, and alize::RealVector< T >::setSize().

Referenced by reset().

lk_t DistribGD::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 163 of file DistribGD.cpp.

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

lk_t DistribGD::computeLK ( const Feature frame,
unsigned long  idx 
) const [virtual]
DistribGD & DistribGD::create ( const K ,
unsigned long  vectSize 
) [static]

Creates a new DistribGD object. Call the constructor and returns the object.

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

Definition at line 104 of file DistribGD.cpp.

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

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

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

Creates a new DistribGD object. Call the constructor and returns the object.

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

Definition at line 111 of file DistribGD.cpp.

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

DistribGD & DistribGD::duplicate ( const K  ) const

Duplicates this DistribGD Object. See copy contructor

Returns:
a reference to the copy

Reimplemented from alize::Distrib.

Definition at line 151 of file DistribGD.cpp.

References clone().

String DistribGD::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 271 of file DistribGD.cpp.

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

real_t DistribGD::getCov ( unsigned long  index )

Gets a value in the covariance vector.

Parameters:
indexposition in the array
Returns:
the value of the covariance
Exceptions:
IndexOutOfBoundsException

Definition at line 236 of file DistribGD.cpp.

References getCovVect().

real_t DistribGD::getCov ( unsigned long  index ) const

Definition at line 239 of file DistribGD.cpp.

References getCovVect().

real_t DistribGD::getCovInv ( unsigned long  index ) const

Gets a value in the inverse covariance vector

Parameters:
indexposition in the array
Returns:
the value of the inverse covariance
Exceptions:
IndexOutOfBoundsException

Definition at line 242 of file DistribGD.cpp.

References _covInvVect.

DoubleVector & DistribGD::getCovInvVect (  )

Returns a reference to the inverse covariance vector

Returns:
a reference to the inverse covariance vector

Definition at line 244 of file DistribGD.cpp.

References _covInvVect.

const DoubleVector & DistribGD::getCovInvVect (  ) const

Definition at line 246 of file DistribGD.cpp.

References _covInvVect.

const DoubleVector & DistribGD::getCovVect (  ) const
DoubleVector & DistribGD::getCovVect (  )

Returns a reference to the covariance vector. If it does not exist it is created and randomly initialized.

Returns:
a reference to the covariance vector

Definition at line 248 of file DistribGD.cpp.

Referenced by computeAll(), getCov(), and setCov().

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

Copy data members of a distribution GD in this distribution

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

Definition at line 130 of file DistribGD.cpp.

References _covInvVect, _covVect, alize::Distrib::_cst, alize::Distrib::_det, alize::Distrib::_meanVect, alize::Distrib::_vectSize, alize::Distrib::getVectSize(), and alize::String::valueOf().

const Distrib & DistribGD::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 DistribGD object.

Implements alize::Distrib.

Definition at line 122 of file DistribGD.cpp.

References NULL.

bool DistribGD::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 DistribGD 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 144 of file DistribGD.cpp.

References _covInvVect, alize::Distrib::_meanVect, and NULL.

void DistribGD::reset (  ) [virtual]

Resets the distribution (as creation)

Implements alize::Distrib.

Definition at line 91 of file DistribGD.cpp.

References _covVect, alize::Distrib::_meanVect, alize::Distrib::_vectSize, computeAll(), and alize::RealVector< T >::setSize().

Referenced by DistribGD().

void DistribGD::setCov ( real_t  value,
unsigned long  index 
)

Sets a value in the covariance vector. A zero value is automatically replaced by a positive-and-non-zero value near to zero.

Parameters:
valuevalue to set
indexposition in the array
Exceptions:
IndexOutOfBoundsException

Definition at line 225 of file DistribGD.cpp.

References getCovVect(), and alize::Object::MIN_COV.

void DistribGD::setCovInv ( const K ,
real_t  value,
unsigned long  index 
)

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

Parameters:
valuevalue to set
indexposition in the array
Exceptions:
IndexOutOfBoundsException

Definition at line 233 of file DistribGD.cpp.

References _covInvVect.

String DistribGD::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 273 of file DistribGD.cpp.

References _covInvVect, _covVect, alize::Distrib::_cst, alize::Distrib::_det, alize::Distrib::_meanVect, alize::Distrib::_vectSize, alize::RealVector< T >::size(), and alize::String::valueOf().


Friends And Related Function Documentation

friend class TestDistribGD [friend]

Reimplemented from alize::Distrib.

Definition at line 92 of file DistribGD.h.

friend class TestMixtureGD [friend]

Reimplemented from alize::Distrib.

Definition at line 93 of file DistribGD.h.


Member Data Documentation

inverse covariance vector

Definition at line 240 of file DistribGD.h.

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

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

Definition at line 237 of file DistribGD.h.

Referenced by computeAll(), getCovVect(), operator=(), reset(), and toString().


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