16 MatrixTestPacket(std::string _matrixFile,
bool _unsymmetric,
double _maxFwdError,
double _maxError,
double _maxResid)
25 int main(
int argc,
char* argv[])
33 bool result, success =
true;
38 out = Teuchos::VerboseObjectBase::getDefaultOStream();
46 std::string matrixDir =
".";
47 bool testTranspose =
true;
48 int numRandomVectors = 1;
50 bool showAllTestsDetails =
false;
53 CommandLineProcessor clp;
54 clp.throwExceptions(
false);
55 clp.addOutputSetupOptions(
true);
56 clp.setOption(
"matrix-dir", &matrixDir,
"Base directory for the test matrices" );
57 clp.setOption(
"test-transpose",
"no-test-transpose", &testTranspose,
"Test the transpose solve or not." );
58 clp.setOption(
"num-random-vectors", &numRandomVectors,
"Number of times a test is performed with different random vectors." );
59 clp.setOption(
"verbose",
"quiet", &verbose,
"Set if output is printed or not." );
60 clp.setOption(
"show-all-tests",
"no-show-all-tests", &showAllTests,
"Set if all the tests are shown or not." );
61 clp.setOption(
"show-all-tests-details",
"no-show-all-tests-details", &showAllTestsDetails,
"Set if all the details of the tests are shown or not." );
62 clp.setOption(
"dump-all",
"no-dump-all", &dumpAll,
"Determines if vectors are printed or not." );
63 CommandLineProcessor::EParseCommandLineReturn parse_return = clp.parse(argc,argv);
64 if( parse_return != CommandLineProcessor::PARSE_SUCCESSFUL )
return parse_return;
72 const int numTestMatrices = 9;
78 const MTP testMatrices[numTestMatrices] =
80 MTP(
"bcsstk01.mtx",
false,1e-12,1e-12,1e-12)
81 ,MTP(
"bcsstk02.mtx",
false,1e-12,1e-12,1e-12)
82 ,MTP(
"bcsstk04.mtx",
false,1e-12,1e-10,1e-12)
83 ,MTP(
"Diagonal.mtx",
false,1e-12,1e-12,1e-12)
84 ,MTP(
"FourByFour.mtx",
true,1e-12,1e-12,1e-12)
85 ,MTP(
"KheadK.mtx",
false,1e-12,1e-12,1e-12)
86 ,MTP(
"KheadSorted.mtx",
false,1e-12,1e-12,1e-12)
87 ,MTP(
"nos1.mtx",
false,1e-11,1e-10,1e-12)
88 ,MTP(
"nos5.mtx",
false,1e-12,1e-12,1e-12)
93 for(
int matrix_i = 0; matrix_i < numTestMatrices; ++matrix_i ) {
95 mtp = testMatrices[matrix_i];
107 bool BadMatrixForSuperlu =
121 << std::endl<<matrix_i<<
"."<<solver_i<<
"."<<factorizationPolicy_i<<
": "
122 <<
"Testing, matrixFile=\'"<<mtp.
matrixFile<<
"\', solverType=\'"<<
toString(solverType)<<
"\', refactorizationPolicy=\'"<<
toString(refactorizationPolicy)<<
"\' ...";
124 *out <<
" : Skipping since unsymmetric and not supported!\n";
128 std::string StrSolverType =
toString(solverType) ;
129 std::string StrSuperlu =
"Superlu";
130 if ( StrSolverType==StrSuperlu && BadMatrixForSuperlu ) {
131 *out <<
" : Skipping since Superlu fails on this matrix!\n";
134 std::ostringstream ossStore;
138 amesosLOWSFPL.
set(
"Solver Type",
toString(solverType));
139 amesosLOWSFPL.
set(
"Refactorization Policy",
toString(refactorizationPolicy));
141 Thyra::test_single_amesos_thyra_solver(
142 matrixDir+
"/"+mtp.
matrixFile,&amesosLOWSFPL,testTranspose,numRandomVectors
145 if(!result) success =
false;
149 *out << std::endl << ossStore.str();
151 *out <<
" : passed!\n";
155 *out << std::endl << ossStore.str();
157 *out <<
" : failed!\n";
167 catch(
const std::exception &excpt ) {
168 std::cerr <<
"*** Caught standard exception : " << excpt.what() << std::endl;
172 std::cerr <<
"*** Caught an unknown exception\n";
177 if(success) *out <<
"\nCongratulations! All of the tests checked out!\n";
178 else *out <<
"\nOh no! At least one of the tests failed!\n";
181 return ( success ? 0 : 1 );
ERefactorizationPolicy
The policy used on refactoring a matrix.
int main(int argc, char *argv[])
const std::string toString(const EAdjointEpetraOp adjointEpetraOp)
ParameterList & set(std::string const &name, T &&value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
MatrixTestPacket(std::string _matrixFile, bool _unsymmetric, double _maxFwdError, double _maxError, double _maxResid)
basic_OSTab< char > OSTab
const ERefactorizationPolicy refactorizationPolicyValues[numRefactorizationPolices]
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
const int numRefactorizationPolices
const ESolverType solverTypeValues[numSolverTypes]
const bool supportsUnsymmetric[numSolverTypes]
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)