Thyra_LinearOpTesterDecl.hpp

00001 // @HEADER
00002 // ***********************************************************************
00003 // 
00004 //    Thyra: Interfaces and Support for Abstract Numerical Algorithms
00005 //                 Copyright (2004) Sandia Corporation
00006 // 
00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00008 // license for use of this work by or on behalf of the U.S. Government.
00009 // 
00010 // This library is free software; you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as
00012 // published by the Free Software Foundation; either version 2.1 of the
00013 // License, or (at your option) any later version.
00014 //  
00015 // This library is distributed in the hope that it will be useful, but
00016 // WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //  
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00023 // USA
00024 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 
00025 // 
00026 // ***********************************************************************
00027 // @HEADER
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_StandardMemberCompositionMacros.hpp"
00038 #include "Teuchos_FancyOStream.hpp"
00039 
00040 
00041 namespace Thyra {
00042 
00043 
00060 template<class RangeScalar, class DomainScalar = RangeScalar>
00061 class LinearOpTester {
00062 public:
00063 
00065   typedef typename Teuchos::PromotionTraits<RangeScalar,DomainScalar>::promote Scalar;
00066 
00068   typedef typename Teuchos::ScalarTraits<Scalar>::magnitudeType ScalarMag;
00069 
00077   LinearOpTester(
00078     const bool check_linear_properties = true,
00079     const ScalarMag linear_properties_warning_tol = 1e-13,
00080     const ScalarMag linear_properties_error_tol = 1e-10,
00081     const bool check_adjoint = true,
00082     const ScalarMag adjoint_warning_tol = 1e-13,
00083     const ScalarMag adjoint_error_tol = 1e-10,
00084     const bool check_for_symmetry = false,
00085     const ScalarMag symmetry_warning_tol = 1e-13,
00086     const ScalarMag symmetry_error_tol = 1e-10,
00087     const int num_random_vectors = 1,
00088     const bool show_all_tests = false,
00089     const bool dump_all = false,
00090     const int num_rhs = 1
00091     );
00092   
00096   STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, check_linear_properties );
00097 
00101   STANDARD_MEMBER_COMPOSITION_MEMBERS( ScalarMag, linear_properties_warning_tol );
00102 
00107   STANDARD_MEMBER_COMPOSITION_MEMBERS( ScalarMag, linear_properties_error_tol );
00108 
00112   STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, check_adjoint  );
00113 
00117   STANDARD_MEMBER_COMPOSITION_MEMBERS( ScalarMag, adjoint_warning_tol );
00118 
00122   STANDARD_MEMBER_COMPOSITION_MEMBERS( ScalarMag, adjoint_error_tol );
00123 
00127   STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, check_for_symmetry  );
00128 
00132   STANDARD_MEMBER_COMPOSITION_MEMBERS( ScalarMag, symmetry_warning_tol );
00133 
00137   STANDARD_MEMBER_COMPOSITION_MEMBERS( ScalarMag, symmetry_error_tol );
00138 
00141   STANDARD_MEMBER_COMPOSITION_MEMBERS( int, num_random_vectors );
00142 
00145   STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, show_all_tests );
00146 
00150   STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, dump_all );
00151 
00154   STANDARD_MEMBER_COMPOSITION_MEMBERS( int, num_rhs );
00155 
00164   void enable_all_tests( const bool enable_all_tests );
00165 
00174   void set_all_warning_tol( const ScalarMag warning_tol );
00175 
00184   void set_all_error_tol( const ScalarMag error_tol );
00185 
00255   bool check(
00256     const LinearOpBase<RangeScalar,DomainScalar> &op,
00257     MultiVectorRandomizerBase<RangeScalar> *rangeRandomizer,
00258     MultiVectorRandomizerBase<DomainScalar> *domainRandomizer,
00259     Teuchos::FancyOStream *out
00260     ) const;
00261 
00263   bool check(
00264     const LinearOpBase<RangeScalar,DomainScalar> &op,
00265     Teuchos::FancyOStream *out
00266     ) const;
00267 
00306   bool compare(
00307     const LinearOpBase<RangeScalar,DomainScalar> &op1,
00308     const LinearOpBase<RangeScalar,DomainScalar> &op2,
00309     MultiVectorRandomizerBase<DomainScalar> *domainRandomizer,
00310     Teuchos::FancyOStream *out
00311     ) const;
00312  
00316   bool compare(
00317     const LinearOpBase<RangeScalar,DomainScalar> &op1,
00318     const LinearOpBase<RangeScalar,DomainScalar> &op2,
00319     Teuchos::FancyOStream *out
00320     ) const;
00321 
00322 }; // class LinearOpTester
00323 
00324 
00325 } // namespace Thyra
00326 
00327 
00328 #endif // THYRA_LINEAR_OP_TESTER_DECL_HPP

Generated on Wed May 12 21:42:28 2010 for Thyra Operator/Vector Support by  doxygen 1.4.7