OpenWalnut  1.5.0dev
WCovarianceSolver.h
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
10 // OpenWalnut is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // OpenWalnut is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 #ifndef WCOVARIANCESOLVER_H
26 #define WCOVARIANCESOLVER_H
27 
28 #include <vector>
29 #include <Eigen/Dense>
30 #include "core/common/math/linearAlgebra/WPosition.h"
31 
32 using std::vector;
33 
34 using Eigen::MatrixXd;
35 
36 /**
37  * Calculates covariances of a point data set.
38  */
40 {
41 public:
42  /**
43  * Creates an instance of the Covariance solver.
44  */
46  /**
47  * Destroys the instance of the Covariance solver.
48  */
49  virtual ~WCovarianceSolver();
50  /**
51  * Analyzes the dimension covariances of a point data set.
52  * \param dataSet The point data to be analyzed.
53  */
54  void analyzeData( const vector<WPosition>& dataSet );
55  /**
56  * Returns the mean coordinate of the input point data set.
57  * \return The mean of the point data set.
58  */
60  /**
61  * Returns the covariance matrix corresponding to the input point data set.
62  * \return The covariances between all dimensions.
63  */
64  MatrixXd getCovariance();
65 
66 private:
67  /**
68  * Calculates the mean of the input point data coordinates.
69  * \param dataSet Input point data that is used for the mean coordinate calculation.
70  */
71  void calculateMean( const vector<WPosition>& dataSet );
72  /**
73  * Calculates the covariance of the input point data.
74  * \param dataSet Input point data that is used for the covariance matrix
75  * calculation.
76  */
77  void calculateCovariance( const vector<WPosition>& dataSet );
78  /**
79  * Adds a point to the covariance matrix.
80  * \param point Point in the data set to be added to the covariance matrix.
81  */
82  void addPointToCovariance( const WPosition& point );
83 
84  /**
85  * The mean of all input points.
86  */
88  /**
89  * The calculated covariance matrix.
90  */
91  MatrixXd m_covariance;
92 };
93 
94 #endif // WCOVARIANCESOLVER_H
Calculates covariances of a point data set.
WPosition getMean()
Returns the mean coordinate of the input point data set.
virtual ~WCovarianceSolver()
Destroys the instance of the Covariance solver.
void calculateCovariance(const vector< WPosition > &dataSet)
Calculates the covariance of the input point data.
void addPointToCovariance(const WPosition &point)
Adds a point to the covariance matrix.
WPosition m_mean
The mean of all input points.
MatrixXd m_covariance
The calculated covariance matrix.
MatrixXd getCovariance()
Returns the covariance matrix corresponding to the input point data set.
void analyzeData(const vector< WPosition > &dataSet)
Analyzes the dimension covariances of a point data set.
void calculateMean(const vector< WPosition > &dataSet)
Calculates the mean of the input point data coordinates.
WCovarianceSolver()
Creates an instance of the Covariance solver.
This only is a 3d double vector.