00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef _LSQOBJNUM_H
00016
00017 #include "CrystVector/CrystVector.h"
00018 #include "RefinableObj/RefinableObj.h"
00019 #include <string>
00020
00021 using namespace std;
00022 using namespace ObjCryst;
00028 class LSQNumObj
00029 {
00030 public:
00031 LSQNumObj(CrystVector_double (*pRefinedFunc)(),
00032 string objName="Unnamed LSQ object");
00033 ~LSQNumObj();
00034 void Init(const CrystVector_double&obs,const CrystVector_double&weight);
00035 void Init(const CrystVector_double&obs);
00036
00038 void SetParIsFixed(const string& parName,const bool fix);
00040 void SetParIsFixed(const RefParType *type,const bool fix);
00042 void UnFixAllPar();
00044 void SetParIsUsed(const string& parName,const bool use);
00046 void SetParIsUsed(const RefParType *type,const bool use);
00047
00048 void Refine (int nbCycle=1,bool useLevenbergMarquardt=false);
00049 CrystVector_double Sigma()const;
00050 CrystMatrix_double CorrelMatrix()const;
00051 double Rfactor()const;
00052 double RwFactor()const;
00053 double ChiSquare()const;
00055
00056 void SetUseSaveFileOnEachCycle(bool yesOrNo=true);
00057 void SetSaveFile(string fileName="refine.save");
00058 void PrintRefResults()const;
00059 void SetDampingFactor(const double newDampFact);
00060 void PurgeSaveFile();
00061 void WriteReportToFile()const;
00062
00063 void OptimizeDerivativeSteps();
00064 protected:
00065 private:
00067 void PrepareRefParList()const;
00068
00070
00072
00075
00076
00077
00078 CrystVector_double (*mpRefinedFunc) ();
00080 double mDampingFactor;
00082 bool mSaveReportOnEachCycle;
00084 string mName;
00086 string mSaveFileName;
00087 double mR,mRw,mChiSq;
00089 CrystMatrix_double mCorrelMatrix;
00091 CrystVector_double mObs;
00093 CrystVector_double mWeight;
00096 int mIndexValuesSetInitial, mIndexValuesSetLast;
00098 bool mStopAfterCycle;
00099 };
00100
00101 #endif //_LSQOBJNUM_H