GradFunc.h

Go to the documentation of this file.
00001 #ifndef GRADFUNC_H_
00002 #define GRADFUNC_H_
00003 
00004 #include "VecMat.h"
00005 #include "GeneralObjective.h"
00006 
00007 namespace ublas = boost::numeric::ublas;
00008 
00009 //! Calculate the model gradient vector df(m)/dm 
00010 gplib::rvec CalcGradient(GeneralObjective &Objective, const gplib::rvec &Model);
00011 //! Calculate the model sensitivity matrix 
00012 gplib::rmat CalcPartialDerivs(GeneralObjective &Objective,
00013     const gplib::rvec &Model, const gplib::rvec varfactor);
00014 
00015 //! The class ModelAnalysis is used to calculate resolution matrix, nullspace and other parameters for model analyis
00016 
00017 /*! We assume that the data characteristics as indicated by the CGeneralObjective object do not change, but we want
00018  * the possibility to analyse several different models
00019  */
00020 class ModelAnalysis
00021   {
00022 private:
00023   bool haveModel;
00024   bool haveSVD;
00025   bool changedThreshold;
00026   double SVDThreshold;
00027   GeneralObjective &Objective;
00028   gplib::rvec Model;
00029   gplib::rmat OldSensitivityMatrix;
00030   gplib::rmat SensitivityMatrix;
00031   gplib::rmat SensitivityInv;
00032   gplib::rvec s;
00033   gplib::rmat u, vt;
00034   gplib::rmat vnull, unull;
00035   gplib::rmat sinv;
00036   gplib::rvec varfactor;
00037   void CalcSensitivityMatrix();
00038   void CalcSVD();
00039   void ApplyThreshold();
00040 public:
00041   void SetVariationFactor(const gplib::rvec varfac)
00042     {
00043       varfactor = varfac;
00044     }
00045   void SetModel(const gplib::rvec &TheModel);
00046   void SetRelativeSVDThreshold(const double t)
00047     {
00048       changedThreshold = true;
00049       SVDThreshold = t;
00050     }
00051   const gplib::rmat &GetSensitivityMatrix()
00052     {
00053       CalcSensitivityMatrix();
00054       return SensitivityMatrix;
00055     }
00056   const gplib::rmat &GetSensitivityInverse() const
00057     {
00058       return SensitivityInv;
00059     }
00060   gplib::rmat GetModelCorrelation(const gplib::rmat &DataCovar);
00061   gplib::rmat GetModelResolution();
00062   gplib::rmat GetDataResolution();
00063   gplib::rmat GetModelCovariance(const gplib::rmat &DataCovar);
00064   gplib::rmat GetModelNullspace();
00065   gplib::rvec GetSingularValues();
00066   ModelAnalysis(GeneralObjective &TheObjective) :
00067     haveModel(false), haveSVD(false), changedThreshold(true), Objective(
00068         TheObjective), SVDThreshold(0.0)
00069     {
00070     }
00071   ;
00072   ~ModelAnalysis()
00073     {
00074     }
00075   ;
00076   };
00077 #endif /*GRADFUNC_H_*/

Generated on Tue May 4 16:52:14 2010 for GPLIB++ by  doxygen 1.5.8