brain:testmatrix.cpp
#ifndef __SW_TEST_MATRIX_H__ #define __SW_TEST_MATRIX_H__ /* This will test functions from file.h and file.cpp. */ // uncomment to disable assert() // #define NDEBUG #include <cassert> #include "matrix.h" //namespace SW { int testMatrix() { SW::Matrix<double> mat1(10, 10, 1.0); SW::Matrix<double> mat2(10, 10, 2.0); SW::Matrix<double> mat3 = mat1 + mat2; // Matrix M = (Matrix_<double>(3, 3) << 1, 0, 0, 0, 1, 0, 0, 0, 1); //SW::Matrix<double> mat3(3, 3); //mat3 << 1, 0, 0, 0, 1, 0, 0, 0, 1; //mat3 = 1, 0, 0, 0, 1, 0, 0, 0, 1; //mat3 = mat2; mat3.print(); /* for (int i = 0; i<mat3.get_rows(); i++) { for (int j = 0; j<mat3.get_cols(); j++) { std::cout << mat3(i, j) << ", "; } std::cout << std::endl; } */ //SW::Matrix<double> mat4(3, 3, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0); //mat4.print(); return 0; } //} // end namespace SW #endif
brain/testmatrix.cpp.txt · Last modified: 2020/07/15 09:30 by 127.0.0.1