C++ main module for mmsd Package  1.0
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
MMSD_Law Class Referenceabstract

This class is a geneal MMSD Law. More...

#include <MMSD_Law.h>

Inheritance diagram for MMSD_Law:
Inheritance graph
[legend]
Collaboration diagram for MMSD_Law:
Collaboration graph
[legend]

Public Member Functions

const MMSD_DoubleFullMatrixgetPropertiesMatrixMultByCovarianceDecompositionMatrix () const
 get the properties matrix multiplied by covariance matrix decomposition matrix More...
 
const MMSD_DoubleFullMatrixgetCovarianceDecompositionMatrix () const
 get the covariance matrix decomposition matrix More...
 
const MMSD_DoubleVectorgetCovarianceDecompositionDiagonal () const
 get the covariance matrix decomposition diagonal More...
 
const MMSD_DoubleVectorgetMean () const
 get the mean of the law More...
 
void setMinEigenValue (const double &v)
 set the min eigen value available be default 1.e-16 see MMSD_Law::initialize() More...
 
double getMinEigenValue () const
 get the min eigen value available More...
 
virtual tBoolean isOutOfBounds () const
 test if the parameters of law are out of bounds ie if (D[i] < mMinEigenValue[i]) More...
 
virtual void restore (const MMSD_DoubleFullMatrix &properties)
 restore the unstored values after a backup More...
 
virtual void initialize (const int &clusterIndex, const int &samplesNumber, const MMSD_IntegerVector &clustersIndex, const MMSD_DoubleFullMatrix &properties)
 initialization of the parameters opf the law More...
 
virtual void optimizeParameters (const MMSD_DoubleFullMatrix &weights, const MMSD_DoubleVector &probs, const MMSD_DoubleFullMatrix &Y)
 optimizes the parameters of the law More...
 
void sort (MMSD_DoubleVector &nus)
 sorts the law parameters & the array in argument in order to be to the same order than the D diagonal matrix of Y eigen value decomposition More...
 
void setHasBeenLoaded (const tBoolean &v)
 set the if the object has completely been loaded More...
 
tBoolean hasBeenLoaded () const
 return true if the object has completely been loaded More...
 
void getSharedPointer (SP::CORE_Object &p)
 get the shared pointer of this class into p More...
 
void getSharedPointer (SPC::CORE_Object &p) const
 get the shared pointer of this class into p More...
 
tString getClassName () const
 return the class name of the object More...
 
tString getIdentityString () const
 return the identity string of the object of the form className_at_address More...
 
tString getPointerAddress () const
 return the identity string of the object More...
 
template<class T >
tBoolean isInstanceOf () const
 return true if the object is an instance of T More...
 
virtual void print ()
 print the class More...
 
virtual ostream & print (ostream &out) const
 print the class More...
 
virtual void print (const tString &message)
 print the class More...
 
virtual void print (const tInteger &str)
 print More...
 
virtual void print (const tRelativeInteger &str)
 print More...
 
virtual void print (const tReal &str)
 print More...
 
virtual void print (const int &str)
 print More...
 

Static Public Member Functions

static void initSeed (const long int &v)
 init the seed with v value More...
 
static void initSeed ()
 init the seed More...
 
static tString getClassName (const tString &identityString)
 return the class name of the object using only the identity string More...
 
template<class T >
static tString getTypeName ()
 get type name More...
 
static tBoolean is64Architecture ()
 return true if the machine is a 64 bits machine More...
 
static tBoolean is32Architecture ()
 return true if the machine is a 32 bits machine More...
 
static tString pointer2String (const void *obj)
 return the string represantation of a pointer More...
 
static void setOutput (ostream &out)
 set output More...
 
static ostream & getOutput ()
 get output More...
 
static void printObjectsInMemory ()
 print object in memory More...
 
static ostream & print (ostream &out, const tString &message)
 print the class More...
 
static void outputPrint (const tString &message)
 

Static Public Attributes

static tBoolean mIsMemoryTesting =false
 indicator to store all classes created and deleted only for debuging version More...
 

Protected Member Functions

 MMSD_Law (void)
 create an object More...
 
virtual ~MMSD_Law (void)
 destroy an object. More...
 
virtual void updateMean (const MMSD_DoubleFullMatrix &P, const MMSD_DoubleFullMatrix &YP, const MMSD_DoubleFullMatrix &W, const MMSD_DoubleVector &probs, MMSD_DoubleVector &mean)=0
 updates the mean value More...
 
virtual void updateCovarianceDecompositionMatrix (const MMSD_DoubleFullMatrix &Y, const MMSD_DoubleVector &Diag, const MMSD_DoubleVector &mean, const MMSD_DoubleFullMatrix &W, const MMSD_DoubleVector &probs, MMSD_DoubleFullMatrix &P, MMSD_DoubleFullMatrix &YP)=0
 updates the matrix P of eigen value decomposition of covariance of Y More...
 
virtual void updateCovarianceDecompositionDiagonal (const MMSD_DoubleFullMatrix &P, const MMSD_DoubleFullMatrix &YP, const MMSD_DoubleVector &mean, const MMSD_DoubleFullMatrix &W, const MMSD_DoubleVector &probs, MMSD_DoubleVector &D)=0
 updates the diagonal matrix D of eigen value decomposition of covariance of Y More...
 
virtual void saveToUIClass (UI_Class &mclass) const
 how to save the object from a mate model class More...
 
virtual void loadFromUIClass (const UI_Class &mclass)
 how to load the object from a Meta Model class More...
 
virtual tString toString () const
 turn the class into string More...
 
void setThis (SP::CORE_Object p)
 set this weak shared pointer called toDoAfterThis setting method More...
 
virtual void setType (tString type)
 set the type of the object More...
 
virtual void toDoAfterThisSetting ()
 method called after setThis() method this method can oly be called once. More...
 

Detailed Description

This class is a geneal MMSD Law.

A law describes the samples distribution in the cluster;

The initialization of the eigen value decomposition matrices are done by MMSD_Law::initialize() method.

The updating methods of the mean & the eigen value decomposition matrices must be specialized depending on the law and it is performed bu the method MMSD_Law::optimizeParameters() depending on cluster weights, sample probablities to be in cluster array and the properties matrix:

Constructor & Destructor Documentation

MMSD_Law::MMSD_Law ( void  )
protected

create an object

References CORE_Object::setType().

Here is the call graph for this function:

MMSD_Law::~MMSD_Law ( void  )
protectedvirtual

destroy an object.

Member Function Documentation

static tString CORE_Object::getClassName ( const tString identityString)
inlinestaticinherited

return the class name of the object using only the identity string

Referenced by UI_Class::createVector2D(), LAP_DoublePackedUpperMatrix::matrixProduct(), LAP_DoubleBandedUpperMatrix::matrixProduct(), LAP_DoubleFullUpperMatrix::matrixProduct(), and CORE_Object::printObjectsInMemory().

Here is the caller graph for this function:

tString CORE_Object::getClassName ( ) const
inherited

return the class name of the object

Returns
the class name of the object

References tString.

Referenced by CORE_Object::getIdentityString().

Here is the caller graph for this function:

const MMSD_DoubleVector& MMSD_Law::getCovarianceDecompositionDiagonal ( ) const
inline

get the covariance matrix decomposition diagonal

Referenced by testGaussianLaw11N(), testGaussianLaw1PN(), and testGaussianLaw2PN().

Here is the caller graph for this function:

const MMSD_DoubleFullMatrix& MMSD_Law::getCovarianceDecompositionMatrix ( ) const
inline

get the covariance matrix decomposition matrix

Referenced by testGaussianLaw11N(), testGaussianLaw1PN(), and testGaussianLaw2PN().

Here is the caller graph for this function:

tString CORE_Object::getIdentityString ( ) const
inlineinherited

return the identity string of the object of the form className_at_address

Returns
the identity string of the object

References CORE_Object::getClassName(), CORE_Object::pointer2String(), and tString.

Referenced by UI_Class::createPrimitiveMap(), UI_Class::saveAssociation(), UI_Class::saveClass(), UI_ClassFactory::saveIntoClass(), MATH_StiefelFunction::toString(), LAP_2DView::toString(), CORE_Object::toString(), MATH_StiefelOptimizer::toString(), and MM_Class::toString().

Here is the call graph for this function:

Here is the caller graph for this function:

const MMSD_DoubleVector& MMSD_Law::getMean ( ) const
inline

get the mean of the law

Referenced by testGaussianLaw11N(), testGaussianLaw1PN(), and testGaussianLaw2PN().

Here is the caller graph for this function:

double MMSD_Law::getMinEigenValue ( ) const
inline

get the min eigen value available

see MMSD_Law::initialize()

Referenced by MMSD_GaussianLaw::updateCovarianceDecompositionDiagonal().

Here is the caller graph for this function:

static ostream& CORE_Object::getOutput ( )
inlinestaticinherited

get output

tString CORE_Object::getPointerAddress ( ) const
inlineinherited

return the identity string of the object

Returns
the identity string of the object

References CORE_Object::pointer2String().

Here is the call graph for this function:

const MMSD_DoubleFullMatrix& MMSD_Law::getPropertiesMatrixMultByCovarianceDecompositionMatrix ( ) const
inline

get the properties matrix multiplied by covariance matrix decomposition matrix

Referenced by testGaussianLaw11N(), and testGaussianLaw1PN().

Here is the caller graph for this function:

void CORE_Object::getSharedPointer ( SP::CORE_Object &  p)
inlineinherited
void CORE_Object::getSharedPointer ( SPC::CORE_Object &  p) const
inlineinherited

get the shared pointer of this class into p

template<class T >
static tString CORE_Object::getTypeName ( )
inlinestaticinherited

get type name

References tString.

tBoolean UI_Object::hasBeenLoaded ( ) const
inlineinherited

return true if the object has completely been loaded

Referenced by UI_Class::loadAssociation().

Here is the caller graph for this function:

void MMSD_Law::initialize ( const int &  clusterIndex,
const int &  samplesNumber,
const MMSD_IntegerVector clustersIndex,
const MMSD_DoubleFullMatrix properties 
)
virtual

initialization of the parameters opf the law

Parameters
clusterIndex:indexof the cluster of wicth belongs the law
samplesNumbernumber of samples in cluster clusterIndex
clustersIndexcluster index of samples
properties: properties matrix

P is the number of properties & N the number of samples.

  • resizes to P & initializes the mean value
  • resizes to NxP & initializes YP to Y
  • allocates to PxP & computes the covariance matrix of Y
  • computes the eigen components of covariance matrix & stores then in P ( PxP) matrix & D (P) diagonal vector such that COV=tP. D . P
  • verify each element of D is not lower than minEigenValue (see MMSD_Law::setMinEigenValue())
  • reorder P & D such than the eigen values are in decrease order.
  • compute YP=Y.P.

Reimplemented in MMSD_FluryGautschiGaussianLaw, and MMSD_StiefelGaussianLaw.

References MMSD_DoubleFullMatrix::computeCovarianceMatrix(), MMSD_DoubleSymmetricMatrix::computeEigenValueDecomposition(), LAP_DoubleFullGeneralMatrix::getColumnsNumber(), LAP_DoubleFullGeneralMatrix::getRowsNumber(), LAP_DoubleFullGeneralMatrix::matrixProduct(), MMSD_DoubleSymmetricMatrix::PACKED_STORAGE, LAP_Vector< T >::reverse(), LAP_DoubleFullGeneralMatrix::reverseColumns(), LAP_DoubleFullGeneralMatrix::setSize(), MMSD_DoubleSymmetricMatrix::setSize(), LAP_Vector< T >::setSize(), and MMSD_DoubleSymmetricMatrix::setStorage().

Referenced by MMSD_StiefelGaussianLaw::initialize(), and MMSD_FluryGautschiGaussianLaw::initialize().

Here is the call graph for this function:

Here is the caller graph for this function:

void MMSD_Object::initSeed ( const long int &  v)
staticinherited

init the seed with v value

References STAT_Distribution::initSeed().

Here is the call graph for this function:

void MMSD_Object::initSeed ( )
staticinherited

init the seed

References CORE_Time::getTime().

Referenced by MMSD_Object::MMSD_Object(), testGaussianLaw11N(), testGaussianLaw1PN(), and testGaussianLaw2PN().

Here is the call graph for this function:

Here is the caller graph for this function:

static tBoolean CORE_Object::is32Architecture ( )
inlinestaticinherited

return true if the machine is a 32 bits machine

References CORE_Object::is64Architecture().

Here is the call graph for this function:

tBoolean CORE_Object::is64Architecture ( )
staticinherited

return true if the machine is a 64 bits machine

Referenced by CORE_Object::is32Architecture().

Here is the caller graph for this function:

template<class T >
tBoolean CORE_Object::isInstanceOf ( ) const
inlineinherited

return true if the object is an instance of T

References null.

tBoolean MMSD_Law::isOutOfBounds ( ) const
virtual

test if the parameters of law are out of bounds ie if (D[i] < mMinEigenValue[i])

References LAP_Vector< T >::getSize().

Here is the call graph for this function:

void MMSD_Law::loadFromUIClass ( const UI_Class mclass)
protectedvirtual

how to load the object from a Meta Model class

Reimplemented from UI_Object.

References UI_Class::loadField(), UI_Class::loadFullMatrixField(), LAP_DoubleFullGeneralMatrix::setValues(), LAP_Vector< T >::setValues(), and tBoolean.

Here is the call graph for this function:

virtual void MMSD_Law::optimizeParameters ( const MMSD_DoubleFullMatrix weights,
const MMSD_DoubleVector probs,
const MMSD_DoubleFullMatrix Y 
)
inlinevirtual

optimizes the parameters of the law

call successivly:

References updateCovarianceDecompositionDiagonal(), updateCovarianceDecompositionMatrix(), and updateMean().

Here is the call graph for this function:

void CORE_Object::outputPrint ( const tString message)
staticinherited

print on output

References null, and CORE_Object::print().

Referenced by CORE_Exception::CORE_Exception().

Here is the call graph for this function:

Here is the caller graph for this function:

tString CORE_Object::pointer2String ( const void *  obj)
staticinherited

return the string represantation of a pointer

References tString.

Referenced by CORE_Object::CORE_Object(), CORE_Object::getIdentityString(), CORE_Object::getPointerAddress(), and CORE_Object::~CORE_Object().

Here is the caller graph for this function:

virtual void CORE_Object::print ( )
inlinevirtualinherited

print the class

References CORE_Object::toString().

Referenced by CORE_Object::outputPrint(), CORE_Out::print(), CORE_Object::print(), CORE_Out::printInt(), CORE_Out::println(), CORE_Out::printReal(), CORE_Out::printString(), and CORE_Out::setAction().

Here is the call graph for this function:

Here is the caller graph for this function:

virtual ostream& CORE_Object::print ( ostream &  out) const
inlinevirtualinherited

print the class

References CORE_Object::print(), and CORE_Object::toString().

Here is the call graph for this function:

void CORE_Object::print ( const tString message)
virtualinherited

print the class

Reimplemented in CORE_Out.

References null, and CORE_Object::print().

Here is the call graph for this function:

void CORE_Object::print ( const tInteger str)
virtualinherited

print

References null.

void CORE_Object::print ( const tRelativeInteger str)
virtualinherited

print

References null.

void CORE_Object::print ( const tReal str)
virtualinherited

print

References null.

void CORE_Object::print ( const int &  str)
virtualinherited

print

References null.

static ostream& CORE_Object::print ( ostream &  out,
const tString message 
)
inlinestaticinherited

print the class

void CORE_Object::printObjectsInMemory ( )
staticinherited

print object in memory

References CORE_Object::getClassName(), CORE_Object::getSharedPointer(), and CORE_Object::mIsMemoryTesting.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

void MMSD_Law::restore ( const MMSD_DoubleFullMatrix properties)
virtual

restore the unstored values after a backup

Thanks to the properties matrix Y, recompute the matrix P.Y

Reimplemented in MMSD_FluryGautschiGaussianLaw, and MMSD_StiefelGaussianLaw.

References LAP_DoubleFullGeneralMatrix::matrixProduct().

Referenced by MMSD_StiefelGaussianLaw::restore(), and MMSD_FluryGautschiGaussianLaw::restore().

Here is the call graph for this function:

Here is the caller graph for this function:

void MMSD_Law::saveToUIClass ( UI_Class mclass) const
protectedvirtual
void UI_Object::setHasBeenLoaded ( const tBoolean v)
inlineinherited

set the if the object has completely been loaded

Referenced by UI_Class::loadAssociation().

Here is the caller graph for this function:

void MMSD_Law::setMinEigenValue ( const double &  v)
inline

set the min eigen value available be default 1.e-16 see MMSD_Law::initialize()

static void CORE_Object::setOutput ( ostream &  out)
inlinestaticinherited

set output

void CORE_Object::setThis ( SP::CORE_Object  p)
inlineprotectedinherited

set this weak shared pointer called toDoAfterThis setting method

References CORE_Object::toDoAfterThisSetting().

Here is the call graph for this function:

virtual void CORE_Object::setType ( tString  type)
inlineprotectedvirtualinherited

set the type of the object

Referenced by LAP_IntegerVector::LAP_IntegerVector(), MATH_BetaFunction::MATH_BetaFunction(), MATH_C1Function::MATH_C1Function(), MATH_DigammaFunction::MATH_DigammaFunction(), MATH_EigenFunction::MATH_EigenFunction(), MATH_Equation::MATH_Equation(), MATH_Function::MATH_Function(), MATH_GammaFunction::MATH_GammaFunction(), MATH_KeplerFunction::MATH_KeplerFunction(), MATH_LogGammaFunction::MATH_LogGammaFunction(), MATH_NewtonEquation::MATH_NewtonEquation(), MATH_StiefelFunction::MATH_StiefelFunction(), MATH_StiefelOptimizer::MATH_StiefelOptimizer(), MATH_TranscendentEquation::MATH_TranscendentEquation(), MATH_TrigammaFunction::MATH_TrigammaFunction(), MATH_ZeroEquation::MATH_ZeroEquation(), MATH_ZKeplerFunction::MATH_ZKeplerFunction(), MM_Attribute::MM_Attribute(), MM_Class::MM_Class(), MM_ClassFactory::MM_ClassFactory(), MM_Data::MM_Data(), MM_Structure::MM_Structure(), MMSD_ClassFactory::MMSD_ClassFactory(), MMSD_Cluster::MMSD_Cluster(), MMSD_ConstDoubleVector::MMSD_ConstDoubleVector(), MMSD_ConstraintGaussianCluster::MMSD_ConstraintGaussianCluster(), MMSD_ConstraintGaussianModel::MMSD_ConstraintGaussianModel(), MMSD_DataSet::MMSD_DataSet(), MMSD_DataSetClassFactory::MMSD_DataSetClassFactory(), MMSD_DoubleFullMatrix::MMSD_DoubleFullMatrix(), MMSD_DoubleSymmetricMatrix::MMSD_DoubleSymmetricMatrix(), MMSD_DoubleVector::MMSD_DoubleVector(), MMSD_FluryGautschiGaussianLaw::MMSD_FluryGautschiGaussianLaw(), MMSD_GaussianCluster::MMSD_GaussianCluster(), MMSD_GaussianFDFunction::MMSD_GaussianFDFunction(), MMSD_GaussianLaw::MMSD_GaussianLaw(), MMSD_GaussianModel::MMSD_GaussianModel(), MMSD_Law(), MMSD_Model::MMSD_Model(), MMSD_ModelClassFactory::MMSD_ModelClassFactory(), MMSD_Object::MMSD_Object(), MMSD_StiefelFunction::MMSD_StiefelFunction(), MMSD_StiefelGaussianLaw::MMSD_StiefelGaussianLaw(), STAT_BernoulliDistribution::STAT_BernoulliDistribution(), STAT_BinomialDistribution::STAT_BinomialDistribution(), STAT_Combinatorial< T >::STAT_Combinatorial(), STAT_DiracDistribution::STAT_DiracDistribution(), STAT_Distribution::STAT_Distribution(), STAT_ExponentialDistribution::STAT_ExponentialDistribution(), STAT_GammaDistribution::STAT_GammaDistribution(), STAT_GeometricDistribution::STAT_GeometricDistribution(), STAT_InverseNormalDistribution::STAT_InverseNormalDistribution(), STAT_NormalDistribution::STAT_NormalDistribution(), STAT_Object::STAT_Object(), STAT_PoissonDistribution::STAT_PoissonDistribution(), STAT_UniformDistribution::STAT_UniformDistribution(), and STAT_UniformLaplaceTransform::STAT_UniformLaplaceTransform().

Here is the caller graph for this function:

void MMSD_Law::sort ( MMSD_DoubleVector nus)

sorts the law parameters & the array in argument in order to be to the same order than the D diagonal matrix of Y eigen value decomposition

see MMSD_Law::initialization()

References LAP_Vector< T >::getSize(), and tBoolean.

Here is the call graph for this function:

virtual void CORE_Object::toDoAfterThisSetting ( )
inlineprotectedvirtualinherited

method called after setThis() method this method can oly be called once.

Reimplemented in STAT_UniformLaplaceTransform.

Referenced by CORE_Object::setThis(), and STAT_UniformLaplaceTransform::toDoAfterThisSetting().

Here is the caller graph for this function:

virtual tString MMSD_Law::toString ( ) const
inlineprotectedvirtual

turn the class into string

Reimplemented from CORE_Object.

Reimplemented in MMSD_FluryGautschiGaussianLaw, MMSD_GaussianLaw, and MMSD_StiefelGaussianLaw.

References CORE_Object::toString(), and tString.

Referenced by MMSD_GaussianLaw::toString().

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void MMSD_Law::updateCovarianceDecompositionDiagonal ( const MMSD_DoubleFullMatrix P,
const MMSD_DoubleFullMatrix YP,
const MMSD_DoubleVector mean,
const MMSD_DoubleFullMatrix W,
const MMSD_DoubleVector probs,
MMSD_DoubleVector D 
)
protectedpure virtual

updates the diagonal matrix D of eigen value decomposition of covariance of Y

Parameters
P:eigen value matrix decomposition of cov(Y)
YP: matrix vector product Y.P of size NxP
mean: mean vector of size P
W: Weight matrix of size NxP
probs: probability vector of size N
D: output eigen value diagonal matrix decomposition of cov(Y) of size P

Implemented in MMSD_GaussianLaw.

Referenced by optimizeParameters().

Here is the caller graph for this function:

virtual void MMSD_Law::updateCovarianceDecompositionMatrix ( const MMSD_DoubleFullMatrix Y,
const MMSD_DoubleVector Diag,
const MMSD_DoubleVector mean,
const MMSD_DoubleFullMatrix W,
const MMSD_DoubleVector probs,
MMSD_DoubleFullMatrix P,
MMSD_DoubleFullMatrix YP 
)
protectedpure virtual

updates the matrix P of eigen value decomposition of covariance of Y

Parameters
Y: properties matrix of size NxP
Diag: eigen value diagonal matrix decomposition of cov(Y)
mean: mean vector of size P
W: Weight matrix of size NxP
probs: probability vector of size N
P: output eigen value matrix decomposition of cov(Y) of size PxP
YP: output matrix vector product Y.P of size NxP

Implemented in MMSD_FluryGautschiGaussianLaw, and MMSD_StiefelGaussianLaw.

Referenced by optimizeParameters().

Here is the caller graph for this function:

virtual void MMSD_Law::updateMean ( const MMSD_DoubleFullMatrix P,
const MMSD_DoubleFullMatrix YP,
const MMSD_DoubleFullMatrix W,
const MMSD_DoubleVector probs,
MMSD_DoubleVector mean 
)
protectedpure virtual

updates the mean value

Parameters
P: eigen value matrix decomposition of cov(Y)
YP: matrix vector product Y.P of size NxP
W: Weight matrix of size NxP
probs: probability vector of size N
mean: output mean vector of size P

Implemented in MMSD_GaussianLaw.

Referenced by optimizeParameters().

Here is the caller graph for this function:

Member Data Documentation

tBoolean CORE_Object::mIsMemoryTesting =false
staticinherited

indicator to store all classes created and deleted only for debuging version

Referenced by CORE_Object::CORE_Object(), main(), CORE_Object::printObjectsInMemory(), and CORE_Object::~CORE_Object().


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