aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2017-06-08 10:56:16 +0100
committerYann Herklotz <ymherklotz@gmail.com>2017-06-08 10:56:16 +0100
commitc4dae2de0452d7b26918b65796a8d592f069bab1 (patch)
treed9f03c02a53a025a27e5270d788deb26258fbc43 /include
parenta35b68330f17b08d67174e6fc57099bc78d47400 (diff)
downloadYAGE-c4dae2de0452d7b26918b65796a8d592f069bab1.tar.gz
YAGE-c4dae2de0452d7b26918b65796a8d592f069bab1.zip
Continuing the matrix class
Diffstat (limited to 'include')
-rw-r--r--include/YAGE/Math/matrix.hpp38
1 files changed, 37 insertions, 1 deletions
diff --git a/include/YAGE/Math/matrix.hpp b/include/YAGE/Math/matrix.hpp
index 889db336..3b18be0b 100644
--- a/include/YAGE/Math/matrix.hpp
+++ b/include/YAGE/Math/matrix.hpp
@@ -47,6 +47,16 @@ protected:
public:
Matrix<Rows, Cols, Type>() : data_(Rows*Cols) {}
+ int rowSize()
+ {
+ return Rows;
+ }
+
+ int colSize()
+ {
+ return Cols;
+ }
+
detail::Row<Rows, Cols, Type> operator[](int row)
{
return detail::Row<Rows, Cols, Type>(this, row);
@@ -127,6 +137,10 @@ template<int Rows=2, class Type=double> class Vector : public Matrix<Rows, 1, Ty
{
public:
Vector<Rows, Type>() : Matrix<Rows, 1, Type>() {}
+ explicit Vector<Rows, Type>(const Matrix<Rows, 1, Type> &other)
+ {
+ this->data_=other.data_;
+ }
Type& operator[](int col)
{
@@ -172,6 +186,21 @@ typedef Vector2<double> Vector2d;
namespace matrix
{
+template<int M, int N, class T> Matrix<N, M, T> transpose(const Matrix<M, N, T> &m)
+{
+ static_assert(M!=1, "Called wrong transpose");
+}
+
+template<int N, class T> Vector<N, T> transpose(const Matrix<1, N, T> &m)
+{
+
+}
+
+template<int R, class T> T dot(const Vector<R, T> &v1, const Vector<R, T> &v2)
+{
+
+}
+
template<int M, int N, int P, int Q, class T>
Matrix<M, Q, T> multiply(const Matrix<M, N, T> &m1, const Matrix<P, Q, T> &m2)
{
@@ -182,7 +211,14 @@ Matrix<M, Q, T> multiply(const Matrix<M, N, T> &m1, const Matrix<P, Q, T> &m2)
Matrix<M, Q, T> res;
-
+ for(int i=0; i<M; ++i)
+ {
+ for(int j=0; j<Q; ++j)
+ {
+ int sum=0;
+
+ }
+ }
return res;
}