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

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/yat/utility/matrix.cc
r754 r755 191 191 192 192 193 int matrix::div_elements(const matrix& b) 194 { 195 return gsl_matrix_div_elements(m_, b.m_); 193 void matrix::div_elements(const matrix& b) 194 { 195 int status=gsl_matrix_div_elements(m_, b.m_); 196 if (status) 197 throw utility::GSL_error(std::string("matrix::div_elements",status)); 196 198 } 197 199 … … 269 271 270 272 271 int matrix::mul_elements(const matrix& b) 272 { 273 return gsl_matrix_mul_elements(m_, b.m_); 273 void matrix::mul_elements(const matrix& b) 274 { 275 int status=gsl_matrix_mul_elements(m_, b.m_); 276 if (status) 277 throw utility::GSL_error(std::string("matrix::mul_elements",status)); 278 274 279 } 275 280 … … 326 331 327 332 328 int matrix::swap(matrix& other) 329 { 330 return gsl_matrix_swap(m_, other.m_); 331 } 332 333 334 int matrix::swap_columns(const size_t i, const size_t j) 335 { 336 return gsl_matrix_swap_columns(m_, i, j); 337 } 338 339 340 int matrix::swap_rowcol(const size_t i, const size_t j) 341 { 342 return gsl_matrix_swap_rowcol(m_, i, j); 343 } 344 345 346 int matrix::swap_rows(const size_t i, const size_t j) 347 { 348 return gsl_matrix_swap_rows(m_, i, j); 333 void matrix::swap(matrix& other) 334 { 335 int status=gsl_matrix_swap(m_, other.m_); 336 if (status) 337 throw utility::GSL_error(std::string("matrix::swap",status)); 338 } 339 340 341 void matrix::swap_columns(const size_t i, const size_t j) 342 { 343 int status=gsl_matrix_swap_columns(m_, i, j); 344 if (status) 345 throw utility::GSL_error(std::string("matrix::swap_columns",status)); 346 } 347 348 349 void matrix::swap_rowcol(const size_t i, const size_t j) 350 { 351 int status=gsl_matrix_swap_rowcol(m_, i, j); 352 if (status) 353 throw utility::GSL_error(std::string("matrix::swap_rowcol",status)); 354 } 355 356 357 void matrix::swap_rows(const size_t i, const size_t j) 358 { 359 int status=gsl_matrix_swap_rows(m_, i, j); 360 if (status) 361 throw utility::GSL_error(std::string("matrix::swap_rows",status)); 349 362 } 350 363 … … 368 381 double& matrix::operator()(size_t row, size_t column) 369 382 { 370 return (*gsl_matrix_ptr(m_, row, column)); 383 double* d=gsl_matrix_ptr(m_, row, column); 384 if (!d) 385 throw utility::GSL_error("matrix::operator()",GSL_EINVAL); 386 return *d; 371 387 } 372 388 … … 374 390 const double& matrix::operator()(size_t row, size_t column) const 375 391 { 376 return (*gsl_matrix_const_ptr(m_, row, column)); 392 const double* d=gsl_matrix_const_ptr(m_, row, column); 393 if (!d) 394 throw utility::GSL_error("matrix::operator()",GSL_EINVAL); 395 return *d; 377 396 } 378 397
Note: See TracChangeset
for help on using the changeset viewer.