Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. Vector Vector::operator*(const mat_vec::Matrix &mat) const {
  2.     size_t size = min(mat.shape().first,this->size());
  3.     Vector tmp(mat.shape().second);
  4.     for (size_t i = 0;i < mat.shape().second;++i) {
  5.         for (size_t j = 0;j < size;++j) {
  6.             tmp[i] += this->vecData[j]*mat.get(j,i);
  7.         }
  8.     }
  9.     return tmp;
  10. }
  11.  
  12. Vector& Vector::operator*=(const mat_vec::Matrix &mat) {
  13.     Vector tmp = *this * mat;
  14.     *this = tmp;
  15.     return *this;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement