// This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2012 Désiré Nuentsa-Wakam <desire.nuentsa_wakam@inria.fr> // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Global variables for input parameters int MaximumIters; // Maximum number of iterations double RelErr; // Relative error of the computed solution double best_time_val; // Current best time overall solvers int best_time_id; // id of the best solver for the current system
void printStatheader(std::ofstream& out)
{ // Print XML header // NOTE It would have been much easier to write these XML documents using external libraries like tinyXML or Xerces-C++.
out << " \n";
out << " \n";
out << "\n]>";
out << "\n\n\n";
out << "\n \n" ; //root XML element // Print the xsl style section
printBenchStyle(out); // List all available solvers
out << " \n"; #ifdef EIGEN_UMFPACK_SUPPORT
out <<" "'>\n";
out << " LU \n";
out << " UMFPACK \n";
out << " \n"; #endif #ifdef EIGEN_KLU_SUPPORT
out <<" "'>\n";
out << " LU \n";
out << " KLU \n";
out << " \n"; #endif #ifdef EIGEN_SUPERLU_SUPPORT
out <<" "'>\n";
out << " LU \n";
out << " SUPERLU \n";
out << " \n"; #endif #ifdef EIGEN_CHOLMOD_SUPPORT
out <<" "'>\n";
out << " LLT SP \n";
out << " CHOLMOD \n";
out << " \n";
out <<" "'>\n";
out << " LLT \n";
out << " CHOLMOD \n";
out << " \n";
out <<" "'>\n";
out << " LDLT \n";
out << " CHOLMOD \n";
out << " \n"; #endif #ifdef EIGEN_PARDISO_SUPPORT
out <<" "'>\n";
out << " LU \n";
out << " PARDISO \n";
out << " \n";
out <<" "'>\n";
out << " LLT \n";
out << " PARDISO \n";
out << " \n";
out <<" "'>\n";
out << " LDLT \n";
out << " PARDISO \n";
out << " \n"; #endif #ifdef EIGEN_PASTIX_SUPPORT
out <<" "'>\n";
out << " LU \n";
out << " PASTIX \n";
out << " \n";
out <<" "'>\n";
out << " LLT \n";
out << " PASTIX \n";
out << " \n";
out <<" "'>\n";
out << " LDLT \n";
out << " PASTIX \n";
out << " \n"; #endif
out <<" "'>\n";
out << " BICGSTAB \n";
out << " EIGEN \n";
out << " \n";
out <<" "'>\n";
out << " BICGSTAB_ILUT \n";
out << " EIGEN \n";
out << " \n";
out <<" "'>\n";
out << " GMRES_ILUT \n";
out << " EIGEN \n";
out << " \n";
out <<" "'>\n";
out << " LDLT \n";
out << " EIGEN \n";
out << " \n";
out <<" "'>\n";
out << " LLT \n";
out << " EIGEN \n";
out << " \n";
out <<" "'>\n";
out << " CG \n";
out << " EIGEN \n";
out << " \n";
out <<" "'>\n";
out << " LU_COLAMD \n";
out << " EIGEN \n";
out << " \n";
#ifdef EIGEN_METIS_SUPPORT
out <<" "'>\n";
out << " LU_METIS \n";
out << " EIGEN \n";
out << " \n"; #endif
out << " \n";
// Internal CG
{
cout << "\nSolving with CG ... \n";
ConjugateGradient<SpMat, Lower> solver;
call_itersolver(solver,EIGEN_CG, A, b, refX,statFile);
} //CG+IdentityPreconditioner // { // cout << "\nSolving with CG and IdentityPreconditioner ... \n"; // ConjugateGradient<SpMat, Lower, IdentityPreconditioner> solver; // call_itersolver(solver,EIGEN_CG_PRECOND, A, b, refX,statFile); // }
} // End SPD matrices
}
/* Browse all the matrices available in the specified folder * and solve the associated linear system. * The results of each solve are printed in the standard output * and optionally in the provided html file
*/ template <typename Scalar> void Browse_Matrices(const string folder, bool statFileExists, std::string& statFile, int maxiters, double tol)
{
MaximumIters = maxiters; // Maximum number of iterations, global variable
RelErr = tol; //Relative residual error as stopping criterion for iterative solvers
MatrixMarketIterator<Scalar> it(folder); for ( ; it; ++it)
{ //print the infos for this linear system if(statFileExists)
{
std::ofstream statbuf(statFile.c_str(), std::ios::app);
statbuf << " \n";
statbuf << " \n";
statbuf << " " << it.matname() << " \n";
statbuf << " " << it.matrix().rows() << " \n";
statbuf << " " << it.matrix().nonZeros() << "\n"; if (it.sym()!=NonSymmetric)
{
statbuf << " Symmetric \n" ; if (it.sym() == SPD)
statbuf << " YES \n"; else
statbuf << " NO \n";
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.