Ignore:
Timestamp:
Feb 1, 2008, 5:15:44 AM (14 years ago)
Author:
Peter
Message:

merging branch peter-dev into trunk delta 1008:994

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/utility/matrix.cc

    r1000 r1009  
    2727#include "matrix.h"
    2828#include "vector.h"
     29#include "vectorView.h"
    2930#include "utility.h"
    3031
     
    302303
    303304
    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;
    319328  }
    320329
     
    549558
    550559
    551   vector operator*(const matrix& m, const vector& v)
     560  vector operator*(const matrix& m, const vectorBase& v)
    552561  {
    553562    utility::vector res(m.rows());
    554563    for (size_t i=0; i<res.size(); ++i)
    555       res(i) = vector(m,i) * v;
     564      res(i) = vectorView(m,i) * v;
    556565    return res;
    557566  }
     
    562571    utility::vector res(m.columns());
    563572    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);
    565574    return res;
    566575  }
Note: See TracChangeset for help on using the changeset viewer.