Changeset 751 for trunk/yat/utility/SVD.cc
- Timestamp:
- Feb 17, 2007, 1:25:36 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/yat/utility/SVD.cc
r719 r751 23 23 24 24 #include "SVD.h" 25 #include <sstream> 25 26 26 27 namespace theplu { … … 40 41 41 42 42 intSVD::decompose(SVDalgorithm algo)43 void SVD::decompose(SVDalgorithm algo) 43 44 { 45 int status=0; 44 46 switch (algo) { 45 case GolubReinsch: 46 return golub_reinsch(); 47 case ModifiedGolubReinsch: 48 return modified_golub_reinsch(); 49 case Jacobi: 50 return jacobi(); 47 case GolubReinsch: 48 status=golub_reinsch(); 49 break; 50 case ModifiedGolubReinsch: 51 status=modified_golub_reinsch(); 52 break; 53 case Jacobi: 54 status=jacobi(); 55 break; 56 default: 57 std::stringstream ss("SVD::decompose "); 58 ss << algo << " is not a valid SVDalgorithm"; 59 throw GSL_error(ss.str()); 51 60 } 52 // Jari, the program should never end up here, return values should be 53 // something different from normal GSL return values, or maybe 54 // throw an exception. 55 return 0; 61 if (status) 62 throw utility::GSL_error(std::string("SVD::decompose",status)); 56 63 } 57 64 … … 88 95 89 96 90 intSVD::solve(const utility::vector& b, utility::vector& x)97 void SVD::solve(const utility::vector& b, utility::vector& x) 91 98 { 92 return gsl_linalg_SV_solve(U_.gsl_matrix_p(), V_.gsl_matrix_p(), 93 s_.gsl_vector_p(), b.gsl_vector_p(), 94 x.gsl_vector_p()); 99 int status=gsl_linalg_SV_solve(U_.gsl_matrix_p(), V_.gsl_matrix_p(), 100 s_.gsl_vector_p(), b.gsl_vector_p(), 101 x.gsl_vector_p()); 102 if (status) 103 throw utility::GSL_error(std::string("SVD::solve",status)); 95 104 } 96 105
Note: See TracChangeset
for help on using the changeset viewer.