9 unsigned int nThreads = std::thread::hardware_concurrency();
10 std::cout << nThreads <<
" concurrent threads are supported.\n";
12 std::cout <<
"2 x 2 Matrix\n" << std::endl;
19 std::cout <<
" myMat\n" << myMat.
toString();
21 auto startTime = std::chrono::high_resolution_clock::now();
23 auto endTime = std::chrono::high_resolution_clock::now();
24 auto timeTaken = std::chrono::duration_cast<std::chrono::milliseconds>(endTime -
28 std::cout << timeTaken <<
"ms" << std::endl << lu.toString();
30 std::cout <<
"4 x 4 Matrix\n" << std::endl;
74 std::cout <<
" myMat\n" << myCMat4.
toString();
76 auto luC4 = myCMat4.
luPair();
77 auto lu4 = myMat4.
luPair();
78 std::cout << lu4.toString();
79 std::cout << luC4.toString();
81 startTime = std::chrono::high_resolution_clock::now();
82 for (
unsigned int i = 0;
i < 1000000 ;
i++) {
85 endTime = std::chrono::high_resolution_clock::now();
86 timeTaken = std::chrono::duration_cast<std::chrono::milliseconds>(endTime -
89 std::cout << 1000000 <<
" 4 x 4 pairs in " << timeTaken <<
"ms" << std::endl;
92 std::cout << solved.toString();
95 for (
size_t i = 0;
i < 1000;
i++) {
96 myMat1000(
i, 1000 - 1 -
i) =
i + 10;
98 startTime = std::chrono::high_resolution_clock::now();
99 auto lu1000 = myMat1000.
luPair();
100 endTime = std::chrono::high_resolution_clock::now();
101 timeTaken = std::chrono::duration_cast<std::chrono::milliseconds>(endTime -
104 std::cout <<
"1000 x 1000 LU comp in " << timeTaken <<
"ms" << std::endl;
A matrix class with support for LU-decomposition, and left division.
std::string toString() const
Matrix< T > leftDivide(const Matrix< T > &rhs) const
LUPair< T > luPair() const