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