#include #include // timing #include // sqrt() #include // atoi() #include // strncmp() #include #include #include #include #include #include "timing.h" #include "benchmark.h" using namespace std; using namespace std::chrono; // timing int main() { unsigned int n= 32; vector M(n*n,4.0); for(unsigned int i=0; i M2 = M; vector ipiv(n); //pivots LAPACKE_dgetrf(LAPACK_ROW_MAJOR,n,n, M.data(),n,ipiv.data()); //M=PLU double time; unsigned int nhrsmax = 1000000; for(unsigned int i=nhrsmax/10; i < nhrsmax;i+=nhrsmax/10) { unsigned int nhrs = i; //FOR CHECKING vector X(n*nhrs,1.0); vector b = benchmark_C(M2,X,n); tic(); LAPACKE_dgetrs(LAPACK_ROW_MAJOR,'N',n,nhrs,M.data(),n,ipiv.data(),b.data(),nhrs); time = toc(); cout << "Time for nhrs=" << nhrs << ": " << time << endl; double max_err = 0.0; for (unsigned int j = 0; j < n * nhrs; j++) { double err = b[j] - X[j]; err *= err; if (err > max_err) max_err = err; } cout <<"max err^2:" << max_err <