26 #include "ObjCryst/CrystVector/CrystVector.h"
27 #include "ObjCryst/RefinableObj/RefinableObj.h"
40 LSQNumObj(std::string objName=
"Unnamed LSQ object");
45 void SetParIsFixed(
const std::string& parName,
const bool fix);
74 void SetParIsUsed(
const std::string& parName,
const bool use);
95 void Refine (
int nbCycle=1,
bool useLevenbergMarquardt=
false,
96 const bool silent=
false,
const bool callBeginEndOptimization=
true,
97 const float minChi2var=0.01);
98 CrystVector_REAL Sigma()
const;
99 CrystMatrix_REAL CorrelMatrix()
const;
101 REAL RwFactor()
const;
102 REAL ChiSquare()
const;
115 void SetRefinedObj(
RefinableObj &obj,
const unsigned int LSQFuncIndex=0,
const bool init=
true,
const bool recursive=
false);
149 void SetUseSaveFileOnEachCycle(
bool yesOrNo=
true);
150 void SetSaveFile(std::string fileName=
"refine.save");
151 void PrintRefResults()
const;
152 void SetDampingFactor(
const REAL newDampFact);
153 void PurgeSaveFile();
154 void WriteReportToFile()
const;
156 void OptimizeDerivativeSteps();
157 const std::map<pair<const RefinablePar*,const RefinablePar*>,REAL > &GetVarianceCovarianceMap()
const;
177 const CrystVector_REAL&
GetLSQObs()
const;
182 const std::map<RefinablePar*,CrystVector_REAL>& GetLSQ_FullDeriv();
185 void BeginOptimization(
const bool allowApproximations=
false,
const bool enableRestraints=
false);
215 std::map<pair<const RefinablePar*,const RefinablePar*>,REAL >
mvVarCovar;
245 mutable CrystVector_REAL
mLSQObs,mLSQCalc,mLSQWeight,mLSQDeriv;
246 mutable std::map<RefinablePar*,CrystVector_REAL> mLSQ_FullDeriv;
252 void WXNotifyDelete();
259 #endif //_LSQOBJNUM_H
RefinableObj & GetCompiledRefinedObj()
Access to the RefinableObj which is the compilation of all parameters from the object supplied for op...
REAL mDampingFactor
Damping factor for the refinement (unused yet...)
const CrystVector_REAL & GetLSQWeight() const
Get the LSQ weight vector (using either only the top or the hierarchy of object)
void PrepareRefParList(const bool copy_param=false)
Prepare the full parameter list for the refinement.
bool mSaveReportOnEachCycle
Save result to file after each cycle ?
void SetRefinedObj(RefinableObj &obj, const unsigned int LSQFuncIndex=0, const bool init=true, const bool recursive=false)
Choose the object to refine.
CrystVector_REAL mLSQObs
Temporary arrays for LSQ functions evaluation - used when using recursive LSQ function.
std::map< pair< const RefinablePar *, const RefinablePar * >, REAL > mvVarCovar
Variance-Covariance matrix, as a std::map.
const CrystVector_REAL & GetLSQCalc() const
Get the LSQ calc vector (using either only the top or the hierarchy of object)
RefinableObj mRefParList
The refinable par list used during refinement.
Generic Refinable Object.
const std::map< RefinableObj *, unsigned int > & GetRefinedObjMap() const
Get the map of refined objects - this is a recursive list of all the objects that are taken into acco...
CrystVector_REAL mWeight
Weight corresponding to all observed values.
CrystVector_REAL mObs
Observed values.
void SetParIsFixed(const std::string &parName, const bool fix)
Fix one parameter.
Abstract base class for all objects in wxCryst.
std::map< RefinableObj *, unsigned int > mvRefinedObjMap
Map of the recursive list of the objects to be refined.
const CrystVector_REAL & GetLSQObs() const
Get the LSQ obs vector (using either only the top or the hierarchy of object)
std::map< RefinableObj *, unsigned int > mvRefinedObjLSQSize
Size of each object LSQ data. This is initialized in LSQNumObj::GetLSQObs()
std::string mSaveFileName
File name where refinement info is saved.
ObjRegistry< RefinableObj > mRecursiveRefinedObjList
The recursive list of all refined sub-objects.
bool mStopAfterCycle
If true, then stop at the end of the cycle. Used in multi-threading environment.
bool mCopyRefPar
If true, then parameters to be refined will be copied instead of referenced.
void BeginOptimization(const bool allowApproximations=false, const bool enableRestraints=false)
Tell all refined object that the refinement is beginning.
CrystMatrix_REAL mCorrelMatrix
Correlation matrix between all refined parameters.
const CrystVector_REAL & GetLSQDeriv(RefinablePar &par)
Get the LSQ deriv vector (using either only the top or the hierarchy of object)
void EndOptimization()
Tell all refined object that the refinement is finished.
std::string mName
Name of the refined object.
int mIndexValuesSetInitial
Index of the set of saved values for all refinable parameters, before refinement and before the last ...
The namespace which includes all objects (crystallographic and algorithmic) in ObjCryst++.
Generic class for parameters of refinable objects.
void SetParIsUsed(const std::string &parName, const bool use)
Set a parameter to be used.
void UnFixAllPar()
UnFix All parameters.
(Quick & dirty) Least-Squares Refinement Object with Numerical derivatives
class of refinable parameter types.
void Refine(int nbCycle=1, bool useLevenbergMarquardt=false, const bool silent=false, const bool callBeginEndOptimization=true, const float minChi2var=0.01)
Do the refinement.