矩阵求逆的QR分解与普通求逆的时间效率测试

#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");

猜你喜欢

转载自blog.csdn.net/guanxunmeng8928/article/details/111759612
今日推荐