Changeset 737


Ignore:
Timestamp:
Jan 7, 2007, 2:48:38 PM (15 years ago)
Author:
Peter
Message:

moving vector matrix multiplication to matrix.h and matrix.cc

Location:
trunk/yat/utility
Files:
4 edited

Legend:

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

    r734 r737  
    437437  }
    438438
     439
     440  vector operator*(const matrix& m, const vector& v)
     441  {
     442    utility::vector res(m.rows());
     443    for (size_t i=0; i<res.size(); ++i)
     444      res(i) = vector(m,i) * v;
     445    return res;
     446  }
     447
     448
     449  vector operator*(const vector& v, const matrix& m)
     450  {
     451    utility::vector res(m.columns());
     452    for (size_t i=0; i<res.size(); ++i)
     453      res(i) = v * vector(m,i,false);
     454    return res;
     455  }
     456
    439457}}} // of namespace utility, yat and thep
  • trunk/yat/utility/matrix.h

    r735 r737  
    420420  std::ostream& operator<< (std::ostream& s, const matrix&);
    421421
     422  /**
     423     @brief vector matrix multiplication
     424   */
     425  vector operator*(const matrix&, const vector&);
     426
     427  /**
     428     @brief matrix vector multiplication
     429   */
     430  vector operator*(const vector&, const matrix&);
    422431
    423432}}} // of namespace utility, yat, and theplu
  • trunk/yat/utility/utility.cc

    r734 r737  
    119119
    120120
    121   vector operator*(const matrix& m, const vector& v)
    122   {
    123     utility::vector res(m.rows());
    124     for (size_t i=0; i<res.size(); ++i)
    125       res(i) = vector(m,i) * v;
    126     return res;
    127   }
    128 
    129 
    130   vector operator*(const vector& v, const matrix& m)
    131   {
    132     utility::vector res(m.columns());
    133     for (size_t i=0; i<res.size(); ++i)
    134       res(i) = v * vector(m,i,false);
    135     return res;
    136   }
    137 
    138121}}} // end of namespace utility, yat and thep
  • trunk/yat/utility/utility.h

    r734 r737  
    3333///
    3434
    35 #include "vector.h"
    36 
    3735#include <string>
    3836#include <utility>
     
    4341namespace utility {
    4442
    45   class matrix;
     43  class vector;
    4644
    4745  ///
     
    8684
    8785
    88   /**
    89      @brief matrix vector multiplication
    90    */
    91   vector operator*(const matrix&, const vector&);
    92 
    93 
    94   /**
    95      @brief matrix vector multiplication
    96    */
    97   vector operator*(const vector&, const matrix&);
    98 
    9986}}} // of namespace utility, yat, and theplu
    10087
Note: See TracChangeset for help on using the changeset viewer.