Thyra_LinearOpTester_decl.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_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 }; // class LinearOpTester
00369 
00370 
00371 } // namespace Thyra
00372 
00373 
00374 #endif // THYRA_LINEAR_OP_TESTER_DECL_HPP

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