diff options
author | Nao Pross <naopross@thearcway.org> | 2019-02-23 16:42:19 +0100 |
---|---|---|
committer | Nao Pross <naopross@thearcway.org> | 2019-02-23 16:42:19 +0100 |
commit | a9828ad7c2b73527bcb4b28e49193e4523f21ad5 (patch) | |
tree | 819c053b9575d1b4e6a91f99f3a5b8ffdee9f0ee /test | |
parent | Add initializer_list constructor to basic_matrix and matrix test (diff) | |
download | libmm-a9828ad7c2b73527bcb4b28e49193e4523f21ad5.tar.gz libmm-a9828ad7c2b73527bcb4b28e49193e4523f21ad5.zip |
Change storage for matrix to std::array, update matrix_example
Diffstat (limited to 'test')
-rw-r--r-- | test/matrix_example.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/test/matrix_example.cpp b/test/matrix_example.cpp index 3fb7c78..4cf1863 100644 --- a/test/matrix_example.cpp +++ b/test/matrix_example.cpp @@ -5,9 +5,21 @@ int main(int argc, char *argv[]) { std::cout << "MxN dimensional (int) matrices" << std::endl; - mm::matrix<int, 3, 2> m {{1, 2}, {3, 4}, {5, 6}}; + mm::matrix<int, 3, 2> a {{1, 2}, {3, 4}, {5, 6}}; + mm::matrix<int, 3, 2> b {{4, 3}, {9, 1}, {2, 5}}; + mm::matrix<int, 2, 4> c {{1, 2, 3, 4}, {5, 6, 7, 8}}; - std::cout << m; + std::cout << "a = \n" << a; + std::cout << "b = \n" << b; + std::cout << "c = \n" << c; + + // basic operations + std::cout << "a + b = \n" << a + b; + std::cout << "a - b = \n" << a - b; + std::cout << "a * c = \n" << a * c; + std::cout << "a * 2 = \n" << a * 2; + std::cout << "2 * a = \n" << 2 * a; + std::cout << "tr(a) = \n" << a.trd(); return 0; } |