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 #if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION)
00027 #pragma interface
00028 #endif
00029
00030 #include <iostream>
00031
00032 #include "dDiagMatrix.h"
00033 #include "dMatrix.h"
00034
00035 class
00036 SVD
00037 {
00038 public:
00039
00040 enum type
00041 {
00042 std,
00043 economy,
00044 sigma_only
00045 };
00046
00047 SVD (void) : sigma (), left_sm (), right_sm () { }
00048
00049 SVD (const Matrix& a, type svd_type = SVD::std) { init (a, svd_type); }
00050
00051 SVD (const Matrix& a, int& info, type svd_type = SVD::std)
00052 {
00053 info = init (a, svd_type);
00054 }
00055
00056 SVD (const SVD& a)
00057 : type_computed (a.type_computed),
00058 sigma (a.sigma), left_sm (a.left_sm), right_sm (a.right_sm) { }
00059
00060 SVD& operator = (const SVD& a)
00061 {
00062 if (this != &a)
00063 {
00064 type_computed = a.type_computed;
00065 sigma = a.sigma;
00066 left_sm = a.left_sm;
00067 right_sm = a.right_sm;
00068 }
00069
00070 return *this;
00071 }
00072
00073 ~SVD (void) { }
00074
00075 DiagMatrix singular_values (void) const { return sigma; }
00076
00077 Matrix left_singular_matrix (void) const;
00078
00079 Matrix right_singular_matrix (void) const;
00080
00081 friend std::ostream& operator << (std::ostream& os, const SVD& a);
00082
00083 private:
00084
00085 SVD::type type_computed;
00086
00087 DiagMatrix sigma;
00088 Matrix left_sm;
00089 Matrix right_sm;
00090
00091 int init (const Matrix& a, type svd_type = std);
00092 };
00093
00094 #endif
00095
00096
00097
00098
00099
00100