yat  0.16.4pre
PCA.h
1 #ifndef _theplu_yat_utility_pca_
2 #define _theplu_yat_utility_pca_
3 
4 // $Id: PCA.h 3792 2019-04-12 07:15:09Z peter $
5 
6 /*
7  Copyright (C) 2003 Daniel Dalevi
8  Copyright (C) 2004 Jari Häkkinen
9  Copyright (C) 2005 Jari Häkkinen, Peter Johansson
10  Copyright (C) 2006 Jari Häkkinen
11  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
12  Copyright (C) 2010, 2018 Peter Johansson
13 
14  This file is part of the yat library, http://dev.thep.lu.se/yat
15 
16  The yat library is free software; you can redistribute it and/or
17  modify it under the terms of the GNU General Public License as
18  published by the Free Software Foundation; either version 3 of the
19  License, or (at your option) any later version.
20 
21  The yat library is distributed in the hope that it will be useful,
22  but WITHOUT ANY WARRANTY; without even the implied warranty of
23  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24  General Public License for more details.
25 
26  You should have received a copy of the GNU General Public License
27  along with yat. If not, see <http://www.gnu.org/licenses/>.
28 */
29 
30 #include "config_public.h"
31 
32 #include "Matrix.h"
33 #include "Vector.h"
34 
35 namespace theplu {
36 namespace yat {
37 namespace utility {
38 
53  class PCA
54  {
55  public:
60  explicit PCA(const Matrix&);
61 
62 #ifdef YAT_HAVE_RVALE
63 
68  explicit PCA(Matrix&& M);
69 #endif
70 
77  const Vector& eigenvalues(void) const;
78 
85  const Matrix& eigenvectors(void) const;
86 
94  Matrix projection(const Matrix&) const;
95 
96  private:
97 
105  void process(void);
106 
112  void row_center(Matrix& A_center);
113 
114  utility::Matrix A_;
115  utility::Vector eigenvalues_;
116  utility::Matrix eigenvectors_;
117  utility::Vector meanvalues_;
118  };
119 
120 }}} // of namespace utility, yat, and theplu
121 
122 #endif
The Department of Theoretical Physics namespace as we define it.
Matrix projection(const Matrix &) const
This is the yat interface to GSL vector.
Definition: Vector.h:59
const Vector & eigenvalues(void) const
Returns eigenvalues.
const Matrix & eigenvectors(void) const
Get all eigenvectors in a Matrix.
Interface to GSL matrix.
Definition: Matrix.h:74
Principal Component Analysis.
Definition: PCA.h:53

Generated on Thu Dec 12 2019 03:12:08 for yat by  doxygen 1.8.11