CGeneralLinInversion.h

Go to the documentation of this file.
00001 /* Base class for all linearized inversion methods. Contains abstract methods and
00002  * variables common to linearized inversion schemes. Also contains code to calculate the matrix of
00003  * partial derivatives, as this is needed in basically any linearized optimization method */
00004  
00005  /* Version 0.1                         Last Modified 7/11/05 */
00006 
00007 #ifndef CGENERALLININVERSION_H_
00008 #define CGENERALLININVERSION_H_
00009 #include <vector>
00010 #include <boost/numeric/ublas/vector.hpp>
00011 #include <boost/numeric/ublas/matrix.hpp> 
00012 #include <boost/numeric/ublas/io.hpp>
00013 #include <exception>
00014 
00015 #include "VecMat.h"
00016 #include "CGeneralObjective.h"
00017 #include "CGeneralLineSearch.h"
00018 
00019 namespace ublas = boost::numeric::ublas;
00020 class ConvergenceException : public std::exception {
00021         virtual const char* what() const throw() {return "Converged !";} 
00022 };
00023 
00024 class CGeneralLinInversion
00025 {
00026 private:
00027     gplib::rvec posmodel;
00028     gplib::rvec negmodel;
00029     gplib::rvec posdata;
00030     gplib::rvec negdata;
00031 protected:
00032         unsigned int nparams;
00033         unsigned int ndata;
00034         gplib::rvec CurrentData;
00035         double epsilon;
00036 public:
00037         CGeneralLinInversion(const unsigned int ndatapoints, const unsigned int nmodel);
00038         virtual ~CGeneralLinInversion();
00039         double CurrentRMS; // holds the RMS value at the end of the current iteration
00040         int Iterationnumber; // The current iteration's number
00041         gplib::rvec InversionResult; //The vector containing the best fitting synthetic data after the current iteration
00042         gplib::rvec CurrentModel;
00043         gplib::rvec InputData;
00044         gplib::rvec Gradient;
00045         gplib::rvec StartModel;
00046         gplib::rvec CurrentMisfit;
00047         gplib::rmat DataCovar;
00048         gplib::rmat ModelCovar;
00049         gplib::rmat PartialDerivs;
00050         CGeneralObjective* MisfitCalculator; //References to the objects to calculate the Misfits
00051         CGeneralLineSearch *LineSearch;
00052         void virtual CalcPartialDerivs();
00053         void virtual CalcGradient();
00054         void virtual Prepare() = 0; // Setup all matrices and vector, has to be called before first call of DoIteration() 
00055         void virtual DoIteration() = 0; //The purely virtual function that calculates the next iteration
00056 };
00057 
00058 #endif /*CGENERALLININVERSION_H_*/

Generated on Tue Aug 4 16:04:05 2009 for GPLIB++ by  doxygen 1.5.8