Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #if !defined (octave_SVD_h)
00024 #define octave_SVD_h 1
00025
00026 #include <iosfwd>
00027
00028 #include "dDiagMatrix.h"
00029 #include "dMatrix.h"
00030
00031 class
00032 OCTAVE_API
00033 SVD
00034 {
00035 public:
00036
00037 enum type
00038 {
00039 std,
00040 economy,
00041 sigma_only
00042 };
00043
00044 enum driver
00045 {
00046 GESVD,
00047 GESDD
00048 };
00049
00050 SVD (void) : type_computed (), sigma (), left_sm (), right_sm () { }
00051
00052 SVD (const Matrix& a,
00053 type svd_type = SVD::std, driver svd_driver = SVD::GESVD)
00054 : type_computed (), sigma (), left_sm (), right_sm ()
00055 {
00056 init (a, svd_type, svd_driver);
00057 }
00058
00059 SVD (const Matrix& a, octave_idx_type& info,
00060 type svd_type = SVD::std, driver svd_driver = SVD::GESVD)
00061 : type_computed (), sigma (), left_sm (), right_sm ()
00062 {
00063 info = init (a, svd_type, svd_driver);
00064 }
00065
00066 SVD (const SVD& a)
00067 : type_computed (a.type_computed), sigma (a.sigma),
00068 left_sm (a.left_sm), right_sm (a.right_sm)
00069 { }
00070
00071 SVD& operator = (const SVD& a)
00072 {
00073 if (this != &a)
00074 {
00075 type_computed = a.type_computed;
00076 sigma = a.sigma;
00077 left_sm = a.left_sm;
00078 right_sm = a.right_sm;
00079 }
00080
00081 return *this;
00082 }
00083
00084 ~SVD (void) { }
00085
00086 DiagMatrix singular_values (void) const { return sigma; }
00087
00088 Matrix left_singular_matrix (void) const;
00089
00090 Matrix right_singular_matrix (void) const;
00091
00092 friend std::ostream& operator << (std::ostream& os, const SVD& a);
00093
00094 private:
00095
00096 SVD::type type_computed;
00097
00098 DiagMatrix sigma;
00099 Matrix left_sm;
00100 Matrix right_sm;
00101
00102 octave_idx_type init (const Matrix& a,
00103 type svd_type = std, driver svd_driver = GESVD);
00104 };
00105
00106 #endif