Commit 83928b30 by Basile Sauvage

### correction des produits matrice/vecteur et vecteur/matrice

parent 218a41b3
 ... @@ -161,7 +161,11 @@ class Matrix ... @@ -161,7 +161,11 @@ class Matrix // Vector / Matrix multiplication // Vector / Matrix multiplication template template Vector operator*(const Vector& v, const Matrix& m) ; Vector operator*(const Vector& v, const Matrix& m) ; // Matrix / Vector multiplication template Vector operator*(const Matrix& m,const Vector& v) ; // Scalar / Matrix multiplication // Scalar / Matrix multiplication template template ... ...
 ... @@ -431,13 +431,25 @@ std::istream& operator>>(std::istream& in, Matrix& m) ... @@ -431,13 +431,25 @@ std::istream& operator>>(std::istream& in, Matrix& m) template template Vector operator*(const Vector& v, const Matrix& m) Vector operator*(const Vector& v, const Matrix& m) { { Vector res ; Vector res (0); for(unsigned int i = 0; i < M; ++i) for(unsigned int i = 0; i < M; ++i) for(unsigned int j = 0; j < N; ++j) for(unsigned int j = 0; j < N; ++j) res[j] += m(i,j) * v[i] ; res[j] += m(i,j) * v[i] ; return res ; return res ; } } // Matrix / Vector multiplication template Vector operator*(const Matrix& m,const Vector& v) { Vector res (0); for(unsigned int i = 0; i < M; ++i) for(unsigned int j = 0; j < N; ++j) res[i] += m(i,j) * v[j] ; return res ; } // Scalar / Matrix multiplication // Scalar / Matrix multiplication template template Matrix operator*(T s, const Matrix& m) Matrix operator*(T s, const Matrix& m) ... ...
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment