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
MATH_StiefelOptimizer Class Reference

This class describes Stiefel optimizer method for MATH_StiefelFunction. More...

#include <MATH_StiefelOptimizer.h>

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

Public Member Functions

void setIsVerbose (const tBoolean &v)
 print iteration result on screen More...
 
void setMaxIterationsNumber (const int &n)
 set the max iterations number More...
 
int getMaxIterationsNumber () const
 get the max iterations number More...
 
void setPrecisions (const double &epsX, const double &epsF, const double &epsG)
 set precisions More...
 
void getPrecisions (double &epsX, double &epsF, double &epsG) const
 get precisions More...
 
void setGProjectionType (const tFlag &f)
 set G Projection type More...
 
void setFunction (SP::MATH_StiefelFunction f)
 set the function to optimize More...
 
void resetFunction ()
 reset the function to optimize More...
 
tBoolean hasFunction () const
 return true if the optimized method has function More...
 
const MATH_StiefelFunctiongetFunction () const
 get the function More...
 
MATH_StiefelFunctiongetFunction ()
 get the function More...
 
int getFunctionCallsNumber () const
 get the number of calls of the function More...
 
tBoolean minimize (LAP_DoubleFullGeneralMatrix &X, double &FValue, double &GNorm)
 minimize the function More...
 
virtual tString toString () const
 to string 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 SP::MATH_StiefelOptimizer New ()
 create a stiefel optimizer 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

 MATH_StiefelOptimizer (void)
 create a StiefelOptimizer object More...
 
virtual ~MATH_StiefelOptimizer (void)
 destroy an StiefelOptimizer Object. 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 describes Stiefel optimizer method for MATH_StiefelFunction.

It contains :

Attributes:

Associations:

Author
Stéphane Despréaux
Version
1.0

Constructor & Destructor Documentation

MATH_StiefelOptimizer::MATH_StiefelOptimizer ( void  )
protected

create a StiefelOptimizer object

References CORE_Object::setType().

Referenced by New().

Here is the call graph for this function:

Here is the caller graph for this function:

MATH_StiefelOptimizer::~MATH_StiefelOptimizer ( void  )
protectedvirtual

destroy an StiefelOptimizer 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 MATH_StiefelFunction* MATH_StiefelOptimizer::getFunction ( ) const
inline

get the function

Referenced by minimize().

Here is the caller graph for this function:

MATH_StiefelFunction* MATH_StiefelOptimizer::getFunction ( )
inline

get the function

int MATH_StiefelOptimizer::getFunctionCallsNumber ( ) const
inline

get the number of calls of the 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(), toString(), and MM_Class::toString().

Here is the call graph for this function:

Here is the caller graph for this function:

int MATH_StiefelOptimizer::getMaxIterationsNumber ( ) const
inline

get the max iterations number

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:

void MATH_StiefelOptimizer::getPrecisions ( double &  epsX,
double &  epsF,
double &  epsG 
) const
inline

get precisions

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 MATH_StiefelOptimizer::hasFunction ( ) const
inline

return true if the optimized method has function

References null.

Referenced by minimize().

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 MATH_StiefelOptimizer::minimize ( LAP_DoubleFullGeneralMatrix X,
double &  FValue,
double &  GNorm 
)

minimize the function

Parameters
Xmatrix to minimize of size PxP
FValuevalue of the function at minimization
GNorm: norm of the gradient at minimization

fixed parameters mRho=1.e-4 , mGamma=0.85; mEta=0.2

  • compute the function see MATH_StiefelFunction::computeFunction() at X & its gradient G of size NxP
  • initialize q=1, F_ref=F, tau=1.e-3
  • initialize dtX=G-X.tG . X
  • initialize |dtX|
  • while (iter < iterMax) (see MATH_StiefelOptimizer::setMaxIterationsNumber())
    • X_old=X ; dtX_old=dtX ; F_old=F
    • if (2*P<N) then compute new F & X as follow:
      • step = mRho * |dtX|^2
      • nLoops=0;
      • H=(1/2) [ G . tX - X . tG ]
      • do
        • M = I + tau . H
        • B = X_old - tau . H . X
        • solve X such that M . X = B
        • compute F= MATH_StiefelFunction::computeFunction(X,G)
        • nLoops++
        • tau *= mEta
      • while (F+ tau * step > F_ref ) && (nLoops<5)
    • else compute new F & X as follow:
      • step = mRho * |dtX|^2
      • nLoops=0
      • if (transform) G -= (1/2) X tX G (see MATH_StiefelOptimizer::setGProjectionType())
      • U= [G , X ] V = [ X , -G ] of size Nx2K
      • H = tV.U of size 2Kx2K [ tXG , tXX -tGX, -tGX]
      • B=tVX of size 2K x K [ tXX -tGX]
      • do
        • H = I+ tau H
        • solve V such that H . V = B
        • X:=X_old-tau. U . V
        • compute F= MATH_StiefelFunction::computeFunction(X,G)
      • while (F+tau*step>F-ref) && (nLoops<5)
    • F_ref:=(mGamma*q*F_ref+F)/(mGamma*q+1)
    • q:=mGamma*q+1
    • dtX=G-X.tG . X
    • compute |dtX|
    • S= X_old-X
    • Y= dtX_old-dtX
    • sy= |<S,Y>|
    • if (iter%2==0) tau=|S|^2/sy else tau=sy/|Y|^2
    • tau=max(tau,1.e-20)
    • Xdiff=|X_old-X|/sqtr(N)
    • Fdiff=|F_old-F|/(1+|F_old|)

stop the loop if

  • (Xdiff < epsX) and (Fdiff< epsF) or
  • ( |dtX| < epsG )

orthogonalize X if tX.X!=1 by QR method see LAP_DoubleMatrix::orthogonalize()

tXX=1. tX. X-1.I

References LAP_DoubleMatrix::addDiagonal(), MATH_StiefelFunction::computeFunction(), LAP_DoubleMatrix::copy(), LAP_DoubleFullGeneralMatrix::getColumnsNumber(), getFunction(), LAP_DoubleFullGeneralMatrix::getRowsNumber(), LAP_DoubleMatrix::getStorage(), LAP_DoubleMatrixStorage::getValues(), hasFunction(), LAP_DoubleFullGeneralMatrix::matrixProduct(), LAP_DoubleFullSymmetricMatrix::norm2(), LAP_DoubleFullGeneralMatrix::norm2(), LAP_DoubleFullGeneralMatrix::orthogonalize(), LAP_DoubleVector::product(), LAP_DoubleFullGeneralMatrix::QRP, LAP_DoubleFullSymmetricMatrix::rankSymmetricProduct(), LAP_DoubleFullSymmetricMatrix::setSize(), and tBoolean.

Here is the call graph for this function:

static SP::MATH_StiefelOptimizer MATH_StiefelOptimizer::New ( )
inlinestatic

create a stiefel optimizer

References MATH_StiefelOptimizer().

Referenced by MMSD_StiefelGaussianLaw::MMSD_StiefelGaussianLaw(), testOptimize(), testOptimizerGProject1(), testOptimizerGProject2(), and testOptimizerHInverse().

Here is the call graph for this function:

Here is the caller 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 MATH_StiefelOptimizer::resetFunction ( )
inline

reset the function to optimize

void MATH_StiefelOptimizer::setFunction ( SP::MATH_StiefelFunction  f)
inline

set the function to optimize

void MATH_StiefelOptimizer::setGProjectionType ( const tFlag f)
inline

set G Projection type

1: no projection (by default) 2: G := G - 0.5 * X.tX.G

void MATH_StiefelOptimizer::setIsVerbose ( const tBoolean v)
inline

print iteration result on screen

void MATH_StiefelOptimizer::setMaxIterationsNumber ( const int &  n)
inline

set the max iterations number

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

set output

void MATH_StiefelOptimizer::setPrecisions ( const double &  epsX,
const double &  epsF,
const double &  epsG 
)
inline

set precisions

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_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_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:

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:

tString MATH_StiefelOptimizer::toString ( ) const
virtual

to string

Reimplemented from CORE_Object.

References CORE_Object::getIdentityString(), and tString.

Here is the call 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: