Changeset 11 for trunk/src/SVD.h
 Timestamp:
 Jun 3, 2003, 6:21:31 PM (19 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/src/SVD.h
r7 r11 4 4 #define _THEP_CPPTOOLS_SVD_ 5 5 6 //GSLwrap includes 7 ////////////////// 8 #include <gslwrap/matrix_double.h> 9 #include <gslwrap/vector_double.h> 6 // C++ tools include 7 ///////////////////// 8 #include "matrix.h" 9 #include "vector.h" 10 #include <gsl/gsl_vector.h> 11 12 13 // Standard includes 14 //////////////////// 15 #include <iostream> 16 #include <cmath> 17 #include <cstdlib> //To include srand() and rand() 18 #include <ctime> 10 19 11 20 … … 26 35 class SVD 27 36 { 28 static const double MAXTOL = 1E 10;37 static const double MAXTOL = 1E6; 29 38 30 39 enum SVDtypes … … 38 47 public: 39 48 /** 49 The default constructor should only be used for testing!!! 50 */ 51 SVD(); 52 53 54 /** 40 55 Constructs an SVD object using the matrix A as only 41 56 input. The input matrix is copied for further use in the 42 57 object. 43 58 */ 44 SVD( const gsl::matrix& );59 SVD( const thep_gsl_api::matrix& ); 45 60 46 61 /** 47 62 Constructor initializing the SVD object for Solver. 48 Solver requires an extravector paramter \a b: $Ax = b$49 The $x$ vector will be reached using the get_x()63 Solver requires an extravector paramter \a b: \f$Ax = b\f$ 64 The \f$x\f$ vector will be reached using the get_x() 50 65 function. 51 66 @see get_x() function. 52 67 */ 53 68 54 SVD( const gsl::matrix&, const gsl::vector& b);69 SVD( const thep_gsl_api::matrix&, const thep_gsl_api::vector& b); 55 70 ~SVD(); 56 71 … … 61 76 Modified: This method is faster when M>>N. (see GSL documentation 62 77 about gsl_linalg_SV_decomp_mod function)\n 63 Ja koby: Computes singular values to higer accuracy than default method78 Jacobi: Computes singular values to higer accuracy than default method 64 79 (see GSL documentation about gsl_linalg_SV_decomp_jacobi.\n 65 80 Solver: Using Unmodified to perform SVD and then solves the system \f$Ax=b\f$ … … 71 86 executed. 72 87 */ 73 gsl::matrix get_u() const { return A_; }88 thep_gsl_api::matrix get_u() const { return A_; } 74 89 75 90 /** … … 77 92 executed. 78 93 */ 79 gsl::matrix get_v() const { return V_; }94 thep_gsl_api::matrix get_v() const { return V_; } 80 95 81 96 … … 87 102 */ 88 103 89 gsl::vector get_x() const { return x_; }104 thep_gsl_api::vector get_x() const { return x_; } 90 105 91 106 /** … … 93 108 executed. 94 109 */ 95 gsl::matrix get_s() const; 110 thep_gsl_api::matrix get_s() const; 111 96 112 97 113 /** 98 This method will execute Default, Unmodified and Jakoby methods one at a time 114 Function returning diagonal matrix S in vector form. 115 */ 116 thep_gsl_api::vector get_s_vec() const { return s_; } 117 118 119 /** 120 This method will execute Default, Unmodified and Jacobi methods one at a time 99 121 and calculate the error, \f$ e = \left\Vert A  USV^{T} \right\Vert_{2} \f$. 100 The method will return "true" if \f$e < 10^{ 10}\f$ else false. A test program122 The method will return "true" if \f$e < 10^{6}\f$ else false. A test program 101 123 is available that executes this method, c++_tools/test/svd_test. No test is 102 124 performed for solver but the aim is to add one in the future. … … 105 127 106 128 private: 107 SVD();108 129 109 gsl::matrix A_, V_;110 gsl::vector s_, b_, x_;130 thep_gsl_api::matrix A_, V_; 131 thep_gsl_api::vector s_, b_, x_; 111 132 bool loaded_, solver_; 112 133
Note: See TracChangeset
for help on using the changeset viewer.