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

StochasticSensitivityAnalysis.h

Go to the documentation of this file.
00001 // StochasticSensitivityAnalysis.h: interface for the CStochasticSensitivityAnalysis class.
00002 //
00004 
00005 #if !defined(AFX_STOCHASTICSENSITIVITYANALYSIS_H__6F1FADC6_28C2_4963_AFA8_607527338B17__INCLUDED_)
00006 #define AFX_STOCHASTICSENSITIVITYANALYSIS_H__6F1FADC6_28C2_4963_AFA8_607527338B17__INCLUDED_
00007 
00008 #if _MSC_VER > 1000
00009 #pragma once
00010 #endif // _MSC_VER > 1000
00011 
00012 #ifdef _WIN32
00013 #include <mkl.h>
00014 #include <strstream>
00015 #else
00016 #include "lapack.h"
00017 #include <algorithm>
00018 using namespace std;
00019 #define __min min
00020 #define __max max
00021 #endif
00022 
00023 #include <iostream>
00024 #include <fstream>
00025 #include <vector>
00026 #include <iomanip>
00027 #include <sstream>
00028 #include "SubjectObserver.h"
00029 #include "NLLSMinimizable.h"
00030 #include "Rand.h"
00031 #include "ParameterFilter.h"
00032 #include "EnsembleMember.h"
00033 using namespace std;
00034 
00035 class CStochasticSensitivityAnalysis : public Subject  
00036 {
00037 public:
00038         CStochasticSensitivityAnalysis();
00039         CStochasticSensitivityAnalysis(bool readFlag, bool hessianFlag, int nEnsembleSize, int seed, CParameterFilter *pFilter, double funcAccuracy, double temperature=1.0);
00040         virtual ~CStochasticSensitivityAnalysis();
00041         // computes the Levenberg-Marquardt approximation to the Hessian
00042         void ComputeApproximateHessian(double *pParameters, NLLSMinimizable *pNLLS);
00043         // computes the true Hessian
00044         void ComputeTrueHessian(double *pParameters, NLLSMinimizable *pNLLS);
00045         // reads the Hessian in from a file
00046         void ReadHessian();
00047         void DoAnalysis(double *pFittedParameters, Minimizable *pMinimizable);
00048         double SampleGaussian(double *pParDelta);
00049         double SampleWithoutExplicitHessian(double *pParDelta);
00050         void ConstructTrialMove(double *pParTrial, double *pParCurrent, double *pParDelta);
00051         void AddParametersToEnsemble(double *pParSave, double *resid, double quadratic, double cost);
00052         bool AcceptMove(double quadratic, double deltaCost);
00053         double GetRWValue() const {return m_dRWValue;}
00054         std::vector<CEnsembleMember *> *GetEnsemble() {return &m_vpEnsemble;}
00055         const double **GetEigenvectorMatrix() const {return (const double **)m_pdMatrixV;}
00056         double GetRescale() {return m_dRescale;}
00057         double *GetSingularValues() {return m_pdSingularValues;}
00058 private:
00059         // Set to true to decompose the Hessian 
00060         bool m_bSVDFlag;
00061         // Set to true to use the true Hessian, false for LM Hessian
00062         bool m_bHessianFlag;
00063         // Set to true to read the (previously computed) Hessian in from a file
00064         bool m_bReadFlag;
00065         // Number of residuals in cost function
00066         int m_iNResiduals;
00067         // Number of parameters in cost function
00068         int m_iNParameters;
00069         // Number of samples
00070         int m_iNEnsembleSize;
00071         int m_iRNGSeed;
00072         // Thermodynamic temperature
00073         double m_dTemperature;
00074         // control parameter for stepsize to sample efficiently
00075         double m_dRescale;
00076         // Acceptance Ratio for the duration of the sampling
00077         double m_dAcceptanceRatio;
00078         // This is needed in order to compute the optimal stepsize for finite differencing
00079         double m_dFuncAccuracy;
00080         // Size of parameter fluctuations as estimated by a simple 1D RW
00081         double m_dRWValue;
00082         // Used in the computation of RW estimate
00083         double m_dMNormSquared;
00084         // Vector of singular values of the Hessian
00085         double *m_pdSingularValues;
00086         // Matrix of Eigenvectors (columns are eigenvectors of H)
00087         double **m_pdMatrixV;
00088         // The Hessian
00089         double **m_pdHessian;
00090         // Pseudo-Square root of the Hessian
00091         double **m_pdSamplingMatrix;
00092         // The Jacobian (Square root of the LM Hessian)
00093         double **m_pdJacobian;
00094         CParameterFilter *m_pFilter;
00095         Rand *m_pRNG;
00096         std::vector<CEnsembleMember *> m_vpEnsemble;
00097 };
00098 
00099 #endif // !defined(AFX_STOCHASTICSENSITIVITYANALYSIS_H__6F1FADC6_28C2_4963_AFA8_607527338B17__INCLUDED_)

Generated on Mon Nov 3 09:38:17 2003 by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002