GestureRecognitionToolkit  Version: 0.1.0
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 "GRTTypedefs.h"
25 #include "../DataStructures/VectorFloat.h"
26 #include "../DataStructures/MatrixFloat.h"
27 
28 GRT_BEGIN_NAMESPACE
29 
31 public:
34 
35  bool decompose(const MatrixFloat &a);
36 
42  MatrixFloat getEigenvectors(){ return eigenvectors; }
43 
50 
57 
64 
65 protected:
73  void tred2();
74 
82  void tql2();
83 
91  void orthes();
92 
100  void hqr2();
101 
105  void cdiv(Float xr, Float xi, Float yr, Float yi);
106 
107  template< class T >
108  inline T findMax(const T &a,const T &b){
109  return (a > b ? a : b);
110  }
111  template< class T >
112  inline T findMin(const T &a,const T &b){
113  return (a < b ? a : b);
114  }
115  template< class T >
116  inline T hypot(const T &a,const T &b){
117  return sqrt( (a*a)+(b*b) );
118  }
119 
120  int n;
121  bool issymmetric;
122  Float cdivr;
123  Float cdivi;
124  MatrixFloat eigenvectors;
125  MatrixFloat h;
126  VectorFloat realEigenvalues;
127  VectorFloat complexEigenvalues;
128  VectorFloat ort;
129 
130  WarningLog warningLog;
131 
132 };
133 
134 GRT_END_NAMESPACE
135 
136 #endif //GRT_EIGENVALUE_DECOMPOSITION_HEADER
void cdiv(Float xr, Float xi, Float yr, Float yi)