From 1d3657c760228be246554ab0e7bfe9c2818e5a5b Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Sun, 6 Aug 2017 15:57:26 +0100 Subject: Improving matrix class --- include/YAGE/Math/matrix.hpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/YAGE/Math/matrix.hpp b/include/YAGE/Math/matrix.hpp index 2aca04db..8f490b41 100644 --- a/include/YAGE/Math/matrix.hpp +++ b/include/YAGE/Math/matrix.hpp @@ -96,6 +96,7 @@ protected: public: /// Initializes the size of the data_ vector Matrix() : data_(Rows*Cols) {} + Matrix(const std::vector& data) : data_(data) {} /// Returns the row size of the Matrix int rowSize() const @@ -273,8 +274,7 @@ Matrix operator*(Matrix lhs, const T &rhs) } template -Matrix operator*(const T &lhs, Matrix rhs) -{ +Matrix operator*(const T &lhs, Matrix rhs) { for(auto &data : rhs) { data*=lhs; @@ -312,7 +312,8 @@ template class Vector : public Matrix() : Matrix() {} - explicit Vector(const Matrix &other) : Matrix(other) {} + Vector(const Matrix& other) : Matrix(other) {} + Vector(const std::vector& data) : Matrix(data) {} Type& operator[](int col) { @@ -345,6 +346,7 @@ template class Vector2 : public Vector<2, Type> { public: Vector2() : Vector<2, Type>() {} + Vector2(const std::vector& data) : Vector<2, Type>(data) {} Vector2(Type x, Type y) { -- cgit