Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   Related Pages  

LSQNumObj.h

00001 /*
00002 * LibCryst++ : a Crystallographic computing library in C++
00003 *
00004 *  (c) 2000 Vincent FAVRE-NICOLIN
00005 *           Laboratoire de Cristallographie
00006 *           24, quai Ernest-Ansermet, CH-1211 Geneva 4, Switzerland
00007 *  Contact: Vincent.Favre-Nicolin@cryst.unige.ch
00008 *           Radovan.Cerny@cryst.unige.ch
00009 *
00010 */
00011 /*   LSQNumObj.h
00012 *  header file for Least-Squares refinement witn Numerical derivatives Objects
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);//using unit weight
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;   //uses the weight if specified
00055       void AddRefinableObj(RefinableObj &obj);
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       // Refined objects
00070          ObjRegistry<RefinableObj> mRefinedObjList;
00072          ObjRegistry<RefinableObj> mRecursiveRefinedObjList;
00075       mutable RefinableObj mRefParList;
00076       //The minimised function
00077       // Obs and Calc values are stored into Obs and Calc arrays
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

Generated on Wed Nov 14 19:48:35 2001 for ObjCryst++ by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001