GestureRecognitionToolkit  Version: 0.2.5
The Gesture Recognition Toolkit (GRT) is a cross-platform, open-source, c++ machine learning library for real-time gesture recognition.
SVD.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_SVD_HEADER
22 #define GRT_SVD_HEADER
23 
24 #include "GRTCommon.h"
25 
26 GRT_BEGIN_NAMESPACE
27 
28 #define MAX_NUM_SVD_ITER 75
29 
30 class GRT_API SVD {
31  public:
32 
33  SVD(){}
34  ~SVD(){}
35 
36  bool solve(MatrixFloat &a);
37 
38  MatrixFloat getU(){ return u; }
39  MatrixFloat getV(){ return v; }
40  VectorFloat getW(){ return w; }
41 
42 protected:
43  bool solveVector(VectorFloat &b, VectorFloat &x, Float thresh = -1.);
44  bool solve(MatrixFloat &b, MatrixFloat &x, Float thresh = -1.);
45 
46  UINT rank(Float thresh = -1.);
47  UINT nullity(Float thresh = -1.);
48  MatrixFloat range(Float thresh = -1.);
49  MatrixFloat nullspace(Float thresh = -1.);
50 
51  Float inv_condition();
52  bool decompose();
53  bool reorder();
54  Float pythag(const Float a, const Float b);
55 
56  UINT m,n;
57  MatrixFloat u,v;
58  VectorFloat w;
59  Float eps, tsh;
60 };
61 
62 GRT_END_NAMESPACE
63 
64 #endif //GRT_SVD_HEADER
Definition: SVD.h:30