Changeset 751 for trunk/yat/utility/SVD.h
- Timestamp:
- Feb 17, 2007, 1:25:36 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/yat/utility/SVD.h
r719 r751 34 34 namespace utility { 35 35 36 // Jari check that interface is complete37 38 36 /** 39 37 Class encapsulating GSL methods for singular value decomposition, … … 47 45 V = Orthogonal matrix, size NxN\n 48 46 */ 49 50 47 class SVD 51 48 { 52 49 public: 53 50 54 / //55 ///A number of SVD algorithms are implemented in GSL. They have56 ///their strengths and weaknesses, check the GSL documentation.57 ///58 ///There are restrictions on the matrix dimensions depending on59 /// which SVD algorithm is used. From the GSL's SVD source code60 /// one finds that the Golub-Reinsch algorithm implementation will61 /// not work on matrices with fewer rows than columns, the same is62 /// alsotrue for the modified Golub-Reinsch algorithm.63 ///64 /// @see GSL's SVD documentation.65 ///51 /** 52 A number of SVD algorithms are implemented in GSL. They have 53 their strengths and weaknesses, check the GSL documentation. 54 55 There are restrictions on the matrix dimensions depending on 56 which SVD algorithm is used. From the GSL's SVD source code one 57 finds that the Golub-Reinsch algorithm implementation will not 58 work on matrices with fewer rows than columns, the same is also 59 true for the modified Golub-Reinsch algorithm. 60 61 \see GSL's SVD documentation. 62 */ 66 63 enum SVDalgorithm { 67 64 GolubReinsch, … … 70 67 }; 71 68 72 /// 73 /// Constructs an SVD object using the matrix Ain as only input. The 74 /// input matrix is copied for further use in the object. 75 /// 69 /** 70 \brief Constructs an SVD object using the matrix Ain as only 71 input. The input matrix is copied for further use in the 72 object. 73 */ 76 74 SVD(const utility::matrix& Ain); 77 75 78 / //79 /// @brief The destructor80 ///76 /** 77 \brief The destructor 78 */ 81 79 ~SVD(void); 82 80 83 /// 84 /// This function will perform SVD with the method specified by \a 85 /// algo. 86 /// 87 /// @return Whatever GSL returns. 88 /// 89 int decompose(SVDalgorithm algo=GolubReinsch); 81 /** 82 \brief This function will perform SVD with the method specified 83 by \a algo. 90 84 91 /// 92 /// @brief Access to the s vector. 93 /// 94 /// @return A copy of the s vector. 95 /// 96 /// @note If decompose() has not been run the outcome of the call 97 /// is undefined. 98 /// 85 \throw GSL_error if the underlying GSL function fails. 86 */ 87 void decompose(SVDalgorithm algo=GolubReinsch); 88 89 /** 90 \brief Access to the s vector. 91 92 \return A copy of the s vector. 93 94 \note If decompose() has not been run the outcome of the call 95 is undefined. 96 */ 99 97 const utility::vector& s(void) const; 100 98 101 /// 102 /// @brief Solve the system \f$ Ax=b \f$ using the decomposition 103 /// of A. 104 /// 105 /// @note If decompose() has not been run the outcome of the call 106 /// is undefined. 107 /// 108 /// @return Whatever GSL returns. 109 /// 110 int solve(const utility::vector& b, utility::vector& x); 99 /** 100 \brief Solve the system \f$ Ax=b \f$ using the decomposition of 101 A. 111 102 112 /// 113 /// @brief Access to the U matrix. 114 /// 115 /// @return A copy of the U matrix. 116 /// 117 /// @note If decompose() has not been run the outcome of the call 118 /// is undefined. 119 /// 103 \note If decompose() has not been run the outcome of the call 104 is undefined. 105 106 \throw GSL_error if the underlying GSL function fails. 107 */ 108 void solve(const utility::vector& b, utility::vector& x); 109 110 /** 111 \brief Access to the U matrix. 112 113 \return A copy of the U matrix. 114 115 \note If decompose() has not been run the outcome of the call 116 is undefined. 117 */ 120 118 const utility::matrix& U(void) const; 121 119 122 / //123 /// @brief Access to the V matrix.124 /// 125 /// @return A copy of the V matrix.126 /// 127 /// @note If decompose() has not been run the outcome of the call128 ///is undefined.129 ///120 /** 121 \brief Access to the V matrix. 122 123 \return A copy of the V matrix. 124 125 \note If decompose() has not been run the outcome of the call 126 is undefined. 127 */ 130 128 const utility::matrix& V(void) const; 131 129 132 130 private: 131 /** 132 \brief Call GSL's Jacobi algorithm for SVD. 133 134 \return gsl_error status. 135 */ 133 136 int jacobi(void); 137 138 /** 139 \brief Call GSL's Golub-Reinsch algorithm for SVD. 140 141 \return gsl_error status. 142 */ 134 143 int golub_reinsch(void); 144 145 /** 146 \brief Call GSL's modified Golub-Reinch algorithm for SVD. 147 148 \return gsl_error status. 149 */ 135 150 int modified_golub_reinsch(void); 136 151
Note: See TracChangeset
for help on using the changeset viewer.