 Timestamp:
 Nov 28, 2005, 12:40:10 AM (17 years ago)
 Location:
 branches/better_matrix_class/lib/gslapi
 Files:

 4 edited
Legend:
 Unmodified
 Added
 Removed

branches/better_matrix_class/lib/gslapi/matrix.cc
r407 r408 43 43 44 44 45 matrix(matrix& m, size_t offset_row, size_t offset_column, size_t n_row, 46 size_t n_column); 47 { 48 view_ = new gsl_matrix_view(gsl_matrix_submatrix(v.m_,offset_row, 49 offset_column,n_row, 50 n_column)); 51 v_ = &(view_>matrix); 45 matrix::matrix(matrix& m, size_t offset_row, size_t offset_column, 46 size_t n_row, size_t n_column) 47 { 48 // Jari, exception handling needed here. Failure in setting up a 49 // proper gsl_matrix_view is communicated by NULL pointer in the 50 // view structure (cf. GSL manual). How about GSL error state? 51 view_ = new gsl_matrix_view(gsl_matrix_submatrix(m.m_, 52 offset_row,offset_column, 53 n_row,n_column)); 54 m_ = &(view_>matrix); 52 55 } 53 56 
branches/better_matrix_class/lib/gslapi/matrix.h
r407 r408 32 32 /// data is deallocated. 33 33 /// 34 /// @note All GSL matrix related functions are not implement but all 35 /// functionality, except binary file support, defined for GSL 36 /// matrices can be achieved with this interface class. 34 /// @note All GSL matrix related functions are not implement but 35 /// most functionality defined for GSL matrices can be achieved with 36 /// this interface class. Most notable GSL functionality not 37 /// supported are no binary file support and views on arrays, 38 /// gslapi::vectors, gsl_vectors, diagonals, subdiagonals, and 39 /// superdiagonals. If there is an interest from the user community, 40 /// the omitted functionality could be included. 37 41 /// 38 42 class matrix … … 73 77 /// is viewed. Also, using the copy constructor will create a new 74 78 /// matrix object that is a copy of whatever is viewed. If a copy 75 /// of the view is needed then you should use this const urctor to76 /// get one.79 /// of the view is needed then you should use this constructor to 80 /// obtain a copy. 77 81 /// 78 82 /// @note If the object viewed by the view goes out of scope or is … … 93 97 /// of file marker. 94 98 /// 95 explicit matrix(std::istream &) ;99 explicit matrix(std::istream &) throw (utility::IO_error,std::exception); 96 100 97 101 /// … … 142 146 /// 143 147 bool equal(const matrix&, const double precision=0) const; 148 149 /// 150 /// @return A const pointer to the internal GSL matrix. 151 /// 152 // Jari, is this needed? 153 inline const gsl_matrix* gsl_matrix_pointer(void) const { return m_; } 154 155 /// 156 /// @return A pointer to the internal GSL matrix. 157 /// 158 // Jari, is this needed? 159 inline gsl_matrix* gsl_matrix_pointer(void) { return m_; }; 144 160 145 161 /// … … 387 403 gsl_matrix* gsl_matrix_copy(void) const; 388 404 389 ///390 /// @return A const pointer to the internal GSL matrix.391 ///392 // Jari, is this needed?393 inline const gsl_matrix* gsl_matrix_pointer(void) const { return m_; }394 395 ///396 /// @return A pointer to the internal GSL matrix.397 ///398 // Jari, is this needed?399 inline gsl_matrix* gsl_matrix_pointer(void) { return m_; };400 401 405 gsl_matrix* m_; 402 406 gsl_matrix_view* view_; 
branches/better_matrix_class/lib/gslapi/vector.cc
r406 r408 2 2 3 3 #include <c++_tools/gslapi/vector.h> 4 #include <c++_tools/gslapi/matrix.h> 4 5 #include <c++_tools/utility/stl_utility.h> 5 6 … … 40 41 vector::vector(vector& v, size_t offset, size_t n, size_t stride) 41 42 { 43 // Jari, exception handling needed here. Failure in setting up a 44 // proper gsl_vector_view is communicated by NULL pointer in the 45 // view structure (cf. GSL manual). How about GSL error state? 42 46 view_ = new gsl_vector_view(gsl_vector_subvector_with_stride(v.v_,offset, 43 47 stride,n)); 44 48 v_ = &(view_>vector); 45 49 } 50 51 52 53 vector::vector(matrix& m, size_t i, bool row) 54 { 55 view_ = new gsl_vector_view(row ? 56 gsl_matrix_row (m.gsl_matrix_pointer(),i) : 57 gsl_matrix_column(m.gsl_matrix_pointer(),i) ); 58 v_ = &(view_>vector); 59 } 60 46 61 47 62 
branches/better_matrix_class/lib/gslapi/vector.h
r406 r408 14 14 namespace theplu { 15 15 namespace gslapi { 16 17 class matrix; 18 16 19 /// 17 20 /// This is the C++ tools interface to GSL vector. 'double' is the … … 31 34 /// data is deallocated. 32 35 /// 36 /// @note Missing support to underlying GSL vector features can in 37 /// principle be included to this class if requested by the user 38 /// community. 39 /// 33 40 class vector 34 41 { … … 55 62 56 63 /// 57 /// The vector view constructor.64 /// Vector view constructor. 58 65 /// 59 66 /// Create a view of vector \a v, with starting index \a offset, … … 64 71 /// is viewed. Also, using the copy constructor will create a new 65 72 /// vector object that is a copy of whatever is viewed. If a copy 66 /// of the view is needed then you should use this const urctor to67 /// get one.73 /// of the view is needed then you should use this constructor to 74 /// obtain a copy. 68 75 /// 69 76 /// @note If the object viewed by the view goes out of scope or is … … 74 81 75 82 /// 83 /// Matrix row/column view constructor. 84 /// 85 /// Create a row/column vector view of matrix \a m, pointing at 86 /// row/column \a i. The parameter \a row is used to set whether 87 /// the view should be a row or column view. If \a row is set to 88 /// true, the view will be a row view (default behaviour), and, 89 /// naturally, a column view otherwise. 90 /// 91 /// A vector view can be used as any vector with the difference 92 /// that changes made to the view will also change the object that 93 /// is viewed. Also, using the copy constructor will create a new 94 /// vector object that is a copy of whatever is viewed. If a copy 95 /// of the view is needed then you should use the vector view 96 /// constructor to obtain a copy. 97 /// 98 /// @note If the object viewed by the view goes out of scope or is 99 /// deleted, the view becomes invalid and the result of further 100 /// use is undefined. 101 /// 102 vector(matrix& m, size_t i, bool row=true); 103 104 /// 76 105 /// Constructor that imports a GSL vector. The GSL object is owned 77 106 /// by the created object. … … 120 149 121 150 /// 151 /// @return A const pointer to the internal GSL vector, 152 /// 153 // Jari, is this needed? 154 inline const gsl_vector* gsl_vector_pointer(void) const { return v_; } 155 156 /// 157 /// @return A pointer to the internal GSL vector, 158 /// 159 // Jari, is this needed? 160 inline gsl_vector* TEMP_gsl_vector_pointer(void) { return v_; } 161 162 /// 122 163 /// @return True if all elements in the vector is zero, false 123 164 /// othwerwise; … … 132 173 /// 133 174 inline bool isview(void) const { return view_; } 134 135 ///136 /// @return A const pointer to the internal GSL vector,137 ///138 inline const gsl_vector* gsl_vector_pointer(void) const { return v_; }139 140 ///141 /// @return A pointer to the internal GSL vector,142 ///143 inline gsl_vector* TEMP_gsl_vector_pointer(void) { return v_; }144 175 145 176 ///
Note: See TracChangeset
for help on using the changeset viewer.