diff options
Diffstat (limited to 'include/YAGE/Math/matrix.hpp')
-rw-r--r-- | include/YAGE/Math/matrix.hpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/include/YAGE/Math/matrix.hpp b/include/YAGE/Math/matrix.hpp index 47bb6d60..5a753616 100644 --- a/include/YAGE/Math/matrix.hpp +++ b/include/YAGE/Math/matrix.hpp @@ -155,8 +155,6 @@ public: data_=std::move(out); return *this; } - - }; template<int M, int N, class T> @@ -194,6 +192,26 @@ Matrix<M, N, T> operator+(const T &lhs, Matrix<M, N, T> rhs) } template<int M, int N, class T> +Matrix<M, N, T> operator-(Matrix<M, N, T> lhs, const T &rhs) +{ + for(auto &data : lhs) + { + data-=rhs; + } + return lhs; +} + +template<int M, int N, class T> +Matrix<M, N, T> operator-(const T &lhs, Matrix<M, N, T> rhs) +{ + for(auto &data : rhs) + { + data=lhs-data; + } + return rhs; +} + +template<int M, int N, class T> std::ostream& operator<<(std::ostream &os, const Matrix<M, N, T> &mat) { return os<<mat.toString(); |