这是代码:
int main()
{
time_t start,end,time;
MatrixXf M=MatrixXf::Random(50,50);
MatrixXf N=MatrixXf::Random(50,50);
start=clock();
MatrixXf S=M*N;
end=clock();
time=end-start;
cout<<"S=\n"<<S<<endl;
cout<<time<<"ms\n"<<endl;
}
矩阵大小 数据类型为float Eigen库运算时间 单位:ms
50*50 20
100*100 160
200*200 1260
300*300 4312
500*500 19665