Thyra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Thyra_LinearOpTester_decl.hpp
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Thyra: Interfaces and Support for Abstract Numerical Algorithms
5 // Copyright (2004) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Roscoe A. Bartlett (bartlettra@ornl.gov)
38 //
39 // ***********************************************************************
40 // @HEADER
41 
42 
43 #ifndef THYRA_LINEAR_OP_TESTER_DECL_HPP
44 #define THYRA_LINEAR_OP_TESTER_DECL_HPP
45 
46 
47 #include "Thyra_OperatorVectorTypes.hpp"
48 #include "Thyra_MultiVectorRandomizerBase.hpp"
49 #include "Teuchos_ScalarTraits.hpp"
50 #include "Teuchos_PromotionTraits.hpp"
51 #include "Teuchos_StandardMemberCompositionMacros.hpp"
52 #include "Teuchos_FancyOStream.hpp"
53 
54 
55 namespace Thyra {
56 
57 
74 template<class Scalar>
76 public:
77 
80 
86 
90  STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, check_linear_properties );
91 
95  STANDARD_MEMBER_COMPOSITION_MEMBERS( ScalarMag, linear_properties_warning_tol );
96 
101  STANDARD_MEMBER_COMPOSITION_MEMBERS( ScalarMag, linear_properties_error_tol );
102 
106  STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, check_adjoint );
107 
111  STANDARD_MEMBER_COMPOSITION_MEMBERS( ScalarMag, adjoint_warning_tol );
112 
116  STANDARD_MEMBER_COMPOSITION_MEMBERS( ScalarMag, adjoint_error_tol );
117 
121  STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, check_for_symmetry );
122 
126  STANDARD_MEMBER_COMPOSITION_MEMBERS( ScalarMag, symmetry_warning_tol );
127 
131  STANDARD_MEMBER_COMPOSITION_MEMBERS( ScalarMag, symmetry_error_tol );
132 
135  STANDARD_MEMBER_COMPOSITION_MEMBERS( int, num_random_vectors );
136 
139  STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, show_all_tests );
140 
144  STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, dump_all );
145 
148  STANDARD_MEMBER_COMPOSITION_MEMBERS( int, num_rhs );
149 
158  void enable_all_tests( const bool enable_all_tests );
159 
168  void set_all_warning_tol( const ScalarMag warning_tol );
169 
178  void set_all_error_tol( const ScalarMag error_tol );
179 
249  bool check(
250  const LinearOpBase<Scalar> &op,
251  const Ptr<MultiVectorRandomizerBase<Scalar> > &rangeRandomizer,
252  const Ptr<MultiVectorRandomizerBase<Scalar> > &domainRandomizer,
253  const Ptr<FancyOStream> &out
254  ) const;
255 
257  bool check(
258  const LinearOpBase<Scalar> &op,
259  const Ptr<FancyOStream> &out
260  ) const;
261 
300  bool compare(
301  const LinearOpBase<Scalar> &op1,
302  const LinearOpBase<Scalar> &op2,
303  const Ptr<MultiVectorRandomizerBase<Scalar> > &domainRandomizer,
304  const Ptr<FancyOStream> &out_arg
305  ) const;
306 
310  bool compare(
311  const LinearOpBase<Scalar> &op1,
312  const LinearOpBase<Scalar> &op2,
313  const Ptr<FancyOStream> &out_arg
314  ) const;
315 
316 private:
317 
318  void setDefaultTols();
319 
320 }; // class LinearOpTester
321 
322 
323 } // namespace Thyra
324 
325 
326 #endif // THYRA_LINEAR_OP_TESTER_DECL_HPP
void enable_all_tests(const bool enable_all_tests)
Enable or disable all tests.
Testing class for LinearOpBase.
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.
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 check(const LinearOpBase< Scalar > &op, const Ptr< MultiVectorRandomizerBase< Scalar > > &rangeRandomizer, const Ptr< MultiVectorRandomizerBase< Scalar > > &domainRandomizer, const Ptr< FancyOStream > &out) const
Check a linear operator.
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.
STANDARD_MEMBER_COMPOSITION_MEMBERS(bool, check_linear_properties)
Set if to check for linear properties alpha*op*(x + y) == op(alpha*x) + op(alpha*y) ...
void set_all_error_tol(const ScalarMag error_tol)
Set all the error tolerances to the same value.