GeostatisticalFunctions.h
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/sa/core/GeostatisticalFunctions.h
22 
23  \brief Auxiliary functions used to calculate the geostatistical methods.
24 
25  \reference Methods adapted from TerraLib4.
26 */
27 
28 #ifndef __TERRALIB_SA_INTERNAL_GEOSTATISTICALFUNCTIONS_H
29 #define __TERRALIB_SA_INTERNAL_GEOSTATISTICALFUNCTIONS_H
30 
31 // TerraLib
32 #include "../Config.h"
33 
34 // STL
35 #include <string>
36 
37 // Boost
38 #include <boost/numeric/ublas/matrix.hpp>
39 
40 namespace te
41 {
42  // Forward declaration
43  namespace da { class DataSet; }
44  namespace gm { class Geometry; }
45 
46  namespace sa
47  {
49  {
50  double m_value;
52 
54  {
55  m_value = 0.;
56  m_geom = 0;
57  }
58 
60  {
61  delete m_geom;
62  }
63 
64  };
65 
66  typedef std::vector<te::sa::GeostatisticalDataItem*> GeostatisticalData;
67 
68  /*!
69  \brief Function used to create a matrix with values, distance and angle for each element from dataset.
70 
71  \param dataSet Pointer to input data.
72  \param attrIdx Attribute index used to create the matrix.
73  \param geomIdx Attribute index used to identify the geometric attribute.
74 
75  \return A matrix with values from dataset (main diagonal), distance (top of the matrix), angle (bottom of the matrix).
76 
77  */
78  TESAEXPORT boost::numeric::ublas::matrix<double> CreateMatrixFromDataSet(te::da::DataSet* dataSet, int attrIdx, int geomIdx);
79 
80  /*!
81  \brief Function used to set new values in the matrix main diagonal.
82 
83  \param matrix Reference to a valid matrix.
84  \param dataSet Pointer to input data.
85  \param attrIdx Attribute index used to reset the diagonal values.
86 
87  \return A matrix with values from dataset (main diagonal), distance (top of the matrix), angle (bottom of the matrix).
88 
89  */
90  TESAEXPORT void SetMainDiagonal(boost::numeric::ublas::matrix<double>& matrix, te::da::DataSet* dataSet, int attrIdx);
91 
92  /*!
93  \brief Function used to calculate mean and variance from a matrix.
94 
95  \param matrix Reference to a valid matrix.
96  \param mean Reference to set the mean value.
97  \param variance Reference to set the variance value.
98 
99  */
100  TESAEXPORT void CalculateMoments(const boost::numeric::ublas::matrix<double>& matrix, double& mean, double& variance);
101 
103 
104 
105  } // end namespace sa
106 } // end namespace te
107 
108 #endif // __TERRALIB_SA_INTERNAL_GEOSTATISTICALFUNCTIONS_H
109 
TESAEXPORT boost::numeric::ublas::matrix< double > CreateMatrixFromDataSet(te::da::DataSet *dataSet, int attrIdx, int geomIdx)
Function used to create a matrix with values, distance and angle for each element from dataset...
TESAEXPORT void SetMainDiagonal(boost::numeric::ublas::matrix< double > &matrix, te::da::DataSet *dataSet, int attrIdx)
Function used to set new values in the matrix main diagonal.
TESAEXPORT void CalculateMoments(const boost::numeric::ublas::matrix< double > &matrix, double &mean, double &variance)
Function used to calculate mean and variance from a matrix.
std::vector< te::sa::GeostatisticalDataItem * > GeostatisticalData
URI C++ Library.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:73
A dataset is the unit of information manipulated by the data access module of TerraLib.
Definition: DataSet.h:112
#define TESAEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:133
TESAEXPORT te::sa::GeostatisticalData CreateGeostatisticalData(te::da::DataSet *dataSet, int attrIdx, int geomIdx)