diff --git a/matrix/Matrix.hpp b/matrix/Matrix.hpp index 86fe51d1af..6c37e63bcd 100644 --- a/matrix/Matrix.hpp +++ b/matrix/Matrix.hpp @@ -14,9 +14,14 @@ #include #include +#include "Vector.hpp" + namespace matrix { +template +class Vector; + template class Matrix { @@ -173,7 +178,7 @@ public: Matrix operator+(Type scalar) const { Matrix res; - Matrix &self = *this; + const Matrix &self = *this; for (size_t i = 0; i < M; i++) { for (size_t j = 0; j < N; j++) { @@ -265,9 +270,9 @@ public: return res; } - Matrix diagonal() const + Vector diagonal() const { - Matrix res; + Vector res; // force square for now const Matrix &self = *this; diff --git a/matrix/Vector.hpp b/matrix/Vector.hpp index ff175d194d..b039b0d10a 100644 --- a/matrix/Vector.hpp +++ b/matrix/Vector.hpp @@ -12,6 +12,9 @@ namespace matrix { +template +class Matrix; + template class Vector : public Matrix { @@ -102,12 +105,6 @@ public: self = self - other; } - void operator*=(const Vector &other) - { - Vector &self = *this; - self = self * other; - } - /** * Scalar Operations */ @@ -127,7 +124,7 @@ public: Vector operator+(Type scalar) const { Vector res; - Vector &self = *this; + const Vector &self = *this; for (size_t i = 0; i < M; i++) { res(i) = self(i) + scalar; diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 4c37fe51c9..fe8586b6be 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,3 +1,8 @@ +if (COVERALLS) + add_library(coverage + coverage.cpp) +endif() + set(tests setIdentity inverse diff --git a/test/coverage.cpp b/test/coverage.cpp index 8a39945119..6246833526 100644 --- a/test/coverage.cpp +++ b/test/coverage.cpp @@ -7,7 +7,11 @@ #include #include -template Vector; -template Euler; -template Scalar; -template Matrix; +namespace matrix { + +template class Vector; +template class Euler; +template class Scalar; +template class Matrix; + +};