yat  0.21pre
PCA.h
1 #ifndef _theplu_yat_utility_pca_
2 #define _theplu_yat_utility_pca_
3 
4 // $Id: PCA.h 4207 2022-08-26 04:36:28Z 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, 2020, 2022 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 MatrixBase&);
61 
67  explicit PCA(MatrixMutable&& M);
68 
75  const Vector& eigenvalues(void) const;
76 
83  const Matrix& eigenvectors(void) const;
84 
92  Matrix projection(const MatrixBase&) const;
93 
94  private:
95 
103  void process(void);
104 
110  void row_center(Matrix& A_center);
111 
112  utility::Matrix A_;
113  utility::Vector eigenvalues_;
114  utility::Matrix eigenvectors_;
115  utility::Vector meanvalues_;
116  };
117 
118 }}} // of namespace utility, yat, and theplu
119 
120 #endif
Definition: MatrixBase.h:54
The Department of Theoretical Physics namespace as we define it.
Matrix projection(const MatrixBase &) const
This is the yat interface to GSL vector.
Definition: Vector.h:59
const Vector & eigenvalues(void) const
Returns eigenvalues.
Interface to GSL matrix.
Definition: Matrix.h:104
PCA(const MatrixBase &)
Principal Component Analysis.
Definition: PCA.h:53
Definition: MatrixMutable.h:58
const Matrix & eigenvectors(void) const
Get all eigenvectors in a Matrix.

Generated on Wed Jan 25 2023 03:34:29 for yat by  doxygen 1.8.14