aboutsummaryrefslogtreecommitdiffstats
path: root/include/YAGE/Math
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2017-06-21 13:11:37 +0100
committerYann Herklotz <ymherklotz@gmail.com>2017-06-21 13:11:37 +0100
commit77c2f920442b7b73cd3f1f94c3362948c7fb2a5d (patch)
treeacb39ebf2b271500208c52ae7894178499152fff /include/YAGE/Math
parent6b974b64e447610f8b5340817ffd4a3513d4f3d1 (diff)
downloadYAGE-77c2f920442b7b73cd3f1f94c3362948c7fb2a5d.tar.gz
YAGE-77c2f920442b7b73cd3f1f94c3362948c7fb2a5d.zip
Creating general includes for easier use
Diffstat (limited to 'include/YAGE/Math')
-rw-r--r--include/YAGE/Math/math.hpp6
-rw-r--r--include/YAGE/Math/matrix.hpp22
2 files changed, 26 insertions, 2 deletions
diff --git a/include/YAGE/Math/math.hpp b/include/YAGE/Math/math.hpp
new file mode 100644
index 00000000..201bf3cb
--- /dev/null
+++ b/include/YAGE/Math/math.hpp
@@ -0,0 +1,6 @@
+#ifndef YAGE_MATH_HPP
+#define YAGE_MATH_HPP
+
+#include "matrix.hpp"
+
+#endif
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();