diff options
author | ancarola <raffaele.ancarola@epfl.ch> | 2019-07-01 00:00:56 +0200 |
---|---|---|
committer | ancarola <raffaele.ancarola@epfl.ch> | 2019-07-01 00:00:56 +0200 |
commit | 289b76e4a2177e320fe906fdbbbe3b20a2f11942 (patch) | |
tree | 45b0ea9ebd1fbcf89a3e953a288a4e6ba76550ca /test | |
parent | Optimized matrix section (diff) | |
download | libmm-289b76e4a2177e320fe906fdbbbe3b20a2f11942.tar.gz libmm-289b76e4a2177e320fe906fdbbbe3b20a2f11942.zip |
The matrix library is compiling and all tested operations work fine.
Next goals:
- Implement optimisations for multiplication in K-diagonal
- Add adjoint operation for complex matrices
- Determinant
- Algorithms: Gauss Jordan
Diffstat (limited to 'test')
-rw-r--r-- | test/matrix_example.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/test/matrix_example.cpp b/test/matrix_example.cpp index 291feab..a835ee0 100644 --- a/test/matrix_example.cpp +++ b/test/matrix_example.cpp @@ -8,10 +8,12 @@ int main(int argc, char *argv[]) { 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}}; + auto ct = c.t(); std::cout << "a = \n" << a; std::cout << "b = \n" << b; std::cout << "c = \n" << c; + std::cout << "c^t = \n" << ct; std::cout << std::endl; // access elements @@ -20,7 +22,6 @@ int main(int argc, char *argv[]) { std::cout << "a[2][0] = " << a[2][0] << std::endl;; std::cout << std::endl; - /* // basic operations std::cout << "Basic operations" << std::endl; std::cout << "a + b = \n" << a + b; @@ -28,18 +29,18 @@ int main(int argc, char *argv[]) { std::cout << "a * c = \n" << a * c; std::cout << "a * 2 = \n" << a * 2; std::cout << "2 * a = \n" << 2 * a; - std::cout << "a.td() = \n" << a.td(); // or a.trasposed(); - std::cout << std::endl;*/ + std::cout << "a.td() = \n" << a.t(); // or a.trasposed(); + std::cout << std::endl; // special matrices - /*mm::square_matrix<std::complex<int>, 2> f {{{2, 3}, {1, 4}}, {{6, 1}, {-3, 4}}}; + mm::square_matrix<std::complex<int>, 2> f {{{2, 3}, {1, 4}}, {{6, 1}, {-3, 4}}}; std::cout << "Square matrix" << std::endl; std::cout << "f = \n" << f; std::cout << "tr(f) = " << f.tr(); //or f.trace() << std::endl; - mm::t_square_matrix<std::complex<int>, 2>& ft = f.t(); + auto ft = f.t(); std::cout << "after in place transpose f.t(), f = \n" << ft; std::cout << std::endl; @@ -47,8 +48,7 @@ int main(int argc, char *argv[]) { std::cout << "Identity matrix" << std::endl; std::cout << "I = \n" << identity; - std::cout << std::endl; */ - + std::cout << std::endl; return 0; } |