50 MatrixTestPacket(std::string _matrixFile,
bool _unsymmetric,
double _maxFwdError,
double _maxError,
double _maxResid)
59 int main(
int argc,
char* argv[])
67 bool result, success =
true;
72 out = Teuchos::VerboseObjectBase::getDefaultOStream();
80 std::string matrixDir =
".";
81 bool testTranspose =
true;
82 int numRandomVectors = 1;
84 bool showAllTestsDetails =
false;
87 CommandLineProcessor clp;
88 clp.throwExceptions(
false);
89 clp.addOutputSetupOptions(
true);
90 clp.setOption(
"matrix-dir", &matrixDir,
"Base directory for the test matrices" );
91 clp.setOption(
"test-transpose",
"no-test-transpose", &testTranspose,
"Test the transpose solve or not." );
92 clp.setOption(
"num-random-vectors", &numRandomVectors,
"Number of times a test is performed with different random vectors." );
93 clp.setOption(
"verbose",
"quiet", &verbose,
"Set if output is printed or not." );
94 clp.setOption(
"show-all-tests",
"no-show-all-tests", &showAllTests,
"Set if all the tests are shown or not." );
95 clp.setOption(
"show-all-tests-details",
"no-show-all-tests-details", &showAllTestsDetails,
"Set if all the details of the tests are shown or not." );
96 clp.setOption(
"dump-all",
"no-dump-all", &dumpAll,
"Determines if vectors are printed or not." );
97 CommandLineProcessor::EParseCommandLineReturn parse_return = clp.parse(argc,argv);
98 if( parse_return != CommandLineProcessor::PARSE_SUCCESSFUL )
return parse_return;
106 const int numTestMatrices = 9;
112 const MTP testMatrices[numTestMatrices] =
114 MTP(
"bcsstk01.mtx",
false,1e-12,1e-12,1e-12)
115 ,MTP(
"bcsstk02.mtx",
false,1e-12,1e-12,1e-12)
116 ,MTP(
"bcsstk04.mtx",
false,1e-12,1e-10,1e-12)
117 ,MTP(
"Diagonal.mtx",
false,1e-12,1e-12,1e-12)
118 ,MTP(
"FourByFour.mtx",
true,1e-12,1e-12,1e-12)
119 ,MTP(
"KheadK.mtx",
false,1e-12,1e-12,1e-12)
120 ,MTP(
"KheadSorted.mtx",
false,1e-12,1e-12,1e-12)
121 ,MTP(
"nos1.mtx",
false,1e-11,1e-10,1e-12)
122 ,MTP(
"nos5.mtx",
false,1e-12,1e-12,1e-12)
127 for(
int matrix_i = 0; matrix_i < numTestMatrices; ++matrix_i ) {
129 mtp = testMatrices[matrix_i];
141 bool BadMatrixForSuperlu =
155 << std::endl<<matrix_i<<
"."<<solver_i<<
"."<<factorizationPolicy_i<<
": "
156 <<
"Testing, matrixFile=\'"<<mtp.
matrixFile<<
"\', solverType=\'"<<
toString(solverType)<<
"\', refactorizationPolicy=\'"<<
toString(refactorizationPolicy)<<
"\' ...";
158 *out <<
" : Skipping since unsymmetric and not supported!\n";
162 std::string StrSolverType =
toString(solverType) ;
163 std::string StrSuperlu =
"Superlu";
164 if ( StrSolverType==StrSuperlu && BadMatrixForSuperlu ) {
165 *out <<
" : Skipping since Superlu fails on this matrix!\n";
168 std::ostringstream ossStore;
172 amesosLOWSFPL.
set(
"Solver Type",
toString(solverType));
173 amesosLOWSFPL.
set(
"Refactorization Policy",
toString(refactorizationPolicy));
175 Thyra::test_single_amesos_thyra_solver(
176 matrixDir+
"/"+mtp.
matrixFile,&amesosLOWSFPL,testTranspose,numRandomVectors
179 if(!result) success =
false;
183 *out << std::endl << ossStore.str();
185 *out <<
" : passed!\n";
189 *out << std::endl << ossStore.str();
191 *out <<
" : failed!\n";
201 catch(
const std::exception &excpt ) {
202 std::cerr <<
"*** Caught standard exception : " << excpt.what() << std::endl;
206 std::cerr <<
"*** Caught an unknown exception\n";
211 if(success) *out <<
"\nCongratulations! All of the tests checked out!\n";
212 else *out <<
"\nOh no! At least one of the tests failed!\n";
215 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 const &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)