Thyra Version of the Day
Loading...
Searching...
No Matches
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
55namespace Thyra {
56
57
74template<class Scalar>
76public:
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
107
112
117
121 STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, check_for_symmetry );
122
127
132
135 STANDARD_MEMBER_COMPOSITION_MEMBERS( int, num_random_vectors );
136
139 STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, show_all_tests );
140
145
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
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
311 const LinearOpBase<Scalar> &op1,
312 const LinearOpBase<Scalar> &op2,
313 const Ptr<FancyOStream> &out_arg
314 ) const;
315
316private:
317
318 void setDefaultTols();
319
320}; // class LinearOpTester
321
322
323} // namespace Thyra
324
325
326#endif // THYRA_LINEAR_OP_TESTER_DECL_HPP
Base class for all linear operators.
Testing class for LinearOpBase.
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)
STANDARD_MEMBER_COMPOSITION_MEMBERS(ScalarMag, adjoint_warning_tol)
Set the tolerance above which a relative error will generate a warning message for the check of the a...
STANDARD_MEMBER_COMPOSITION_MEMBERS(bool, check_adjoint)
Set if to check for adjoint property x'*(op*y) == y'*(op'*x) if adjoint is supported.
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.
STANDARD_MEMBER_COMPOSITION_MEMBERS(ScalarMag, symmetry_error_tol)
Set the tolerance above which a relative error will generate a error message and result in test failu...
LinearOpTester()
Default constructor which sets default parameter values.
STANDARD_MEMBER_COMPOSITION_MEMBERS(ScalarMag, adjoint_error_tol)
Set the tolerance above which a relative error will generate a error message and result in test failu...
STANDARD_MEMBER_COMPOSITION_MEMBERS(int, num_random_vectors)
Set the number random vectors that is generated during each test.
void set_all_warning_tol(const ScalarMag warning_tol)
Set all the warning tolerances to the same value.
bool compare(const LinearOpBase< Scalar > &op1, const LinearOpBase< Scalar > &op2, const Ptr< FancyOStream > &out_arg) const
Calls this->compare(op1,op2,NULL,out,leadingIndent,indentSpacer).
STANDARD_MEMBER_COMPOSITION_MEMBERS(ScalarMag, symmetry_warning_tol)
Set the tolerance above which a relative error will generate a warning message for the check of symme...
void enable_all_tests(const bool enable_all_tests)
Enable or disable all tests.
STANDARD_MEMBER_COMPOSITION_MEMBERS(bool, check_for_symmetry)
Set if to check for symmetry property x'*(op*y) == y'*(op*x) for symmetric operators.
STANDARD_MEMBER_COMPOSITION_MEMBERS(bool, show_all_tests)
Set if all tests are shown or just summaries.
void set_all_error_tol(const ScalarMag error_tol)
Set all the error tolerances to the same value.
STANDARD_MEMBER_COMPOSITION_MEMBERS(int, num_rhs)
Set the number of right-hand-sides in the multivectors.
Teuchos::ScalarTraits< Scalar >::magnitudeType ScalarMag
Local typedef for promoted scalar magnitude.
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.
bool check(const LinearOpBase< Scalar > &op, const Ptr< FancyOStream > &out) const
Calls this->check(op,null,null,out,leadingIndent,indentSpacer)
STANDARD_MEMBER_COMPOSITION_MEMBERS(ScalarMag, linear_properties_warning_tol)
Set the tolerance above which a relative error will generate a warning message for the check of the l...
STANDARD_MEMBER_COMPOSITION_MEMBERS(ScalarMag, linear_properties_error_tol)
Set the tolerance above which a relative error will generate a error message and result in test failu...
STANDARD_MEMBER_COMPOSITION_MEMBERS(bool, dump_all)
Set if all of the vectors are dumped or not (only relevant if show_all_tests()==true).
Base interface for a strategy object for randomizing a multi-vector.