GestureRecognitionToolkit  Version: 1.0 Revision: 04-03-15
The Gesture Recognition Toolkit (GRT) is a cross-platform, open-source, c++ machine learning library for real-time gesture recognition.
EigenvalueDecomposition.h
1 /*
2 GRT MIT License
3 Copyright (c) <2012> <Nicholas Gillian, Media Lab, MIT>
4 
5 Permission is hereby granted, free of charge, to any person obtaining a copy of this software
6 and associated documentation files (the "Software"), to deal in the Software without restriction,
7 including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
9 subject to the following conditions:
10 
11 The above copyright notice and this permission notice shall be included in all copies or substantial
12 portions of the Software.
13 
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
15 LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
18 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 */
20 
21 #ifndef GRT_EIGENVALUE_DECOMPOSITION_HEADER
22 #define GRT_EIGENVALUE_DECOMPOSITION_HEADER
23 
24 #include "MatrixDouble.h"
25 
26 namespace GRT{
27 
29 public:
32 
33  bool decompose(const MatrixDouble &a);
34 
40  MatrixDouble getEigenvectors(){ return eigenvectors; }
41 
48 
54  VectorDouble getRealEigenvalues();
55 
61  VectorDouble getComplexEigenvalues();
62 
63 protected:
71  void tred2();
72 
80  void tql2();
81 
89  void orthes();
90 
98  void hqr2();
99 
103  void cdiv(double xr, double xi, double yr, double yi);
104 
105  template< class T >
106  inline T findMax(const T &a,const T &b){
107  return (a > b ? a : b);
108  }
109  template< class T >
110  inline T findMin(const T &a,const T &b){
111  return (a < b ? a : b);
112  }
113  template< class T >
114  inline T hypot(const T &a,const T &b){
115  return sqrt( (a*a)+(b*b) );
116  }
117 
118  int n;
119  bool issymmetric;
120  double cdivr;
121  double cdivi;
122  MatrixDouble eigenvectors;
123  MatrixDouble h;
124  VectorDouble realEigenvalues;
125  VectorDouble complexEigenvalues;
126  VectorDouble ort;
127 
128  WarningLog warningLog;
129 
130 };
131 
132 } //End of namespace GRT
133 
134 #endif //GRT_EIGENVALUE_DECOMPOSITION_HEADER
Definition: AdaBoost.cpp:25
void cdiv(double xr, double xi, double yr, double yi)