aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/README.md2
-rw-r--r--docs/matrix.dox33
-rw-r--r--include/YAGE/Math/matrix.hpp9
-rw-r--r--test/matrixtest.cpp17
4 files changed, 41 insertions, 20 deletions
diff --git a/docs/README.md b/docs/README.md
index ce85d85f..f39d0f8e 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -1,4 +1,4 @@
Documentation
-================
+=============
Visit this [page](https://www.yannherklotz.com/YAGE) for the documentation.
diff --git a/docs/matrix.dox b/docs/matrix.dox
new file mode 100644
index 00000000..c1c99dde
--- /dev/null
+++ b/docs/matrix.dox
@@ -0,0 +1,33 @@
+/** @class yage::Matrix
+
+%Matrix Class
+============
+
+The matrix class is a templated class which implements a mathematical %Matrix.
+
+
+Usage Guide
+-----------
+
+The class can be instantiated
+
+
+Example Code
+------------
+
+Creating a %Matrix and performing operations on it.
+
+```
+#include <YAGE/Math/matrix.hpp>
+
+int main(int, char **)
+{
+ yage::Matrix<2, 2, int> mat1 {{1, 2, 3, 4}};
+ yage::Matrix<2, 2, int> mat2 {{5, 6, 7, 8}};
+
+ int dot = yage::math::dot(mat1, mat2);
+ return 0;
+}
+```
+
+*/
diff --git a/include/YAGE/Math/matrix.hpp b/include/YAGE/Math/matrix.hpp
index fc81fa34..5d9e5d0f 100644
--- a/include/YAGE/Math/matrix.hpp
+++ b/include/YAGE/Math/matrix.hpp
@@ -57,7 +57,7 @@ public:
Type &operator[](int col)
{
- // the index is the y-position of the element in the matrix
+ // The index is the y-position of the element in the matrix
return parent_->data_[index_ * Cols + col];
}
@@ -70,12 +70,6 @@ public:
} // namespace detail
/** Base Matrix class used by other similar classes.
- *
- * Matrix class
- * ============
- *
- * This is the base matrix class that can be used by all the other matrix
- * like data structures.
*/
template <int Rows = 4, int Cols = 4, class Type = double>
class Matrix
@@ -170,7 +164,6 @@ public:
detail::Row<Rows, Cols, Type> operator[](int row) const
{
- /// @todo got to fix this
return detail::Row<Rows, Cols, Type>((Matrix<Rows, Cols, Type> *)this,
row);
}
diff --git a/test/matrixtest.cpp b/test/matrixtest.cpp
index bbcbb440..c969f39f 100644
--- a/test/matrixtest.cpp
+++ b/test/matrixtest.cpp
@@ -16,15 +16,6 @@
#include "gtest/gtest.h"
template <int Size>
-int matrixAssign(int number, int i, int j)
-{
- yage::Matrix<Size, Size, int> m;
- m[j][i] = number;
-
- return m[j][i];
-}
-
-template <int Size>
int matrixAddition(int num1, int num2)
{
yage::Matrix<Size, Size, int> m1, m2;
@@ -56,8 +47,12 @@ bool matrixMultiplication()
TEST(Matrix, Assign)
{
- int rand_num = rand();
- ASSERT_EQ(rand_num, matrixAssign<10>(rand_num, 4, 2));
+ double rand_num = rand();
+ yage::Matrix<5, 5, double> mat1;
+ mat1[3][2] = rand_num;
+ ASSERT_EQ(rand_num, mat1[3][2]);
+ yage::Matrix<2, 2, double> mat2 {{rand_num, rand_num, rand_num, rand_num}};
+ ASSERT_EQ(rand_num, mat2[1][0]);
}
TEST(Matrix, Addition)