28 bool RowMapEqualsColMap,
29 bool TestAddZeroToDiag,
32 double &maxrelresidual,
35 bool MyVerbose = false ;
51 if ( MyVerbose ) std::cout << __FILE__ <<
"::" << __LINE__
52 <<
" InternalParamList = " <<
53 InternalParamList << std::endl ;
69 if ( Amat->
Comm().
MyPID() == 0 && Errors ) {
70 std::cout << __FILE__ <<
"::" << __LINE__
71 <<
"Amesos_Klu failed with error code " << Errors<< std::endl ;
79 maxrelerror =
EPETRA_MAX( relerror, maxrelerror ) ;
80 maxrelresidual =
EPETRA_MAX( relresidual, maxrelresidual ) ;
84 if (MyVerbose) std::cout <<
" TestKlu NumErrors = "
86 << __FILE__ <<
"::" << __LINE__
88 if ( Amat->
Comm().
MyPID() == 0 && Errors > 0 ) {
89 std::cout <<
"Amesos_Klu"
90 << __FILE__ <<
"::" << __LINE__
91 <<
" Errors = " << Errors
92 <<
" failed with transpose = " <<
93 (transpose?
"true":
"false") << std::endl ;
102 InternalParamList.
set(
"Refactorize",
true );
106 if ( MyVerbose ) std::cout << __FILE__ <<
"::" << __LINE__
107 <<
" InternalParamList = " <<
108 InternalParamList << std::endl ;
123 if ( Amat->
Comm().
MyPID() == 0 && Errors ) {
124 std::cout << __FILE__ <<
"::" << __LINE__
125 <<
"Amesos_Klu failed with error code " << Errors<< std::endl ;
131 NumErrors += Errors ;
133 maxrelerror =
EPETRA_MAX( relerror, maxrelerror ) ;
134 maxrelresidual =
EPETRA_MAX( relresidual, maxrelresidual ) ;
138 if (MyVerbose) std::cout <<
" TestKlu NumErrors = "
140 << __FILE__ <<
"::" << __LINE__
142 if ( Amat->
Comm().
MyPID() == 0 && Errors > 0 ) {
143 std::cout <<
"Amesos_Klu"
144 << __FILE__ <<
"::" << __LINE__
145 <<
" Errors = " << Errors
146 <<
" failed with transpose = " <<
147 (transpose?
"true":
"false") << std::endl ;
154 bool ReIndex = ParamList.
get(
"Reindex",
false );
155 bool DontTrustMe = ParamList.
get(
"DontTrustMe",
false );
156 if ( EpetraMatrixType == 2 && ! ReIndex && ! DontTrustMe ) {
159 InternalParamList.
set(
"TrustMe",
true );
161 if ( MyVerbose ) std::cout << __FILE__ <<
"::" << __LINE__
162 <<
" InternalParamList = " <<
163 InternalParamList << std::endl ;
182 if ( Amat->
Comm().
MyPID() == 0 && Errors ) {
183 std::cout << __FILE__ <<
"::" << __LINE__
184 <<
"Amesos_Klu failed with error code " << Errors<< std::endl ;
190 NumErrors += Errors ;
192 maxrelerror =
EPETRA_MAX( relerror, maxrelerror ) ;
193 maxrelresidual =
EPETRA_MAX( relresidual, maxrelresidual ) ;
197 if (MyVerbose) std::cout <<
" TestKlu NumErrors = "
199 << __FILE__ <<
"::" << __LINE__
201 if ( Amat->
Comm().
MyPID() == 0 && Errors > 0 ) {
202 std::cout <<
"Amesos_Klu"
203 << __FILE__ <<
"::" << __LINE__
204 <<
" Errors = " << Errors
205 <<
" failed with transpose = " <<
206 (transpose?
"true":
"false") << std::endl ;
211 if ( ExpectedError == 0 ) {
214 if (RowMapEqualsColMap ) {
216 InternalParamList.
set(
"Refactorize",
true );
218 InternalParamList.
set(
"AddToDiag", 1e2 );
223 if ( MyVerbose ) std::cout << __FILE__ <<
"::" << __LINE__
224 <<
" InternalParamList = " <<
225 InternalParamList << std::endl ;
241 if ( Amat->
Comm().
MyPID() == 0 && Errors ) {
242 std::cout << __FILE__ <<
"::" << __LINE__
243 <<
"Amesos_Klu failed with error code " << Errors<< std::endl ;
249 NumErrors += Errors ;
251 maxrelerror =
EPETRA_MAX( relerror, maxrelerror ) ;
252 maxrelresidual =
EPETRA_MAX( relresidual, maxrelresidual ) ;
256 if (MyVerbose) std::cout <<
" TestKlu NumErrors = "
258 << __FILE__ <<
"::" << __LINE__
260 if ( Comm.
MyPID() == 0 && Errors > 0 ) {
261 std::cout <<
"Amesos_Klu"
262 << __FILE__ <<
"::" << __LINE__
263 <<
" Errors = " << Errors
264 <<
" failed with transpose = " <<
265 (transpose?
"true":
"false") << std::endl ;
271 if (RowMapEqualsColMap && TestAddZeroToDiag ) {
273 InternalParamList.
set(
"Refactorize",
true );
274 InternalParamList.
set(
"AddZeroToDiag",
true );
275 InternalParamList.
set(
"AddToDiag", 1e2 );
280 if ( MyVerbose ) std::cout << __FILE__ <<
"::" << __LINE__
281 <<
" InternalParamList = " <<
282 InternalParamList << std::endl ;
297 if ( Amat->
Comm().
MyPID() == 0 && Errors ) {
298 std::cout << __FILE__ <<
"::" << __LINE__
299 <<
"Amesos_Klu failed with error code " << Errors<< std::endl ;
305 NumErrors += Errors ;
307 maxrelerror =
EPETRA_MAX( relerror, maxrelerror ) ;
308 maxrelresidual =
EPETRA_MAX( relresidual, maxrelresidual ) ;
312 if (MyVerbose) std::cout <<
" TestKlu NumErrors = "
314 << __FILE__ <<
"::" << __LINE__
316 if ( Comm.
MyPID() == 0 && Errors > 0 ) {
317 std::cout <<
"Amesos_Klu"
318 << __FILE__ <<
"::" << __LINE__
319 <<
" Errors = " << Errors
320 <<
" failed with transpose = " <<
321 (transpose?
"true":
"false") << std::endl ;
327 if (RowMapEqualsColMap ) {
329 InternalParamList.
set(
"Refactorize",
true );
330 InternalParamList.
set(
"AddZeroToDiag",
true );
335 if ( MyVerbose ) std::cout << __FILE__ <<
"::" << __LINE__
336 <<
" InternalParamList = " <<
337 InternalParamList << std::endl ;
352 if ( Amat->
Comm().
MyPID() == 0 && Errors ) {
353 std::cout << __FILE__ <<
"::" << __LINE__
354 <<
"Amesos_Klu failed with error code " << Errors<< std::endl ;
360 NumErrors += Errors ;
362 maxrelerror =
EPETRA_MAX( relerror, maxrelerror ) ;
363 maxrelresidual =
EPETRA_MAX( relresidual, maxrelresidual ) ;
367 if (MyVerbose) std::cout <<
" TestKlu NumErrors = "
369 << __FILE__ <<
"::" << __LINE__
371 if ( Comm.
MyPID() == 0 && Errors > 0 ) {
372 std::cout <<
"Amesos_Klu"
373 << __FILE__ <<
"::" << __LINE__
374 <<
" Errors = " << Errors
375 <<
" failed with transpose = " <<
376 (transpose?
"true":
"false") << std::endl ;
401 if (MyVerbose ) std::cout <<
"Amesos_Klu" <<
" not built in this executable " << std::endl ;
404 NumErrors += Errors ;
406 maxrelerror =
EPETRA_MAX( relerror, maxrelerror ) ;
407 maxrelresidual =
EPETRA_MAX( relresidual, maxrelresidual ) ;
411 if (MyVerbose) std::cout <<
" TestKlu NumErrors = "
413 << __FILE__ <<
"::" << __LINE__
415 if ( MyVerbose && Errors > 0 ) {
416 std::cout <<
"Amesos_Klu" <<
" failed with transpose = " <<
417 (transpose?
"true":
"false") << std::endl ;
428 ParamList.
set(
"ComputeTrueResidual",
true );
450 if (MyVerbose ) std::cout <<
"Amesos_Klu" <<
" not built in this executable " << std::endl ;
453 NumErrors += Errors ;
455 maxrelerror =
EPETRA_MAX( relerror, maxrelerror ) ;
456 maxrelresidual =
EPETRA_MAX( relresidual, maxrelresidual ) ;
460 if (MyVerbose) std::cout <<
" TestKlu NumErrors = " << NumErrors
461 <<
" " << __FILE__ <<
"::" << __LINE__ << std::endl ;
462 if ( MyVerbose && Errors > 0 ) {
463 std::cout <<
"Amesos_Klu" <<
" failed with transpose = " <<
464 (transpose?
"true":
"false") << std::endl ;
T & get(ParameterList &l, const std::string &name)
ParameterList & set(std::string const &name, T &&value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
virtual int MyPID() const =0
int TestKlu(Epetra_CrsMatrix *&Amat, int EpetraMatrixType, const bool transpose, const bool verbose, const int Levels, const double Rcond, Teuchos::ParameterList ParamList, bool RowMapEqualsColMap, bool TestAddZeroToDiag, int ExpectedError, double &maxrelerror, double &maxrelresidual, int &NumTests)
const Epetra_Comm & Comm() const