#define MATRIX_SIZE 50
clock_t time_stt = clock();
Eigen::Matrix<double, MATRIX_SIZE, 1>x = matrix_NN.inverse()*v_Nd;
cout << "time use in normal inverse is " << 1000 * (clock() - time_stt) / (double)CLOCKS_PER_SEC << "ms" << endl;
//奇了怪了,我是QR比较慢!!!!!!!
time_stt = clock();
x = matrix_NN.colPivHouseholderQr().solve(v_Nd);
cout << "time use in QRsolve is " << 1000 * (clock() - time_stt) / (double)CLOCKS_PER_SEC << "ms" << endl;
system("pause");
矩阵求逆的QR分解与普通求逆的时间效率测试
最新推荐文章于 2024-03-27 22:53:54 发布