Changeset 1099
- Timestamp:
- Feb 18, 2008, 4:42:46 AM (15 years ago)
- Location:
- trunk/yat/utility
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/yat/utility/vector.cc
r1068 r1099 195 195 { 196 196 delete_allocated_memory(); 197 if (!other.size()) 198 vec_=NULL; 199 else { 197 if (other.size()) { 200 198 if (size()!=other.size()) 201 199 vec_ = gsl_vector_alloc(other.size()); … … 203 201 throw utility::GSL_error("vector failed to allocate memory"); 204 202 gsl_vector_memcpy(vec_,other.gsl_vector_p()); 203 const_vec_ = vec_; 205 204 } 206 const_vec_ = vec_;207 205 return *this; 208 206 } 207 208 209 void vector::resize(size_t n, double init_value) 210 { 211 delete_allocated_memory(); 212 const_vec_ = vec_ = gsl_vector_alloc(n); 213 if (!vec_) 214 throw utility::GSL_error("vector::vector failed to allocate memory"); 215 all(init_value); 216 } 209 217 210 218 -
trunk/yat/utility/vector.h
r1068 r1099 116 116 117 117 /** 118 \brief Resize vector 119 120 All elements are set to \a init_value. 121 122 \note Underlying GSL vector is destroyed and a view into this 123 vector becomes invalid. 124 */ 125 void resize(size_t, double init_value=0); 126 127 /** 118 128 \brief The assignment operator. 119 129
Note: See TracChangeset
for help on using the changeset viewer.