00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef THYRA_LINEAR_OP_TESTER_DECL_HPP
00031 #define THYRA_LINEAR_OP_TESTER_DECL_HPP
00032
00033
00034 #include "Thyra_OperatorVectorTypes.hpp"
00035 #include "Thyra_MultiVectorRandomizerBase.hpp"
00036 #include "Teuchos_ScalarTraits.hpp"
00037 #include "Teuchos_PromotionTraits.hpp"
00038 #include "Teuchos_StandardMemberCompositionMacros.hpp"
00039 #include "Teuchos_FancyOStream.hpp"
00040
00041
00042 namespace Thyra {
00043
00044
00061 template<class Scalar>
00062 class LinearOpTester {
00063 public:
00064
00066 typedef typename Teuchos::ScalarTraits<Scalar>::magnitudeType ScalarMag;
00067
00075 LinearOpTester(
00076 const bool check_linear_properties = true,
00077 const ScalarMag linear_properties_warning_tol = 1e-13,
00078 const ScalarMag linear_properties_error_tol = 1e-10,
00079 const bool check_adjoint = true,
00080 const ScalarMag adjoint_warning_tol = 1e-13,
00081 const ScalarMag adjoint_error_tol = 1e-10,
00082 const bool check_for_symmetry = false,
00083 const ScalarMag symmetry_warning_tol = 1e-13,
00084 const ScalarMag symmetry_error_tol = 1e-10,
00085 const int num_random_vectors = 1,
00086 const bool show_all_tests = false,
00087 const bool dump_all = false,
00088 const int num_rhs = 1
00089 );
00090
00094 STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, check_linear_properties );
00095
00099 STANDARD_MEMBER_COMPOSITION_MEMBERS( ScalarMag, linear_properties_warning_tol );
00100
00105 STANDARD_MEMBER_COMPOSITION_MEMBERS( ScalarMag, linear_properties_error_tol );
00106
00110 STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, check_adjoint );
00111
00115 STANDARD_MEMBER_COMPOSITION_MEMBERS( ScalarMag, adjoint_warning_tol );
00116
00120 STANDARD_MEMBER_COMPOSITION_MEMBERS( ScalarMag, adjoint_error_tol );
00121
00125 STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, check_for_symmetry );
00126
00130 STANDARD_MEMBER_COMPOSITION_MEMBERS( ScalarMag, symmetry_warning_tol );
00131
00135 STANDARD_MEMBER_COMPOSITION_MEMBERS( ScalarMag, symmetry_error_tol );
00136
00139 STANDARD_MEMBER_COMPOSITION_MEMBERS( int, num_random_vectors );
00140
00143 STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, show_all_tests );
00144
00148 STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, dump_all );
00149
00152 STANDARD_MEMBER_COMPOSITION_MEMBERS( int, num_rhs );
00153
00162 void enable_all_tests( const bool enable_all_tests );
00163
00172 void set_all_warning_tol( const ScalarMag warning_tol );
00173
00182 void set_all_error_tol( const ScalarMag error_tol );
00183
00253 bool check(
00254 const LinearOpBase<Scalar> &op,
00255 const Ptr<MultiVectorRandomizerBase<Scalar> > &rangeRandomizer,
00256 const Ptr<MultiVectorRandomizerBase<Scalar> > &domainRandomizer,
00257 const Ptr<Teuchos::FancyOStream> &out
00258 ) const;
00259
00261 bool check(
00262 const LinearOpBase<Scalar> &op,
00263 const Ptr<Teuchos::FancyOStream> &out
00264 ) const;
00265
00304 bool compare(
00305 const LinearOpBase<Scalar> &op1,
00306 const LinearOpBase<Scalar> &op2,
00307 const Ptr<MultiVectorRandomizerBase<Scalar> > &domainRandomizer,
00308 const Ptr<Teuchos::FancyOStream> &out_arg
00309 ) const;
00310
00314 bool compare(
00315 const LinearOpBase<Scalar> &op1,
00316 const LinearOpBase<Scalar> &op2,
00317 const Ptr<Teuchos::FancyOStream> &out_arg
00318 ) const;
00319
00322
00324 bool check(
00325 const LinearOpBase<Scalar> &op,
00326 MultiVectorRandomizerBase<Scalar> *rangeRandomizer,
00327 MultiVectorRandomizerBase<Scalar> *domainRandomizer,
00328 Teuchos::FancyOStream *out
00329 ) const
00330 {
00331 using Teuchos::ptr;
00332 return check(op, ptr(rangeRandomizer), ptr(domainRandomizer), ptr(out));
00333 }
00334
00336 bool check(
00337 const LinearOpBase<Scalar> &op,
00338 Teuchos::FancyOStream *out
00339 ) const
00340 {
00341 return check(op, Teuchos::ptr(out));
00342 }
00343
00345 bool compare(
00346 const LinearOpBase<Scalar> &op1,
00347 const LinearOpBase<Scalar> &op2,
00348 MultiVectorRandomizerBase<Scalar> *domainRandomizer,
00349 Teuchos::FancyOStream *out_arg
00350 ) const
00351 {
00352 using Teuchos::ptr;
00353 return compare(op1, op2, ptr(domainRandomizer), ptr(out_arg));
00354 }
00355
00357 bool compare(
00358 const LinearOpBase<Scalar> &op1,
00359 const LinearOpBase<Scalar> &op2,
00360 Teuchos::FancyOStream *out_arg
00361 ) const
00362 {
00363 return compare(op1, op2, Teuchos::ptr(out_arg));
00364 }
00365
00367
00368 };
00369
00370
00371 }
00372
00373
00374 #endif // THYRA_LINEAR_OP_TESTER_DECL_HPP