ObjCryst::LSQNumObj Class Reference

(Quick & dirty) Least-Squares Refinement Object with Numerical derivatives More...

Collaboration diagram for ObjCryst::LSQNumObj:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 LSQNumObj (std::string objName="Unnamed LSQ object")
void SetParIsFixed (const std::string &parName, const bool fix)
 Fix one parameter.
void SetParIsFixed (const RefParType *type, const bool fix)
 Fix one family of parameters.
void UnFixAllPar ()
 UnFix All parameters.
void SetParIsUsed (const std::string &parName, const bool use)
 Set a parameter to be used.
void SetParIsUsed (const RefParType *type, const bool use)
 Set a family of parameters to be used.
void Refine (int nbCycle=1, bool useLevenbergMarquardt=false, const bool silent=false)
CrystVector_REAL Sigma () const
CrystMatrix_REAL CorrelMatrix () const
REAL Rfactor () const
REAL RwFactor () const
REAL ChiSquare () const
void SetRefinedObj (RefinableObj &obj, const unsigned int LSQFuncIndex=0)
 Choose the object to refine.
ObjRegistry< RefinableObj > & GetRefinedObjList ()
 Access to the full list of refined objects.
RefinableObjGetCompiledRefinedObj ()
 Access to the RefinableObj which is the compilation of all parameters from the object supplied for optimization and its sub-objects.
const RefinableObjGetCompiledRefinedObj () const
 Access to the RefinableObj which is the compilation of all parameters from the object supplied for optimization and its sub-objects.
void SetUseSaveFileOnEachCycle (bool yesOrNo=true)
void SetSaveFile (std::string fileName="refine.save")
void PrintRefResults () const
void SetDampingFactor (const REAL newDampFact)
void PurgeSaveFile ()
void WriteReportToFile () const
void OptimizeDerivativeSteps ()
const std::map< pair< const
RefinablePar *, const
RefinablePar * >, REAL > & 
GetVarianceCovarianceMap () const
void PrepareRefParList (const bool copy_param=false)
 Prepare the full parameter list for the refinement.

Private Attributes

ObjRegistry< RefinableObjmRecursiveRefinedObjList
 The recursive list of all refined sub-objects.
RefinableObj mRefParList
 The refinable par list used during refinement.
REAL mDampingFactor
 Damping factor for the refinement (unused yet...).
bool mSaveReportOnEachCycle
 Save result to file after each cycle ?
std::string mName
 Name of the refined object.
std::string mSaveFileName
 File name where refinement info is saved.
REAL mR
REAL mRw
REAL mChiSq
CrystMatrix_REAL mCorrelMatrix
 Correlation matrix between all refined parameters.
std::map< pair< const
RefinablePar *, const
RefinablePar * >, REAL > 
mvVarCovar
 Variance-Covariance matrix, as a std::map.
CrystVector_REAL mObs
 Observed values.
CrystVector_REAL mWeight
 Weight corresponding to all observed values.
int mIndexValuesSetInitial
 Index of the set of saved values for all refinable parameters, before refinement and before the last cycle.
int mIndexValuesSetLast
bool mStopAfterCycle
 If true, then stop at the end of the cycle. Used in multi-threading environment.
RefinableObjmpRefinedObj
 The optimized object.
unsigned int mLSQFuncIndex
 The index of the LSQ function in the refined object (if there are several...).
bool mCopyRefPar
 If true, then parameters to be refined will be copied instead of referenced.


Detailed Description

(Quick & dirty) Least-Squares Refinement Object with Numerical derivatives

This is still highly experimental !

Definition at line 37 of file LSQNumObj.h.


Member Function Documentation

void ObjCryst::LSQNumObj::SetParIsFixed ( const std::string &  parName,
const bool  fix 
)

Fix one parameter.

LSQNumObj::PrepareRefParList() must be called first!

void ObjCryst::LSQNumObj::SetParIsFixed ( const RefParType type,
const bool  fix 
)

Fix one family of parameters.

LSQNumObj::PrepareRefParList() must be called first!

Definition at line 64 of file LSQNumObj.cpp.

void ObjCryst::LSQNumObj::UnFixAllPar (  ) 

UnFix All parameters.

LSQNumObj::PrepareRefParList() must be called first!

Definition at line 70 of file LSQNumObj.cpp.

void ObjCryst::LSQNumObj::SetParIsUsed ( const std::string &  parName,
const bool  use 
)

Set a parameter to be used.

LSQNumObj::PrepareRefParList() must be called first!

void ObjCryst::LSQNumObj::SetParIsUsed ( const RefParType type,
const bool  use 
)

Set a family of parameters to be used.

LSQNumObj::PrepareRefParList() must be called first!

Definition at line 81 of file LSQNumObj.cpp.

void ObjCryst::LSQNumObj::Refine ( int  nbCycle = 1,
bool  useLevenbergMarquardt = false,
const bool  silent = false 
)

Applying new computed values :TODO: & Check if a limit has been hit

Definition at line 87 of file LSQNumObj.cpp.

void ObjCryst::LSQNumObj::SetRefinedObj ( RefinableObj obj,
const unsigned int  LSQFuncIndex = 0 
)

Choose the object to refine.

The minimization will be done against its LSQ function, and its parameters.

Parameters:
LSQFuncIndex,: one object can have a choice of several LSQ functions to minimize- this allows to choose which one to minimize.

Definition at line 598 of file LSQNumObj.cpp.

ObjRegistry< RefinableObj > & ObjCryst::LSQNumObj::GetRefinedObjList (  ) 

Access to the full list of refined objects.

The list is initially built recursively from one object. This function allows to modify the list of sub-objects before refinement (such as fore removing certain types of objects).

Definition at line 606 of file LSQNumObj.cpp.

RefinableObj & ObjCryst::LSQNumObj::GetCompiledRefinedObj (  ) 

Access to the RefinableObj which is the compilation of all parameters from the object supplied for optimization and its sub-objects.

Since this compilation is only updated from the suplied refinableobj and its sub-objects when SetRefinedObj() and PrepareRefParList() are called, it is possible to alter the fixed/limited status of parameters here without affecting the parameters in the refined objects.

Definition at line 608 of file LSQNumObj.cpp.

const RefinableObj & ObjCryst::LSQNumObj::GetCompiledRefinedObj (  )  const

Access to the RefinableObj which is the compilation of all parameters from the object supplied for optimization and its sub-objects.

Since this compilation is only updated from the suplied refinableobj and its sub-objects when SetRefinedObj() and PrepareRefParList() are called, it is possible to alter the fixed/limited status of parameters here without affecting the parameters in the refined objects.

Definition at line 610 of file LSQNumObj.cpp.

void ObjCryst::LSQNumObj::PrepareRefParList ( const bool  copy_param = false  ) 

Prepare the full parameter list for the refinement.

Parameters:
copy_param,: if false (the default), then the lsq algorithm will work directly on the parameters of the refined object and sub-object. So that any modification to the fixed/used/limited status applies permanently to the parameters. if true, then the parameters are copied and therefore only the value of the parameter is changed (and the clocks are ticked).
Note:
: if copy_param==true, then any modification to the parameters (fixed, limited, used status) only affects the copy and not the original. Also, calling again PrepareRefParList cancels any such modification.

This will be called automatically before starting the refinement only if the parameter list is empty. Otherwise it should be called before refinement.

Definition at line 672 of file LSQNumObj.cpp.


Member Data Documentation

The refinable par list used during refinement.

It is only a compilation of the parameters in RefinableObj and its sub-objects

This list is only updated from the suplied refinableobj and its sub-objects when SetRefinedObj() and PrepareRefParList() are called, so it is possible to alter the fixed/limited status of parameters here without affecting the parameters in the refined objects.

Definition at line 137 of file LSQNumObj.h.

Index of the set of saved values for all refinable parameters, before refinement and before the last cycle.

Definition at line 157 of file LSQNumObj.h.

If true, then parameters to be refined will be copied instead of referenced.

Therefore only their values and the parameter's clocks are affected when working on the copy.

Definition at line 167 of file LSQNumObj.h.


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

Generated on Sun Sep 28 23:46:45 2008 for FOX/ObjCryst++ by  doxygen 1.5.6