- Timestamp:
- Feb 18, 2008, 5:43:14 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/yat/utility/vector.cc
r1099 r1101 155 155 156 156 157 gsl_vector* vector::create_gsl_vector_copy(const VectorBase& other) const158 {159 gsl_vector* vec = gsl_vector_alloc(other.size());160 if (!vec)161 throw utility::GSL_error("vector::create_gsl_vector_copy failed to allocate memory");162 if (gsl_vector_memcpy(vec, other.gsl_vector_p()))163 throw utility::GSL_error("vector::create_gsl_matrix_copy dimension mis-match");164 return vec;165 }166 167 168 void vector::delete_allocated_memory(void)169 {170 if (vec_)171 gsl_vector_free(vec_);172 const_vec_ = vec_ = NULL;173 }174 175 176 bool vector::isview(void) const177 {178 return false;179 }180 181 182 const vector& vector::operator=( const VectorBase& other )183 {184 return assign(other);185 }186 187 188 const vector& vector::operator=( const vector& other )189 {190 return assign(other);191 }192 193 194 157 const vector& vector::assign(const VectorBase& other) 195 158 { … … 207 170 208 171 172 gsl_vector* vector::create_gsl_vector_copy(const VectorBase& other) const 173 { 174 gsl_vector* vec = gsl_vector_alloc(other.size()); 175 if (!vec) 176 throw utility::GSL_error("vector::create_gsl_vector_copy failed to allocate memory"); 177 if (gsl_vector_memcpy(vec, other.gsl_vector_p())) 178 throw utility::GSL_error("vector::create_gsl_matrix_copy dimension mis-match"); 179 return vec; 180 } 181 182 183 void vector::delete_allocated_memory(void) 184 { 185 if (vec_) 186 gsl_vector_free(vec_); 187 const_vec_ = vec_ = NULL; 188 } 189 190 191 bool vector::isview(void) const 192 { 193 return false; 194 } 195 196 209 197 void vector::resize(size_t n, double init_value) 210 198 { … … 240 228 241 229 230 const vector& vector::operator=( const VectorBase& other ) 231 { 232 return assign(other); 233 } 234 235 236 const vector& vector::operator=( const vector& other ) 237 { 238 return assign(other); 239 } 240 241 242 242 }}} // of namespace utility, yat, and thep
Note: See TracChangeset
for help on using the changeset viewer.