aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2017-06-23 21:19:11 +0100
committerYann Herklotz <ymherklotz@gmail.com>2017-06-23 21:19:11 +0100
commit205f2459063a123cabd83fb66b3880a72fb357bf (patch)
tree7daabd15f3470ed5ffe37eebfd0c6f5e6baaa308 /include
parent3e8751d8cee8e41031655e9f4d5f364f6100b503 (diff)
downloadYAGE-205f2459063a123cabd83fb66b3880a72fb357bf.tar.gz
YAGE-205f2459063a123cabd83fb66b3880a72fb357bf.zip
Continuing tests
Diffstat (limited to 'include')
-rw-r--r--include/YAGE/Math/matrix.hpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/include/YAGE/Math/matrix.hpp b/include/YAGE/Math/matrix.hpp
index d4566c98..d1c5fd74 100644
--- a/include/YAGE/Math/matrix.hpp
+++ b/include/YAGE/Math/matrix.hpp
@@ -236,6 +236,22 @@ Matrix<M, N, T> operator-(const T &lhs, Matrix<M, N, T> rhs)
}
template<int M, int N, class T>
+bool operator==(const Matrix<M, N, T> &lhs, const Matrix<M, N, T> &rhs)
+{
+ for(int i=0; i<M; ++i)
+ {
+ for(int j=0; j<N; ++j)
+ {
+ if(lhs[i][j]!=rhs[i][j])
+ {
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
+template<int M, int N, class T>
std::ostream& operator<<(std::ostream &os, const Matrix<M, N, T> &mat)
{
return os<<mat.toString();
@@ -304,12 +320,12 @@ template<int M, int N, class T> Matrix<N, M, T> transpose(const Matrix<M, N, T>
return trans;
}
-template<int R, class T> T dot(const Vector<R, T> &v1, const Vector<R, T> &v2)
+template<int R, class T> T dot(const Matrix<R, 1, T> &m1, const Matrix<R, 1, T> &m2)
{
T sum=0;
for(int i=0; i<R; ++i)
{
- sum += v1[i]*v2[i];
+ sum += m1[i][0]*m2[i][0];
}
return sum;
}
@@ -328,7 +344,7 @@ Matrix<M, Q, T> multiply(const Matrix<M, N, T> &m1, const Matrix<P, Q, T> &m2)
{
for(int j=0; j<Q; ++j)
{
- // int sum=0;
+ res[i][j] = dot(transpose(m1.getRow(i)), m2.getCol(j));
}
}