42 #ifndef THYRA_LINEAR_OP_TESTER_DEF_HPP
43 #define THYRA_LINEAR_OP_TESTER_DEF_HPP
45 #include "Thyra_LinearOpTester_decl.hpp"
46 #include "Thyra_LinearOpBase.hpp"
47 #include "Thyra_DefaultScaledAdjointLinearOp.hpp"
48 #include "Thyra_describeLinearOp.hpp"
49 #include "Thyra_VectorStdOps.hpp"
50 #include "Thyra_TestingTools.hpp"
51 #include "Thyra_UniversalMultiVectorRandomizer.hpp"
52 #include "Teuchos_TestingHelpers.hpp"
58 template<
class Scalar>
59 class SymmetricLinearOpTester {
62 static void checkSymmetry(
63 const LinearOpBase<Scalar> &op,
64 const Ptr<MultiVectorRandomizerBase<Scalar> > &dRand,
67 const int num_random_vectors,
70 const ScalarMag &symmetry_error_tol,
71 const ScalarMag &symmetry_warning_tol,
72 const Ptr<bool> &these_results
81 const Scalar half = Scalar(0.4)*ST::one();
82 RCP<const VectorSpaceBase<Scalar> > domain = op.domain();
84 testOut << endl <<
"op.domain()->isCompatible(*op.range()) == true : ";
85 result = op.domain()->isCompatible(*op.range());
86 if(!result) *these_results =
false;
92 << endl <<
"Checking that the operator is symmetric as:\n"
93 << endl <<
" <0.5*op*v2,v1> == <v2,0.5*op*v1>"
94 << endl <<
" \\_______/ \\_______/"
97 << endl <<
" <v4,v1> == <v2,v3>"
98 << endl << std::flush;
100 for(
int rand_vec_i = 1; rand_vec_i <= num_random_vectors; ++rand_vec_i ) {
102 testOut << endl <<
"Random vector tests = " << rand_vec_i << endl;
106 if(dump_all) testOut << endl <<
"v1 = randomize(-1,+1); ...\n" ;
107 RCP<MultiVectorBase<Scalar> > v1 = createMembers(domain,num_rhs);
108 dRand->randomize(v1.ptr());
109 if(dump_all) testOut << endl <<
"v1 =\n" << describe(*v1,verbLevel);
111 if(dump_all) testOut << endl <<
"v2 = randomize(-1,+1); ...\n" ;
112 RCP<MultiVectorBase<Scalar> > v2 = createMembers(domain,num_rhs);
113 dRand->randomize(v2.ptr());
114 if(dump_all) testOut << endl <<
"v2 =\n" << describe(*v2,verbLevel);
116 if(dump_all) testOut << endl <<
"v3 = 0.5*op*v1 ...\n" ;
117 RCP<MultiVectorBase<Scalar> > v3 = createMembers(domain,num_rhs);
118 apply( op,
NOTRANS, *v1, v3.ptr(), half );
119 if(dump_all) testOut << endl <<
"v3 =\n" << describe(*v3,verbLevel);
121 if(dump_all) testOut << endl <<
"v4 = 0.5*op*v2 ...\n" ;
122 RCP<MultiVectorBase<Scalar> > v4 = createMembers(domain,num_rhs);
123 apply( op,
NOTRANS, *v2, v4.ptr(), half );
124 if(dump_all) testOut << endl <<
"v4 =\n" << describe(*v4,verbLevel);
126 Array<Scalar> prod1(num_rhs), prod2(num_rhs);
127 domain->scalarProds(*v4, *v1, prod1());
128 domain->scalarProds(*v2, *v3, prod2());
130 result = testRelErrors<Scalar, Scalar, ScalarMag>(
133 "symmetry_error_tol()", symmetry_error_tol,
134 "symmetry_warning_tol()", symmetry_warning_tol,
137 if(!result) *these_results =
false;
142 testOut << endl <<
"Range and domain spaces are different, skipping check!\n";
153 template<
class Scalar>
155 :check_linear_properties_(true),
156 linear_properties_warning_tol_(-1.0),
157 linear_properties_error_tol_(-1.0),
158 check_adjoint_(true),
159 adjoint_warning_tol_(-1.0),
160 adjoint_error_tol_(-1.0),
161 check_for_symmetry_(false),
162 symmetry_warning_tol_(-1.0),
163 symmetry_error_tol_(-1.0),
164 num_random_vectors_(1),
165 show_all_tests_(false),
173 template<
class Scalar>
176 check_linear_properties_ = enable_all_tests_in;
177 check_adjoint_ = enable_all_tests_in;
178 check_for_symmetry_ = enable_all_tests_in;
182 template<
class Scalar>
185 linear_properties_warning_tol_ = warning_tol_in;
186 adjoint_warning_tol_ = warning_tol_in;
187 symmetry_warning_tol_ = warning_tol_in;
191 template<
class Scalar>
194 linear_properties_error_tol_ = error_tol_in;
195 adjoint_error_tol_ = error_tol_in;
196 symmetry_error_tol_ = error_tol_in;
200 template<
class Scalar>
212 using Teuchos::rcpFromPtr;
213 using Teuchos::rcpFromRef;
214 using Teuchos::outArg;
215 using Teuchos::inoutArg;
216 using Teuchos::fancyOStream;
221 bool success =
true, result;
222 const int loc_num_rhs = this->num_rhs();
223 const Scalar r_one = ST::one();
224 const Scalar d_one = ST::one();
225 const Scalar r_half = as<Scalar>(0.5)*r_one;
226 const Scalar d_half = as<Scalar>(0.5)*d_one;
230 out = Teuchos::rcpFromPtr(out_inout);
237 OSTab tab2(out,1,
"THYRA");
242 *out << endl <<
"*** Entering LinearOpTester<"<<ST::name()<<
","<<ST::name()<<
">::check(op,...) ...\n";
243 if(show_all_tests()) {
244 *out << endl <<
"describe op:\n" << Teuchos::describe(op,verbLevel);
256 RCP< MultiVectorRandomizerBase<Scalar> > rRand;
258 rRand = rcpFromPtr(rangeRandomizer);
260 rRand = universalMultiVectorRandomizer<Scalar>();
261 RCP< MultiVectorRandomizerBase<Scalar> > dRand;
262 if (!
is_null(domainRandomizer))
263 dRand = rcpFromPtr(domainRandomizer);
265 dRand = universalMultiVectorRandomizer<Scalar>();
267 *out << endl <<
"Checking the domain and range spaces ... ";
269 RCP<const VectorSpaceBase<Scalar> > range = op.range();
270 RCP<const VectorSpaceBase<Scalar> > domain = op.domain();
274 TestResultsPrinter testResultsPrinter(out, show_all_tests());
275 const RCP<FancyOStream> testOut = testResultsPrinter.getTestOStream();
277 bool these_results =
true;
279 *testOut << endl <<
"op.domain().get() != NULL ? ";
280 result = domain.get() != NULL;
281 if(!result) these_results =
false;
282 *testOut <<
passfail(result) << endl;
284 *testOut << endl <<
"op.range().get() != NULL ? ";
285 result = range.get() != NULL;
286 if(!result) these_results =
false;
287 *testOut <<
passfail(result) << endl;
289 testResultsPrinter.printTestResults(these_results, inoutArg(success));
293 if( check_linear_properties() ) {
295 *out << endl <<
"this->check_linear_properties()==true:"
296 <<
"Checking the linear properties of the forward linear operator ... ";
298 TestResultsPrinter testResultsPrinter(out, show_all_tests());
299 const RCP<FancyOStream> testOut = testResultsPrinter.getTestOStream();
301 bool these_results =
true;
308 << endl <<
"Checking that the forward operator is truly linear:\n"
309 << endl <<
" 0.5*op*(v1 + v2) == 0.5*op*v1 + 0.5*op*v2"
310 << endl <<
" \\_____/ \\___/"
312 << endl <<
" \\_____________/ \\___________________/"
315 << endl <<
" sum(v4) == sum(v5)"
316 << endl << std::flush;
318 for(
int rand_vec_i = 1; rand_vec_i <= num_random_vectors(); ++rand_vec_i ) {
320 *testOut << endl <<
"Random vector tests = " << rand_vec_i << endl;
324 *testOut << endl <<
"v1 = randomize(-1,+1); ...\n" ;
325 RCP<MultiVectorBase<Scalar> > v1 = createMembers(domain,loc_num_rhs);
326 dRand->randomize(v1.ptr());
327 if(dump_all()) *testOut << endl <<
"v1 =\n" << describe(*v1,verbLevel);
329 *testOut << endl <<
"v2 = randomize(-1,+1); ...\n" ;
330 RCP<MultiVectorBase<Scalar> > v2 = createMembers(domain,loc_num_rhs);
331 dRand->randomize(v2.ptr());
332 if(dump_all()) *testOut << endl <<
"v2 =\n" << describe(*v2,verbLevel);
334 *testOut << endl <<
"v3 = v1 + v2 ...\n" ;
335 RCP<MultiVectorBase<Scalar> > v3 = createMembers(domain,loc_num_rhs);
336 V_VpV(v3.ptr(),*v1,*v2);
337 if(dump_all()) *testOut << endl <<
"v3 =\n" << describe(*v3,verbLevel);
339 *testOut << endl <<
"v4 = 0.5*op*v3 ...\n" ;
340 RCP<MultiVectorBase<Scalar> > v4 = createMembers(range,loc_num_rhs);
341 apply( op,
NOTRANS, *v3, v4.ptr(), r_half );
342 if(dump_all()) *testOut << endl <<
"v4 =\n" << describe(*v4,verbLevel);
344 *testOut << endl <<
"v5 = op*v1 ...\n" ;
345 RCP<MultiVectorBase<Scalar> > v5 = createMembers(range,loc_num_rhs);
346 apply( op,
NOTRANS, *v1, v5.ptr() );
347 if(dump_all()) *testOut << endl <<
"v5 =\n" << describe(*v5,verbLevel);
349 *testOut << endl <<
"v5 = 0.5*op*v2 + 0.5*v5 ...\n" ;
350 apply( op,
NOTRANS, *v2, v5.ptr(), r_half, r_half );
351 if(dump_all()) *testOut << endl <<
"v5 =\n" << describe(*v5,verbLevel);
353 Array<Scalar> sum_v4(loc_num_rhs), sum_v5(loc_num_rhs);
357 result = testRelErrors<Scalar, Scalar, ScalarMag>(
360 "linear_properties_error_tol()", linear_properties_error_tol(),
361 "linear_properties_warning_tol()", linear_properties_warning_tol(),
364 if(!result) these_results =
false;
369 *testOut << endl <<
"Forward operator not supported, skipping check!\n";
372 testResultsPrinter.printTestResults(these_results, inoutArg(success));
376 *out << endl <<
"this->check_linear_properties()==false: Skipping the check of the linear properties of the forward operator!\n";
379 if( check_linear_properties() && check_adjoint() ) {
381 *out << endl <<
"(this->check_linear_properties()&&this->check_adjoint())==true:"
382 <<
" Checking the linear properties of the adjoint operator ... ";
385 TestResultsPrinter testResultsPrinter(out, show_all_tests());
386 const RCP<FancyOStream> testOut = testResultsPrinter.getTestOStream();
388 bool these_results =
true;
395 << endl <<
"Checking that the adjoint operator is truly linear:\n"
396 << endl <<
" 0.5*op'*(v1 + v2) == 0.5*op'*v1 + 0.5*op'*v2"
397 << endl <<
" \\_____/ \\____/"
399 << endl <<
" \\_______________/ \\_____________________/"
402 << endl <<
" sum(v4) == sum(v5)"
403 << endl << std::flush;
405 for(
int rand_vec_i = 1; rand_vec_i <= num_random_vectors(); ++rand_vec_i ) {
407 *testOut << endl <<
"Random vector tests = " << rand_vec_i << endl;
411 *testOut << endl <<
"v1 = randomize(-1,+1); ...\n" ;
412 RCP<MultiVectorBase<Scalar> > v1 = createMembers(range,loc_num_rhs);
413 rRand->randomize(v1.ptr());
414 if(dump_all()) *testOut << endl <<
"v1 =\n" << describe(*v1,verbLevel);
416 *testOut << endl <<
"v2 = randomize(-1,+1); ...\n" ;
417 RCP<MultiVectorBase<Scalar> > v2 = createMembers(range,loc_num_rhs);
418 rRand->randomize(v2.ptr());
419 if(dump_all()) *testOut << endl <<
"v2 =\n" << describe(*v2,verbLevel);
421 *testOut << endl <<
"v3 = v1 + v2 ...\n" ;
422 RCP<MultiVectorBase<Scalar> > v3 = createMembers(range,loc_num_rhs);
423 V_VpV(v3.ptr(),*v1,*v2);
424 if(dump_all()) *testOut << endl <<
"v3 =\n" << describe(*v3,verbLevel);
426 *testOut << endl <<
"v4 = 0.5*op'*v3 ...\n" ;
427 RCP<MultiVectorBase<Scalar> > v4 = createMembers(domain,loc_num_rhs);
428 apply( op,
CONJTRANS, *v3, v4.ptr(), d_half );
429 if(dump_all()) *testOut << endl <<
"v4 =\n" << describe(*v4,verbLevel);
431 *testOut << endl <<
"v5 = op'*v1 ...\n" ;
432 RCP<MultiVectorBase<Scalar> > v5 = createMembers(domain,loc_num_rhs);
434 if(dump_all()) *testOut << endl <<
"v5 =\n" << describe(*v5,verbLevel);
436 *testOut << endl <<
"v5 = 0.5*op'*v2 + 0.5*v5 ...\n" ;
437 apply( op,
CONJTRANS, *v2, v5.ptr(), d_half, d_half );
438 if(dump_all()) *testOut << endl <<
"v5 =\n" << describe(*v5,verbLevel);
440 Array<Scalar> sum_v4(loc_num_rhs), sum_v5(loc_num_rhs);
444 result = testRelErrors<Scalar, Scalar, ScalarMag>(
447 "linear_properties_error_tol()", linear_properties_error_tol(),
448 "linear_properties_warning_tol()", linear_properties_warning_tol(),
451 if(!result) these_results =
false;
456 *testOut << endl <<
"Adjoint operator not supported, skipping check!\n";
459 testResultsPrinter.printTestResults(these_results, inoutArg(success));
463 *out << endl <<
"(this->check_linear_properties()&&this->check_adjoint())==false: Skipping the check of the linear properties of the adjoint operator!\n";
466 if( check_adjoint() ) {
468 *out << endl <<
"this->check_adjoint()==true:"
469 <<
" Checking the agreement of the adjoint and forward operators ... ";
471 TestResultsPrinter testResultsPrinter(out, show_all_tests());
472 const RCP<FancyOStream> testOut = testResultsPrinter.getTestOStream();
474 bool these_results =
true;
481 << endl <<
"Checking that the adjoint agrees with the non-adjoint operator as:\n"
482 << endl <<
" <0.5*op'*v2,v1> == <v2,0.5*op*v1>"
483 << endl <<
" \\________/ \\_______/"
486 << endl <<
" <v4,v1> == <v2,v3>"
487 << endl << std::flush;
489 for(
int rand_vec_i = 1; rand_vec_i <= num_random_vectors(); ++rand_vec_i ) {
491 *testOut << endl <<
"Random vector tests = " << rand_vec_i << endl;
495 *testOut << endl <<
"v1 = randomize(-1,+1); ...\n" ;
496 RCP<MultiVectorBase<Scalar> > v1 = createMembers(domain,loc_num_rhs);
497 dRand->randomize(v1.ptr());
498 if(dump_all()) *testOut << endl <<
"v1 =\n" << describe(*v1,verbLevel);
500 *testOut << endl <<
"v2 = randomize(-1,+1); ...\n" ;
501 RCP<MultiVectorBase<Scalar> > v2 = createMembers(range,loc_num_rhs);
502 rRand->randomize(v2.ptr());
503 if(dump_all()) *testOut << endl <<
"v2 =\n" << describe(*v2,verbLevel);
505 *testOut << endl <<
"v3 = 0.5*op*v1 ...\n" ;
506 RCP<MultiVectorBase<Scalar> > v3 = createMembers(range,loc_num_rhs);
507 apply( op,
NOTRANS, *v1, v3.ptr(), r_half );
508 if(dump_all()) *testOut << endl <<
"v3 =\n" << describe(*v3,verbLevel);
510 *testOut << endl <<
"v4 = 0.5*op'*v2 ...\n" ;
511 RCP<MultiVectorBase<Scalar> > v4 = createMembers(domain,loc_num_rhs);
512 apply( op,
CONJTRANS, *v2, v4.ptr(), d_half );
513 if(dump_all()) *testOut << endl <<
"v4 =\n" << describe(*v4,verbLevel);
515 Array<Scalar> prod_v4_v1(loc_num_rhs);
516 domain->scalarProds(*v4, *v1, prod_v4_v1());
517 Array<Scalar> prod_v2_v3(loc_num_rhs);
518 range->scalarProds(*v2, *v3, prod_v2_v3());
520 result = testRelErrors<Scalar, Scalar, ScalarMag>(
521 "<v4,v1>", prod_v4_v1(),
522 "<v2,v3>", prod_v2_v3(),
523 "adjoint_error_tol()", adjoint_error_tol(),
524 "adjoint_warning_tol()", adjoint_warning_tol(),
527 if(!result) these_results =
false;
532 *testOut << endl <<
"Adjoint operator not supported, skipping check!\n";
535 testResultsPrinter.printTestResults(these_results, inoutArg(success));
539 *out << endl <<
"this->check_adjoint()==false:"
540 <<
" Skipping check for the agreement of the adjoint and forward operators!\n";
544 if( check_for_symmetry() ) {
546 *out << endl <<
"this->check_for_symmetry()==true: Performing check of symmetry ... ";
548 TestResultsPrinter testResultsPrinter(out, show_all_tests());
549 const RCP<FancyOStream> testOut = testResultsPrinter.getTestOStream();
551 bool these_results =
true;
553 SymmetricLinearOpTester<Scalar>::checkSymmetry(
554 op, dRand.ptr(), *testOut, loc_num_rhs,num_random_vectors(), verbLevel,dump_all(),
555 symmetry_error_tol(), symmetry_warning_tol(),
556 outArg(these_results)
559 testResultsPrinter.printTestResults(these_results, inoutArg(success));
563 *out << endl <<
"this->check_for_symmetry()==false: Skipping check of symmetry ...\n";
567 *out << endl <<
"Congratulations, this LinearOpBase object seems to check out!\n";
569 *out << endl <<
"Oh no, at least one of the tests performed with this LinearOpBase object failed (see above failures)!\n";
570 *out << endl <<
"*** Leaving LinearOpTester<"<<ST::name()<<
","<<ST::name()<<
">::check(...)\n";
577 template<
class Scalar>
579 const LinearOpBase<Scalar> &op,
580 const Ptr<Teuchos::FancyOStream> &out
584 return check(op, null, null, out);
588 template<
class Scalar>
590 const LinearOpBase<Scalar> &op1,
591 const LinearOpBase<Scalar> &op2,
592 const Ptr<MultiVectorRandomizerBase<Scalar> > &domainRandomizer,
593 const Ptr<Teuchos::FancyOStream> &out_arg
598 using Teuchos::rcpFromPtr;
599 using Teuchos::inoutArg;
603 bool success =
true, result;
604 const int loc_num_rhs = this->num_rhs();
605 const Scalar r_half = Scalar(0.5)*ST::one();
606 const RCP<FancyOStream> out = rcpFromPtr(out_arg);
609 OSTab tab(out,1,
"THYRA");
613 << endl <<
"*** Entering LinearOpTester<"<<ST::name()<<
","<<ST::name()<<
">::compare(op1,op2,...) ...\n";
615 *out << endl <<
"describe op1:\n" << Teuchos::describe(op1,verbLevel);
617 *out << endl <<
"describe op1: " << op1.description() << endl;
619 *out << endl <<
"describe op2:\n" << Teuchos::describe(op2,verbLevel);
621 *out << endl <<
"describe op2: " << op2.description() << endl;
624 RCP<MultiVectorRandomizerBase<Scalar> > dRand;
625 if (
nonnull(domainRandomizer)) dRand = rcpFromPtr(domainRandomizer);
626 else dRand = universalMultiVectorRandomizer<Scalar>();
628 RCP<const VectorSpaceBase<Scalar> > range = op1.range();
629 RCP<const VectorSpaceBase<Scalar> > domain = op1.domain();
631 if(out.get()) *out << endl <<
"Checking that range and domain spaces are compatible ... ";
635 TestResultsPrinter testResultsPrinter(out, show_all_tests());
636 const RCP<FancyOStream> testOut = testResultsPrinter.getTestOStream();
638 bool these_results =
true;
640 *testOut << endl <<
"op1.domain()->isCompatible(*op2.domain()) ? ";
641 result = op1.domain()->isCompatible(*op2.domain());
642 if(!result) these_results =
false;
643 *testOut <<
passfail(result) << endl;
645 *testOut << endl <<
"op1.range()->isCompatible(*op2.range()) ? ";
646 result = op1.range()->isCompatible(*op2.range());
647 if(!result) these_results =
false;
648 *testOut <<
passfail(result) << endl;
650 testResultsPrinter.printTestResults(these_results, inoutArg(success));
655 if(out.get()) *out << endl <<
"Skipping further checks since operators are not compatible!\n";
659 if(out.get()) *out << endl <<
"Checking that op1 == op2 ... ";
663 TestResultsPrinter testResultsPrinter(out, show_all_tests());
664 const RCP<FancyOStream> testOut = testResultsPrinter.getTestOStream();
666 bool these_results =
true;
669 << endl <<
"Checking that op1 and op2 produce the same results:\n"
670 << endl <<
" 0.5*op1*v1 == 0.5*op2*v1"
671 << endl <<
" \\________/ \\________/"
674 << endl <<
" norm(v2-v3) ~= 0"
676 << endl << std::flush;
678 for(
int rand_vec_i = 1; rand_vec_i <= num_random_vectors(); ++rand_vec_i ) {
680 *testOut << endl <<
"Random vector tests = " << rand_vec_i << endl;
684 if(dump_all()) *testOut << endl <<
"v1 = randomize(-1,+1); ...\n" ;
685 RCP<MultiVectorBase<Scalar> > v1 = createMembers(domain,loc_num_rhs);
686 dRand->randomize(v1.ptr());
687 if(dump_all()) *testOut << endl <<
"v1 =\n" << *v1;
689 if(dump_all()) *testOut << endl <<
"v2 = 0.5*op1*v1 ...\n" ;
690 RCP<MultiVectorBase<Scalar> > v2 = createMembers(range,loc_num_rhs);
691 apply( op1,
NOTRANS, *v1, v2.ptr(), r_half );
692 if(dump_all()) *testOut << endl <<
"v2 =\n" << *v2;
694 if(dump_all()) *testOut << endl <<
"v3 = 0.5*op2*v1 ...\n" ;
695 RCP<MultiVectorBase<Scalar> > v3 = createMembers(range,loc_num_rhs);
696 apply( op2,
NOTRANS, *v1, v3.ptr(), r_half );
697 if(dump_all()) *testOut << endl <<
"v3 =\n" << *v3;
700 for(
int col_id=0;col_id < v1->domain()->dim();col_id++) {
701 std::stringstream ss;
702 ss <<
".col[" << col_id <<
"]";
705 "v2"+ss.str(),*v2->col(col_id),
706 "v3"+ss.str(),*v3->col(col_id),
707 "linear_properties_error_tol()", linear_properties_error_tol(),
708 "linear_properties_warning_tol()", linear_properties_warning_tol(),
710 if(!result) these_results =
false;
726 if(!result) these_results =
false;
730 testResultsPrinter.printTestResults(these_results, inoutArg(success));
736 *out << endl <<
"Congratulations, these two LinearOpBase objects seem to be the same!\n";
738 *out << endl <<
"Oh no, these two LinearOpBase objects seem to be different (see above failures)!\n";
739 *out << endl <<
"*** Leaving LinearOpTester<"<<ST::name()<<
","<<ST::name()<<
">::compare(...)\n";
747 template<
class Scalar>
749 const LinearOpBase<Scalar> &op1,
750 const LinearOpBase<Scalar> &op2,
751 const Ptr<Teuchos::FancyOStream> &out_arg
754 return compare(op1, op2, Teuchos::null, out_arg);
762 template<
class ScalarMag>
764 void setDefaultTol(
const ScalarMag &defaultDefaultTol,
765 ScalarMag &defaultTol)
767 typedef ScalarTraits<ScalarMag> SMT;
768 if (defaultTol < SMT::zero()) {
769 defaultTol = defaultDefaultTol;
774 template<
class Scalar>
775 void LinearOpTester<Scalar>::setDefaultTols()
777 typedef ScalarTraits<ScalarMag> SMT;
778 const ScalarMag defaultWarningTol = 1e+2 * SMT::eps();
779 const ScalarMag defaultErrorTol = 1e+4 * SMT::eps();
780 setDefaultTol(defaultWarningTol, linear_properties_warning_tol_);
781 setDefaultTol(defaultErrorTol, linear_properties_error_tol_);
782 setDefaultTol(defaultWarningTol, adjoint_warning_tol_);
783 setDefaultTol(defaultErrorTol, adjoint_error_tol_);
784 setDefaultTol(defaultWarningTol, symmetry_warning_tol_);
785 setDefaultTol(defaultErrorTol, symmetry_error_tol_);
792 #endif // THYRA_LINEAR_OP_TESTER_DEF_HPP
void enable_all_tests(const bool enable_all_tests)
Enable or disable all tests.
bool is_null(const boost::shared_ptr< T > &p)
basic_OSTab< char > OSTab
basic_FancyOStream< char > FancyOStream
const std::string passfail(const bool result)
Use the non-transposed operator.
bool testRelNormDiffErr(const std::string &v1_name, const VectorBase< Scalar > &v1, const std::string &v2_name, const VectorBase< Scalar > &v2, const std::string &maxRelErr_error_name, const typename Teuchos::ScalarTraits< Scalar >::magnitudeType &maxRelErr_error, const std::string &maxRelErr_warning_name, const typename Teuchos::ScalarTraits< Scalar >::magnitudeType &maxRelErr_warning, std::ostream *out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::VERB_LOW, const std::string &leadingIndent=std::string(""))
Compute, check and optionally print the relative errors in two vectors.
Use the transposed operator with complex-conjugate clements (same as TRANS for real scalar types)...
bool compare(const LinearOpBase< Scalar > &op1, const LinearOpBase< Scalar > &op2, const Ptr< MultiVectorRandomizerBase< Scalar > > &domainRandomizer, const Ptr< FancyOStream > &out_arg) const
Check if two linear operators are the same or not.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Base class for all linear operators.
void set_all_warning_tol(const ScalarMag warning_tol)
Set all the warning tolerances to the same value.
bool nonnull(const boost::shared_ptr< T > &p)
bool check(const LinearOpBase< Scalar > &op, const Ptr< MultiVectorRandomizerBase< Scalar > > &rangeRandomizer, const Ptr< MultiVectorRandomizerBase< Scalar > > &domainRandomizer, const Ptr< FancyOStream > &out) const
Check a linear operator.
TypeTo as(const TypeFrom &t)
Teuchos::ScalarTraits< Scalar >::magnitudeType ScalarMag
Local typedef for promoted scalar magnitude.
LinearOpTester()
Default constructor which sets default parameter values.
Base interface for a strategy object for randomizing a multi-vector.
#define TEUCHOS_TEST_EQUALITY_CONST(v1, v2, out, success)
void set_all_error_tol(const ScalarMag error_tol)
Set all the error tolerances to the same value.