5 cout<<
" \nbenchsolver : performs a benchmark of all the solvers available in Eigen \n\n";
6 cout<<
" MATRIX FOLDER : \n";
7 cout<<
" The matrices for the benchmark should be collected in a folder specified with an environment variable EIGEN_MATRIXDIR \n";
8 cout<<
" The matrices are stored using the matrix market coordinate format \n";
9 cout<<
" The matrix and associated right-hand side (rhs) files are named respectively \n";
10 cout<<
" as MatrixName.mtx and MatrixName_b.mtx. If the rhs does not exist, a random one is generated. \n";
11 cout<<
" If a matrix is SPD, the matrix should be named as MatrixName_SPD.mtx \n";
12 cout<<
" If a true solution exists, it should be named as MatrixName_x.mtx; \n" ;
13 cout<<
" it will be used to compute the norm of the error relative to the computed solutions\n\n";
14 cout<<
" OPTIONS : \n";
15 cout<<
" -h or --help \n print this help and return\n\n";
16 cout<<
" -d matrixdir \n Use matrixdir as the matrix folder instead of the one specified in the environment variable EIGEN_MATRIXDIR\n\n";
17 cout<<
" -o outputfile.xml \n Output the statistics to a xml file \n\n";
18 cout<<
" --eps <RelErr> Sets the relative tolerance for iterative solvers (default 1e-08) \n\n";
19 cout<<
" --maxits <MaxIts> Sets the maximum number of iterations (default 1000) \n\n";
35 if(getenv(
"EIGEN_MATRIXDIR") ==
NULL){
36 std::cerr <<
"Please, specify the location of the matrices with -d mat_folder or the environment variable EIGEN_MATRIXDIR \n";
37 std::cerr <<
" Run with --help to see the list of all the available options \n";
40 matrix_dir = getenv(
"EIGEN_MATRIXDIR");
43 std::ofstream statbuf;
47 bool statFileExists =
get_options(argc, args,
"-o", &statFile);
52 statFileExists =
true;
57 std::cerr <<
"Unable to open the provided file for writing... \n";
65 tol = atof(inval.c_str());
67 maxiters = atoi(inval.c_str());
71 Browse_Matrices<double>(matrix_dir, statFileExists, statFile,maxiters,
tol);
74 Browse_Matrices<std::complex<double> >(matrix_dir, statFileExists, statFile, maxiters,
tol);
78 statbuf.open(statFile.c_str(), std::ios::app);
79 statbuf <<
"</BENCH> \n";
80 cout <<
"\n Output written in " << statFile <<
" ...\n";
void printStatheader(std::ofstream &out)
std::ofstream out("Result.txt")
bool get_options(int argc, char **args, string option, string *value=0)
Array< double, 1, 3 > e(1./3., 0.5, 2.)
int main(int argc, char **args)