KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
n_svd.h
Go to the documentation of this file.
1 /* $Id: n_svd.h 18278 2014-11-25 01:42:10Z ksimek $ */
8 /* {{{======================================================================= *
9  |
10  | Copyright (c) 2011 members of the University of Arizona Vision Group
11  |
12  | Personal and educational use of this code is granted, provided that this
13  | header is kept intact, and that the authorship is not misrepresented, that
14  | its use is acknowledged in publications, and relevant papers are cited.
15  |
16  | For other use contact the author (kobus AT cs DOT arizona DOT edu).
17  |
18  | Please note that the code in this file has not necessarily been adequately
19  | tested. Naturally, there is no guarantee of performance, support, or
20  | fitness for any particular task. Nonetheless, I am interested in hearing
21  | about problems that you encounter.
22  * ====================================================================== }}}*/
23 
24 
25 #include <m_cpp/m_matrix.h>
26 #include <m_cpp/m_vector.h>
27 
28 #ifndef KJB_CPP_N_SVD_H_UOFARIZONAVISION
29 #define KJB_CPP_N_SVD_H_UOFARIZONAVISION
30 
31 namespace kjb {
32 
33 
54 struct Svd {
57  mat_vt;
58  int rank;
59 
74  void compute_svd( const kjb_c::Matrix* pa );
75 
76 
78  void compute_svd( const Matrix& mat_a );
79 
80 
82  Svd( const Matrix& mat_a );
83 
84 
86  Svd( const kjb_c::Matrix* pa );
87 
89  void swap( Svd& other );
90 
91 
93  const Matrix& u() const;
94 
95 
97  const Vector& d() const;
98 
99 
101  const Matrix& vt() const;
102 
104  Matrix reconstruction() const;
105 };
106 
107 
108 } // namespace kjb
109 
110 #endif
const Vector & d() const
const getter for vector of singular values
Definition: n_svd.cpp:68
Definition for the Matrix class, a thin wrapper on the KJB Matrix struct and its related functionalit...
void swap(Svd &other)
swap the representations of two SVD tuples
Definition: n_svd.cpp:55
a tuple that computes a singular value decomposition of a matrix
Definition: n_svd.h:54
Matrix reconstruction() const
this tries to reconstruct the original matrix A from its pieces
Definition: n_svd.cpp:78
const Matrix & vt() const
const getter for SVD right factor
Definition: n_svd.cpp:73
int rank
estimated rank of the input matrix
Definition: n_svd.h:58
Svd(const Matrix &mat_a)
ctor for tuple calls the library function on a wrapped Matrix
Definition: n_svd.cpp:45
This class implements vectors, in the linear-algebra sense, with real-valued elements.
Definition: m_vector.h:87
Matrix mat_vt
eigenvectors (right factor in SVD product)
Definition: n_svd.h:56
Vector vec_d
vector of singular values
Definition: n_svd.h:55
Matrix mat_u
left factor in SVD product
Definition: n_svd.h:56
This class implements matrices, in the linear-algebra sense, with real-valued elements.
Definition: m_matrix.h:94
Definition for the Vector class, a thin wrapper on the KJB Vector struct and its related functionalit...
const Matrix & u() const
const getter for SVD left factor
Definition: n_svd.cpp:63
void compute_svd(const kjb_c::Matrix *pa)
wrap call to C library.
Definition: n_svd.cpp:29