Main Page | Namespace List | Class List | File List | Namespace Members | Class Members | File Members

geostat.h

Go to the documentation of this file.
00001 
00006 #ifndef GEOSTATISTICS_CLASS_HEADER_FILE_
00007 #define GEOSTATISTICS_CLASS_HEADER_FILE_
00008 
00009 #include "variogram.h"
00010 
00011 #include <vector>
00012 #include <list>
00013 #include <utility>
00014 #include <gsl/gsl_vector.h>
00015 #include <gsl/gsl_matrix.h>
00016 
00022 class CGeostat
00023 {
00024 
00025 //
00026 // variables
00027 private:
00029         std::vector<gsl_vector *> m_coords;
00031         gsl_vector *m_pData;
00033         gsl_vector *m_pTrend;
00035         std::vector< std::pair<double, double> > m_domain;
00037         CVariogram* m_pVarioCloud;
00039         CVariogram* m_pVariogram;
00041         gsl_matrix* m_pOKSys;
00042 
00043 //
00044 // constructors/destructor
00045 public:
00046         // constructor
00047         CGeostat(void);
00048         // destructor
00049         virtual ~CGeostat(void);
00050                 // initializer
00051         bool initialize(size_t smpl, size_t dim);
00052 
00053 //
00054 // attributes (const)
00055 public:
00061         bool isActive(void) const
00062                 {
00063                         return m_pData != NULL;
00064                 }
00070         size_t samples(void) const
00071                 {
00072                         return m_pData->size;
00073                 }
00074 
00080         size_t dimension(void) const
00081                 {
00082                         return m_domain.size();
00083                 }
00089         double maxDist(void) const;
00090         // domain validation
00091         bool isDomain(const gsl_vector *c) const;
00092         
00093 //
00094 // data readers
00095 //
00096 public:
00097         // get coordinate of sample s
00098         bool getCoordinate(gsl_vector *c, size_t s) const;
00099         // get sample s
00100         double getData(size_t s) const;
00101         // get parameters of estimated theoretical variogram
00102         bool getModelParameters(double &sill, double &range, double &nugget, double &power) const;
00103         // get optimum weights for target parameter c
00104         bool getWeightVector(gsl_vector *w, const gsl_vector *c) const;
00105         // get prediction value & estimate variance
00106         bool getPredictData(double &pred, double &var, const gsl_vector *c) const;
00107         // get prediction value with weight
00108         bool getPredictData(double &pred, const gsl_vector *coord, const gsl_vector *w) const;
00109         // get control space domain
00110         bool getDomain(gsl_vector *lower, gsl_vector *upper) const;
00111         // get trend component
00112         double getTrend(const gsl_vector *c) const;
00113         // get residual component at sample location
00114         double getResidual(size_t s) const;
00115 
00116 //
00117 // data writers
00118 public:
00119         // set control space domain
00120         bool setDomain(const gsl_vector *lower, const gsl_vector *upper);
00121         // set coordinate of sample s
00122         bool setCoordinate(size_t s, const gsl_vector *c);
00123         // set sample data
00124         bool setData(size_t s, double d);
00125 
00126 //
00127 // manipulators
00128 public:
00129         // esimate trend surface and theoretical variogram
00130         bool estimate(int model, double power, double step);
00131         // remove redundant sample s while preserving estimated trend surface and theoretical variogram
00132         bool removeRedundantSample(size_t s);
00133 
00134 //
00135 // for cross validation
00136 public:
00137         // validate the estimated theoretical variogram
00138         double evalModelValidity(int model, double power, double step);
00139         // leave-one-out cross validation
00140         bool getPredictionErrorExcluded(double &pred, double &var, size_t smpl) const;
00141         // greedy search of eliminatee
00142         double selectEliminatee(size_t &candidate) const;
00143 
00144 //
00145 // calculators
00146 protected:
00147         // trend surface approximation
00148         bool approximateTrendSurface(void);
00149         // compute variogram cloud
00150         std::vector<CVariogram::VarioItm> computeVariogramCloud(void) const;
00151         // compute experimental variogram
00152         std::vector<CVariogram::VarioItm> computeExperimentalVariogram(const std::vector<CVariogram::VarioItm> &vcloud, double step) const;
00153         // precompute kriging system
00154         bool precomputeKrigingSystem(void);
00155 
00156 //
00157 // memory managers
00158 private:
00159         // memory allocation
00160         bool allocate(size_t smpl, size_t dim);
00161         // memory destruction
00162         void destroy(void);
00163 };
00164 
00165 #endif  //GEOSTATISTICS_CLASS_HEADER_FILE_

Generated on Thu Aug 11 13:01:33 2005 for Kriging sample by  doxygen 1.4.3