Changeset 755 for trunk/yat/utility/vector.cc
 Timestamp:
 Feb 18, 2007, 1:01:39 AM (16 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/yat/utility/vector.cc
r754 r755 219 219 220 220 221 int vector::div(const vector& other) 222 { 223 return gsl_vector_div(v_,other.v_); 221 void vector::div(const vector& other) 222 { 223 int status=gsl_vector_div(v_,other.v_); 224 if (status) 225 throw utility::GSL_error(std::string("vector::div",status)); 224 226 } 225 227 … … 289 291 290 292 291 int vector::mul(const vector& other) 292 { 293 return gsl_vector_mul(v_,other.v_); 294 } 295 296 297 int vector::reverse(void) 298 { 299 return gsl_vector_reverse(v_); 293 void vector::mul(const vector& other) 294 { 295 int status=gsl_vector_mul(v_,other.v_); 296 if (status) 297 throw utility::GSL_error(std::string("vector::mul",status)); 298 } 299 300 301 void vector::reverse(void) 302 { 303 gsl_vector_reverse(v_); 300 304 } 301 305 … … 363 367 364 368 365 int vector::swap(vector& other) 366 { 367 return gsl_vector_swap(v_,other.v_); 368 } 369 370 371 int vector::swap_elements(size_t i, size_t j) 372 { 373 return gsl_vector_swap_elements(v_,i,j); 369 void vector::swap(vector& other) 370 { 371 int status=gsl_vector_swap(v_,other.v_); 372 if (status) 373 throw utility::GSL_error(std::string("vector::swap",status)); 374 } 375 376 377 void vector::swap_elements(size_t i, size_t j) 378 { 379 int status=gsl_vector_swap_elements(v_, i, j); 380 if (status) 381 throw utility::GSL_error(std::string("vector::swap_elements",status)); 374 382 } 375 383 … … 377 385 double& vector::operator()(size_t i) 378 386 { 379 return *gsl_vector_ptr(v_,i); 387 double* d=gsl_vector_ptr(v_, i); 388 if (!d) 389 throw utility::GSL_error("vector::operator()",GSL_EINVAL); 390 return *d; 380 391 } 381 392 … … 383 394 const double& vector::operator()(size_t i) const 384 395 { 385 return *gsl_vector_const_ptr(proxy_v_,i); 396 const double* d=gsl_vector_const_ptr(proxy_v_, i); 397 if (!d) 398 throw utility::GSL_error("vector::operator()",GSL_EINVAL); 399 return *d; 386 400 } 387 401
Note: See TracChangeset
for help on using the changeset viewer.