Changeset 1009 for trunk/yat/utility/matrix.cc
 Timestamp:
 Feb 1, 2008, 5:15:44 AM (14 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/yat/utility/matrix.cc
r1000 r1009 27 27 #include "matrix.h" 28 28 #include "vector.h" 29 #include "vectorView.h" 29 30 #include "utility.h" 30 31 … … 302 303 303 304 304 void matrix::column(const size_t column, const vector& vec) 305 { 306 assert(m_); 307 int status=gsl_matrix_set_col(m_, column, vec.gsl_vector_p()); 308 if (status) 309 throw utility::GSL_error(std::string("matrix::set_column",status)); 310 } 311 312 313 void matrix::row(const size_t row, const vector& vec) 314 { 315 assert(m_); 316 int status=gsl_matrix_set_row(m_, row, vec.gsl_vector_p()); 317 if (status) 318 throw utility::GSL_error(std::string("matrix::set_row",status)); 305 vectorView matrix::column_vec(size_t col) 306 { 307 vectorView res(*this, col, false); 308 return res; 309 } 310 311 312 const vectorView matrix::column_vec(size_t col) const 313 { 314 return vectorView(*this, col, false); 315 } 316 317 318 const vectorView matrix::row_vec(size_t col) const 319 { 320 return vectorView(*this, col, true); 321 } 322 323 324 vectorView matrix::row_vec(size_t row) 325 { 326 vectorView res(*this, row, true); 327 return res; 319 328 } 320 329 … … 549 558 550 559 551 vector operator*(const matrix& m, const vector & v)560 vector operator*(const matrix& m, const vectorBase& v) 552 561 { 553 562 utility::vector res(m.rows()); 554 563 for (size_t i=0; i<res.size(); ++i) 555 res(i) = vector (m,i) * v;564 res(i) = vectorView(m,i) * v; 556 565 return res; 557 566 } … … 562 571 utility::vector res(m.columns()); 563 572 for (size_t i=0; i<res.size(); ++i) 564 res(i) = v * vector (m,i,false);573 res(i) = v * vectorView(m,i,false); 565 574 return res; 566 575 }
Note: See TracChangeset
for help on using the changeset viewer.