summaryrefslogtreecommitdiffhomepage
path: root/opentrack/simple-mat.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'opentrack/simple-mat.hpp')
-rw-r--r--opentrack/simple-mat.hpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/opentrack/simple-mat.hpp b/opentrack/simple-mat.hpp
index f1391f3c..158cb30d 100644
--- a/opentrack/simple-mat.hpp
+++ b/opentrack/simple-mat.hpp
@@ -5,6 +5,24 @@ template<typename num, int h, int w>
struct Mat
{
num data[h][w];
+
+ Mat<num, h, w> operator+(const Mat<num, h, w>& other) const
+ {
+ Mat<num, h, w> ret;
+ for (int j = 0; j < h; j++)
+ for (int i = 0; i < w; i++)
+ ret(j, i) = this->operator ()(j, i) + other(j, i);
+ return ret;
+ }
+
+ Mat<num, h, w> operator-(const Mat<num, h, w>& other) const
+ {
+ Mat<num, h, w> ret;
+ for (int j = 0; j < h; j++)
+ for (int i = 0; i < w; i++)
+ ret(j, i) = this->operator ()(j, i) - other(j, i);
+ return ret;
+ }
template<int p>
Mat<num, w, p> operator*(const Mat<num, w, p>& other) const