Thyra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Macros | Enumerations | Functions
Development of linear Abstract Numerical Algorithms (ANAs) (Client Support)

While the Thyra operator/vector fundamental interfaces were not principally designed to provide a direct API for the development of ANA software, with some minimal helper functions and classes, directly writing even sophisticated ANA implementations directly in terms of Thyra objects is quite straightforward. More...

Collaboration diagram for Development of linear Abstract Numerical Algorithms (ANAs) (Client Support):

Classes

class  Thyra::DefaultAddedLinearOp< Scalar >
 Concrete composite LinearOpBase subclass that creates an implicitly added linear operator out of one or more constituent LinearOpBase objects. More...
 
class  Thyra::DefaultBlockedLinearOp< Scalar >
 Concrete composite LinearOpBase subclass that creates single linear operator object out of a set of constituent LinearOpBase blocks. More...
 
class  Thyra::DefaultDiagonalLinearOp< Scalar >
 Default concrete LinearOpBase subclass for diagonal linear operators. More...
 
class  Thyra::DefaultIdentityLinearOp< Scalar >
 Represents a identity linear operator M = I. More...
 
class  Thyra::DefaultMultipliedLinearOp< Scalar >
 Concrete composite LinearOpBase subclass that creates an implicitly multiplied linear operator out of one or more constituent LinearOpBase objects. More...
 
class  Thyra::DefaultMultiVectorProductVector< Scalar >
 Concrete implementation of a product vector which is really composed out of the columns of a multi-vector. More...
 
class  Thyra::DefaultMultiVectorProductVectorSpace< Scalar >
 Standard concrete implementation of a product vector space that creates product vectors fromed implicitly from the columns of a multi-vector. More...
 
class  Thyra::DefaultProductMultiVector< Scalar >
 Concrete implementation of a product multi-vector. More...
 
class  Thyra::DefaultProductVector< Scalar >
 Concrete implementation of a product vector. More...
 
class  Thyra::DefaultProductVectorSpace< Scalar >
 
class  Thyra::DefaultScaledAdjointLinearOp< Scalar >
 Concrete decorator LinearOpBase subclass that wraps a LinearOpBase object and adds on an extra scaling factor and/or a transpose enum. More...
 
class  Thyra::DefaultZeroLinearOp< Scalar >
 Represents a zero linear operator M = 0. More...
 
class  Thyra::ConstDetachedMultiVectorView< Scalar >
 Create an explicit non-mutable (const) view of a MultiVectorBase object. More...
 
class  Thyra::DetachedMultiVectorView< Scalar >
 Create an explicit mutable (non-const) view of a MultiVectorBase object. More...
 
class  Thyra::ConstDetachedVectorView< Scalar >
 Create an explicit non-mutable (const) view of a VectorBase object. More...
 
class  Thyra::DetachedVectorView< Scalar >
 Create an explicit mutable (non-const) view of a VectorBase object. More...
 
class  Thyra::LinearOpDefaultBase< Scalar >
 Node subclass that provides a good default implementation for the describe() function. More...
 
class  Thyra::LinearOpTester< Scalar >
 Testing class for LinearOpBase. More...
 
class  Thyra::ListedMultiVectorRandomizer< Scalar >
 MultiVectorRandomizerBase subclass that returns a revolving list of preset MultiVectorBase objects. More...
 
class  Thyra::MultiVectorDefaultBase< Scalar >
 Node subclass that uses a default MultiVectorBase implementation to provide default implementations for as many other functions in MultiVectorBase interface the as is reasonable. More...
 
class  Thyra::MultiVectorTester< Scalar >
 Unit testing class for a MultiVectorBase object. More...
 
class  Thyra::ParameterDrivenMultiVectorInput< Scalar >
 Concrete utility class that an ANA can use for reading in a (multi)vector as directed by a parameter sublist. More...
 
class  Thyra::UniversalMultiVectorRandomizer< Scalar >
 Univeral MultiVectorRandomizerBase subclass that is compatible with all MultiVectorBase objects. More...
 
class  Thyra::VectorDefaultBase< Scalar >
 Convenient node subclass for concrete VectorBase subclasses that relies on a default MultiVectorBase implementation. More...
 
class  Thyra::VectorSpaceDefaultBase< Scalar >
 Node VectorSpaceBase subclass that provides default implementations for many functions using a default multi-vectors implementation. More...
 
class  Thyra::VectorSpaceTester< Scalar >
 Testing class for VectorSpace and the VectorBase and MultiVectorBase objects that it creates. More...
 
class  Thyra::VectorTester< Scalar >
 Unit testing class for a VectorBase object. More...
 
class  Thyra::DefaultBlockedTriangularLinearOpWithSolve< Scalar >
 Concrete composite LinearOpWithSolveBase subclass that creates single upper or lower block triangular LOWSB object out of a set of LOWSB objects along the diagonal with LOB objects off diagonal. More...
 
class  Thyra::DefaultInverseLinearOp< Scalar >
 Concrete LinearOpBase subclass that creates an implicit LinearOpBase object using the inverse action of a LinearOpWithSolveBase object. More...
 
class  Thyra::LinearOpWithSolveTester< Scalar >
 Testing class for LinearOpWithSolveBase. More...
 

Macros

#define THYRA_ASSERT_LHS_ARG(FUNC_NAME, LHS_ARG)
 This macro just asserts that a LHS argument is set. More...
 
#define THYRA_ASSERT_VEC_SPACES_NAMES(FUNC_NAME, VS1, VS1_NAME, VS2, VS2_NAME)
 Helper assertion macro. More...
 
#define THYRA_ASSERT_VEC_SPACES(FUNC_NAME, VS1, VS2)   THYRA_ASSERT_VEC_SPACES_NAMES(FUNC_NAME,VS1,#VS1,VS2,#VS2)
 This is a very useful macro that should be used to validate that two vector spaces are compatible. More...
 
#define THYRA_ASSERT_MAT_VEC_SPACES(FUNC_NAME, M, M_T, M_VS, VS)
 This macro validates that a linear operator and a vector space for the domain vector are compatible. More...
 
#define THYRA_ASSERT_LINEAR_OP_VEC_APPLY_SPACES(FUNC_NAME, M, M_T, X, Y)
 This is a very useful macro that should be used to validate that the spaces for the vector version of the LinearOpBase::apply() function (or related operations). More...
 
#define THYRA_ASSERT_LINEAR_OP_MULTIVEC_APPLY_SPACES(FUNC_NAME, M, M_T, X, Y)
 This is a very useful macro that should be used to validate that the spaces for the multi-vector version of the LinearOpBase::apply() function (or related operations). More...
 
#define THYRA_ASSERT_LINEAR_OP_PLUS_LINEAR_OP_SPACES_NAMES(FUNC_NAME, M1, M1_T, M1_N, M2, M2_T, M2_N)   ::Thyra::assertLinearOpPlusLinearOpNames(FUNC_NAME,M1,M1_T,M1_N,M2,M2_T,M2_N)
 Assert that a linear operator addition matches up. More...
 
#define THYRA_ASSERT_LINEAR_OP_TIMES_LINEAR_OP_SPACES_NAMES(FUNC_NAME, M1, M1_T, M1_N, M2, M2_T, M2_N)   ::Thyra::assertLinearOpTimesLinearOpNames(FUNC_NAME,M1,M1_T,M1_N,M2,M2_T,M2_N)
 Assert that a linear operator multiplication matches up. More...
 
#define THYRA_ASSERT_MAT_MAT_SPACES(FUNC_NAME, M1, M1_T, M1_VS, M2, M2_T, M2_VS)
 Helper assertion macro. More...
 

Enumerations

enum  Thyra::EThrowOnSolveFailure { Thyra::THROW_ON_SOLVE_FAILURE =1, Thyra::IGNORE_SOLVE_FAILURE =0 }
 Determines what to do if inverse solve fails. More...
 

Functions

template<class Scalar >
const Thyra::VectorSpaceBase
< Scalar > & 
Thyra::linear_op_op (const Thyra::LinearOpBase< Scalar > &M, Thyra::EOpTransp M_trans, EM_VS M_VS)
 Utility function for selecting domain or range spaces. More...
 
const std::string Thyra::passfail (const bool result)
 
template<class Scalar >
Teuchos::ScalarTraits< Scalar >
::magnitudeType 
Thyra::relErr (const Scalar &s1, const Scalar &s2)
 
template<class Scalar >
Teuchos::ScalarTraits< Scalar >
::magnitudeType 
Thyra::relVectorErr (const VectorBase< Scalar > &v1, const VectorBase< Scalar > &v2)
 Return relative error of two vectors. More...
 
template<class Scalar1 , class Scalar2 , class ScalarMag >
bool Thyra::testRelErrors (const std::string &v1_name, const ArrayView< const Scalar1 > &v1, const std::string &v2_name, const ArrayView< const Scalar2 > &v2, const std::string &maxRelErr_error_name, const ScalarMag &maxRelErr_error, const std::string &maxRelErr_warning_name, const ScalarMag &maxRelErr_warning, const Ptr< std::ostream > &out, const std::string &leadingIndent=std::string(""))
 Compute, check and optionally print the relative errors in two scalar arays. More...
 
template<class Scalar >
bool Thyra::testRelNormDiffErr (const std::string &v1_name, const VectorBase< Scalar > &v1, const std::string &v2_name, const VectorBase< Scalar > &v2, const std::string &maxRelErr_error_name, const typename Teuchos::ScalarTraits< Scalar >::magnitudeType &maxRelErr_error, const std::string &maxRelErr_warning_name, const typename Teuchos::ScalarTraits< Scalar >::magnitudeType &maxRelErr_warning, std::ostream *out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::VERB_LOW, const std::string &leadingIndent=std::string(""))
 Compute, check and optionally print the relative errors in two vectors. More...
 
template<class Scalar >
bool Thyra::testMaxErr (const std::string &error_name, const Scalar &error, const std::string &max_error_name, const typename Teuchos::ScalarTraits< Scalar >::magnitudeType &max_error, const std::string &max_warning_name, const typename Teuchos::ScalarTraits< Scalar >::magnitudeType &max_warning, std::ostream *out, const std::string &leadingIndent=std::string(""))
 Check that an error is less than some error tolerence. More...
 
template<class Scalar >
bool Thyra::testMaxErrors (const std::string &error_name, const ArrayView< const typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &errors, const std::string &max_error_name, const typename Teuchos::ScalarTraits< Scalar >::magnitudeType &max_error, const std::string &max_warning_name, const typename Teuchos::ScalarTraits< Scalar >::magnitudeType &max_warning, const Ptr< std::ostream > &out, const std::string &leadingIndent=std::string(""))
 Check that an array of errors is less than some error tolerence. More...
 
bool Thyra::testBoolExpr (const std::string &boolExprName, const bool &boolExpr, const bool &boolExpected, const Ptr< std::ostream > &out, const std::string &leadingIndent=std::string(""))
 Check a boolean result against expected result. More...
 
template<class Scalar >
std::ostream & Thyra::operator<< (std::ostream &o, const VectorBase< Scalar > &v)
 Output operator to pretty print any Thyra::VectorBase object. More...
 
template<class Scalar >
std::ostream & Thyra::operator<< (std::ostream &o, const LinearOpBase< Scalar > &M)
 Output operator to pretty print any Thyra::LinearOpBase (and therefore MultiVectorBase) object. More...
 

Detailed Description

While the Thyra operator/vector fundamental interfaces were not principally designed to provide a direct API for the development of ANA software, with some minimal helper functions and classes, directly writing even sophisticated ANA implementations directly in terms of Thyra objects is quite straightforward.

It turns out that using Thyra for the development of simple ANAs, as described below, really does not require any deep understanding of the foundational Thyra operator/vector interfaces.

Overview of Using Thyra Software for Development of ANA Software

There are several different types of helper classes and functions that simplify the use of Thyra for the development of ANAs.

  1. "Standard" non-member wrapper functions for vector (and multi-vector) reduction/transformation operations

    While the use of the RTOpPack::RTOpT interface class and the single Thyra::VectorBase::applyOp() function provide an elegant and efficient solution for the interoperability of vector interfaces, it is not the easiest API for developing ANAs. However, a number of easy to use C++ wrapper functions for many different vector and multi-vector operations is already provided:

    • Thyra_Op_Vec_VectorStdOps_grp
    • Thyra_Op_Vec_MultiVectorStdOps_grp

    These C++ wrapper functions rely on pre-implemented RTOpPack::RTOpT subclasses. Adding new RTOpPack::RTOpT subclasses and new wrapper functions for new vector and multi-vector reduction/transformation operations is an easy matter for an experienced C++ developer who understands RTOpPack::RTOpT (please contact rabar.nosp@m.tl@s.nosp@m.andia.nosp@m..gov if you need a new vector or multi-vector operation that is not already supported).

  2. Implicit vector space, vector, multi-vector and linear operator subclasses

    One of the big advantages of having a set of abstract interfaces to operators and vectors is that it is quite easy to define some very useful aggregate subclasses that allow one or more individual objects be treated as a single object (see the "Composite" and "Decorator" design patterns in the GoF's "Design Patterns" book).

    1. Implicit product vector spaces, vectors and multi-vectors

      One particularly useful category of composite linear algebra objects is the product vector space $\mathcal{X} = \mathcal{V}_0 {}\times \mathcal{V}_1 {}\times {}\ldots {}\times \mathcal{V}_{m-1}$ where $\mathcal{V}_k$, for $k = 0 {}\ldots {m-1}$, are different constituent vector spaces. Product vector spaces give rise to product vectors

      \[ x = \left[\begin{array}{c} v_0 \\ v_1 \\ \vdots \\ v_{m-1} \end{array}\right] \]

      (where $v_0 \in \mathcal{V}_0, v_1 \in \mathcal{V}_1, \ldots, v_{m-1} \in \mathcal{V}_{m-1}$) and product multi-vectors

      \[ X = \left[\begin{array}{c} V_0 \\ V_1 \\ \vdots \\ V_{m-1} \end{array}\right]. \]

      (where $V_0 \in \mathcal{V}_0 | \mathcal{D}, V_1 \in \mathcal{V}_1 | \mathcal{D}, \ldots, V_{m-1} \in \mathcal{V}_{m-1} | \mathcal{D}$ and $\mathcal{D}$ is the domain space for the multi-vectors).

      Very general concrete implementations of the product vector space, vector and multi-vector interfaces described here are provided and are shown below:

      Note that the above concrete subclasses are very efficient for must, but not all, possible use cases for such composite objects.

      When using product vector spaces, product vectors and product multi-vectors it is generally the case where a concrete Thyra::DefaultProductVectorSpace object is first created and then Thyra::DefaultProductVector and Thyra::DefaultProductMultiVector objects are created by the functions Thyra::DefaultProductVectorSpace::createMember() and Thyra::DefaultProductVectorSpace::createMembers(). See this example of how product vector spaces are used.

    2. Miscellaneous implicit linear operators

      These are several different types of useful implicit composite/decorator Thyra::LinearOpBase subclasses. These concrete subclasses provide the building blocks for arbitararly complex implicitly composed linear operators. Default implementations for these implicit linear operator subclasses are shown below:

  3. Creating explicit views of vector and multi-vector elements

    Warning! using the utility classes below it is very easy to obtain direct access to vector and multi-vector elements but in general, this is a very bad idea. However, as described in this report, there are some types of ANAs that require direct element access to certain kinds of vectors and multi-vectors (for example, vectors and multi-vectors that lie is the domain space of a multi-vector). The following utility classes streamline creating and using explicit views.

    • Thyra::ConstDetachedVectorView creates a (const) non-mutable explicit view of a const Thyra::VectorBase object, allows direct access to vector elements and then frees the view in the destructor.
    • Thyra::DetachedVectorView creates a (non-const) mutable explicit view of a Thyra::VectorBase object, allows direct access to vector elements and then frees the view in the destructor.
    • Thyra::ConstDetachedMultiVectorView creates a (const) non-mutable explicit view of a const Thyra::MultiVectorBase object, allows direct access to multi-vector elements and then frees the view in the destructor.
    • Thyra::DetachedMultiVectorView creates a (non-const) mutable explicit view of a Thyra::MultiVectorBase object, allows direct access to multi-vector elements and then frees the view in the destructor.

    One of the big advantages of using the above utility classes in addition to their convenience is that views are freed in destructors and these view will be freed even in the event that an exception is thrown. The use of these view classes is quite straightforward.

  4. Basic default implementation node subclasses

    The following subclasses directly derive from Thyra operator/vector fundamental interfaces and provide general default implementations for as many virtual functions as reasonable:

  5. Unit testing software

    This is basic testing software for Thyra:

  6. Miscellaneous Tools for testing and debugging

    There is software included in the Thyra package to support basic testing and debugging.

    First, 100/% general output stream operators for any Thyra::VectorBase or Thyra::LinearOpBase object are provided in the following operator functions:

    • Thyra::operator<<(std::ostream& o, const Thyra::VectorBase<Scalar>& v) is an output stream operator for printing Thyra::VectorBase objects.
    • Thyra::operator<<(std::ostream& o, const Thyra::LinearOpBase<Scalar>& M) is an output stream operator for printing Thyra::LinearOpBase (and therefore also Thyra::MultiVectorBase) objects.

  7. Miscellaneous software

    Here is software that does not neatly fall into any of the above categories but is still considered ANA software.

Examples of Abstract Numerical Algorithms

There are several code examples that one can study to see how to use the code described here as an API for developing ANAs.

Other Use Cases

Macro Definition Documentation

#define THYRA_ASSERT_LHS_ARG (   FUNC_NAME,
  LHS_ARG 
)
Value:
(&*LHS_ARG) == NULL, std::invalid_argument, \
FUNC_NAME << " : Error!" \
);
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)

This macro just asserts that a LHS argument is set.

Definition at line 118 of file Thyra_AssertOp.hpp.

#define THYRA_ASSERT_VEC_SPACES_NAMES (   FUNC_NAME,
  VS1,
  VS1_NAME,
  VS2,
  VS2_NAME 
)
Value:
{ \
const bool l_isCompatible = (VS1).isCompatible(VS2); \
TEUCHOS_TEST_FOR_EXCEPTION( \
FUNC_NAME << "\n\n" \
<< ::Thyra::dump_vec_spaces(VS1,VS1_NAME,VS2,VS2_NAME) \
) \
}
Thrown if vector spaces are incompatible.
bool isCompatible(const LinearOpWithSolveFactoryBase< Scalar > &lowsFactory, const LinearOpBase< Scalar > &fwdOp)
Return if the forward operator is a compatible source for a LOWSFB object.

Helper assertion macro.

Definition at line 134 of file Thyra_AssertOp.hpp.

#define THYRA_ASSERT_VEC_SPACES (   FUNC_NAME,
  VS1,
  VS2 
)    THYRA_ASSERT_VEC_SPACES_NAMES(FUNC_NAME,VS1,#VS1,VS2,#VS2)

This is a very useful macro that should be used to validate that two vector spaces are compatible.

If the vector spaces are not compatible then a very helpful error message is generated (in the std::exception class) along with the file name and line number where this macro is called. The error message string embedded in the thrown exception gives the concrete types of the two vector spaces involved as well as their dimensions.

Definition at line 156 of file Thyra_AssertOp.hpp.

#define THYRA_ASSERT_MAT_VEC_SPACES (   FUNC_NAME,
  M,
  M_T,
  M_VS,
  VS 
)
Value:
{ \
std::ostringstream M_VS_name; \
M_VS_name << "(" #M << ( (M_T) == Thyra::NOTRANS ? "" : "^T" ) << ")" \
<< "." << ( (M_VS) == Thyra::VS_RANGE ? "range()" : "domain()" ); \
FUNC_NAME, \
::Thyra::linear_op_op(M,M_T,M_VS),M_VS_name.str().c_str(), \
(VS),#VS \
) \
}
Use the non-transposed operator.
const Thyra::VectorSpaceBase< Scalar > & linear_op_op(const Thyra::LinearOpBase< Scalar > &M, Thyra::EOpTransp M_trans, EM_VS M_VS)
Utility function for selecting domain or range spaces.
#define THYRA_ASSERT_VEC_SPACES_NAMES(FUNC_NAME, VS1, VS1_NAME, VS2, VS2_NAME)
Helper assertion macro.

This macro validates that a linear operator and a vector space for the domain vector are compatible.

This macro is not recommended for casual users.

Definition at line 167 of file Thyra_AssertOp.hpp.

#define THYRA_ASSERT_LINEAR_OP_VEC_APPLY_SPACES (   FUNC_NAME,
  M,
  M_T,
  X,
 
)
Value:
{ \
std::ostringstream headeross; \
headeross \
<< FUNC_NAME << ":\n" \
<< "Spaces check failed for " \
<< #M << ( (M_T) == Thyra::NOTRANS ? "" : "^T" ) << " * " \
<< #X << " and " << #Y; \
const std::string &header = headeross.str(); \
THYRA_ASSERT_MAT_VEC_SPACES(header,M,M_T,::Thyra::VS_RANGE,*(Y)->space()); \
THYRA_ASSERT_MAT_VEC_SPACES(header,M,M_T,::Thyra::VS_DOMAIN,*(X).space()); \
}
Use the non-transposed operator.
#define THYRA_ASSERT_MAT_VEC_SPACES(FUNC_NAME, M, M_T, M_VS, VS)
This macro validates that a linear operator and a vector space for the domain vector are compatible...

This is a very useful macro that should be used to validate that the spaces for the vector version of the LinearOpBase::apply() function (or related operations).

If the vector spaces are not compatible then a very helpful error message is generated (in the std::exception class) along with the file name and line number where this macro is called. The error message string embedded in the thrown exception gives the concrete types of the vector spaces involved as well as their dimensions.

Definition at line 192 of file Thyra_AssertOp.hpp.

#define THYRA_ASSERT_LINEAR_OP_MULTIVEC_APPLY_SPACES (   FUNC_NAME,
  M,
  M_T,
  X,
 
)
Value:
{ \
std::ostringstream headeross; \
headeross \
<< FUNC_NAME << ":\n\n" \
<< "Spaces check failed for " \
<< #M << ( (M_T) == Thyra::NOTRANS ? "" : "^T" ) << " * " \
<< #X << " and " << #Y << ":\n\n"; \
const std::string &header = headeross.str(); \
THYRA_ASSERT_VEC_SPACES(header,*(X).domain(),*(Y)->domain()); \
THYRA_ASSERT_MAT_VEC_SPACES(header,M,M_T,::Thyra::VS_RANGE,*(Y)->range()); \
THYRA_ASSERT_MAT_VEC_SPACES(header,M,M_T,::Thyra::VS_DOMAIN,*(X).range()); \
}
#define THYRA_ASSERT_VEC_SPACES(FUNC_NAME, VS1, VS2)
This is a very useful macro that should be used to validate that two vector spaces are compatible...
Use the non-transposed operator.
#define THYRA_ASSERT_MAT_VEC_SPACES(FUNC_NAME, M, M_T, M_VS, VS)
This macro validates that a linear operator and a vector space for the domain vector are compatible...

This is a very useful macro that should be used to validate that the spaces for the multi-vector version of the LinearOpBase::apply() function (or related operations).

If the vector spaces are not compatible then a very helpful error message is generated (in the std::exception class) along with the file name and line number where this macro is called. The error message string embedded in the thrown exception gives the concrete types of the vector spaces involved as well as their dimensions.

Definition at line 218 of file Thyra_AssertOp.hpp.

#define THYRA_ASSERT_LINEAR_OP_PLUS_LINEAR_OP_SPACES_NAMES (   FUNC_NAME,
  M1,
  M1_T,
  M1_N,
  M2,
  M2_T,
  M2_N 
)    ::Thyra::assertLinearOpPlusLinearOpNames(FUNC_NAME,M1,M1_T,M1_N,M2,M2_T,M2_N)

Assert that a linear operator addition matches up.

Definition at line 329 of file Thyra_AssertOp.hpp.

#define THYRA_ASSERT_LINEAR_OP_TIMES_LINEAR_OP_SPACES_NAMES (   FUNC_NAME,
  M1,
  M1_T,
  M1_N,
  M2,
  M2_T,
  M2_N 
)    ::Thyra::assertLinearOpTimesLinearOpNames(FUNC_NAME,M1,M1_T,M1_N,M2,M2_T,M2_N)

Assert that a linear operator multiplication matches up.

Definition at line 337 of file Thyra_AssertOp.hpp.

#define THYRA_ASSERT_MAT_MAT_SPACES (   FUNC_NAME,
  M1,
  M1_T,
  M1_VS,
  M2,
  M2_T,
  M2_VS 
)
Value:
{ \
std::ostringstream headeross; \
headeross \
<< FUNC_NAME << "\n" \
<< "Spaces check failed for " \
<< #M1 << ( (M1_T) == Thyra::NOTRANS ? "" : "^T" ) << " and " \
<< #M2 << ( (M2_T) == Thyra::NOTRANS ? "" : "^T" ); \
const std::string &header = headeross.str(); \
std::ostringstream M1_VS_name, M2_VS_name; \
M1_VS_name << "(" #M1 << ( M1_T == ::Thyra::NOTRANS ? "" : "^T" ) << ")" \
<< "." << ( M1_VS == ::Thyra::VS_RANGE ? "range()" : "domain()" ); \
M2_VS_name << "(" #M2 << ( M2_T == ::Thyra::NOTRANS ? "" : "^T" ) << ")" \
<< "." << ( M2_VS == ::Thyra::VS_RANGE ? "range()" : "domain()" ); \
header, \
::Thyra::linear_op_op(M1,M1_T,M1_VS),M1_VS_name.str().c_str() \
::Thyra::linear_op_op(M2,M2_T,M2_VS),M2_VS_name.str().c_str() \
); \
}
Use the non-transposed operator.
const Thyra::VectorSpaceBase< Scalar > & linear_op_op(const Thyra::LinearOpBase< Scalar > &M, Thyra::EOpTransp M_trans, EM_VS M_VS)
Utility function for selecting domain or range spaces.
#define THYRA_ASSERT_VEC_SPACES_NAMES(FUNC_NAME, VS1, VS1_NAME, VS2, VS2_NAME)
Helper assertion macro.

Helper assertion macro.

This macro is not recommended for casual users.

Definition at line 347 of file Thyra_AssertOp.hpp.

Enumeration Type Documentation

Determines what to do if inverse solve fails.

Enumerator
THROW_ON_SOLVE_FAILURE 

Throw an exception if a solve fails to converge.

IGNORE_SOLVE_FAILURE 

Don't throw an exception if a solve fails to converge.

Definition at line 24 of file Thyra_DefaultInverseLinearOp_decl.hpp.

Function Documentation

template<class Scalar >
const Thyra::VectorSpaceBase<Scalar>& Thyra::linear_op_op ( const Thyra::LinearOpBase< Scalar > &  M,
Thyra::EOpTransp  M_trans,
EM_VS  M_VS 
)

Utility function for selecting domain or range spaces.

Definition at line 94 of file Thyra_AssertOp.hpp.

const std::string Thyra::passfail ( const bool  result)
inline

Definition at line 24 of file Thyra_TestingToolsDecl.hpp.

template<class Scalar >
Teuchos::ScalarTraits<Scalar>::magnitudeType Thyra::relErr ( const Scalar &  s1,
const Scalar &  s2 
)
inline

Definition at line 37 of file Thyra_TestingToolsDecl.hpp.

template<class Scalar >
Teuchos::ScalarTraits< Scalar >::magnitudeType Thyra::relVectorErr ( const VectorBase< Scalar > &  v1,
const VectorBase< Scalar > &  v2 
)

Return relative error of two vectors.

ToDo: Finish documentation!

Definition at line 23 of file Thyra_TestingTools.hpp.

template<class Scalar1 , class Scalar2 , class ScalarMag >
bool Thyra::testRelErrors ( const std::string &  v1_name,
const ArrayView< const Scalar1 > &  v1,
const std::string &  v2_name,
const ArrayView< const Scalar2 > &  v2,
const std::string &  maxRelErr_error_name,
const ScalarMag &  maxRelErr_error,
const std::string &  maxRelErr_warning_name,
const ScalarMag &  maxRelErr_warning,
const Ptr< std::ostream > &  out,
const std::string &  leadingIndent = std::string("") 
)

Compute, check and optionally print the relative errors in two scalar arays.

Parameters
v1[in] Array (length num_scalars).
v2[in] Array (length num_scalars).

ToDo: Finish documentation!

Definition at line 50 of file Thyra_TestingTools.hpp.

template<class Scalar >
bool Thyra::testRelNormDiffErr ( const std::string &  v1_name,
const VectorBase< Scalar > &  v1,
const std::string &  v2_name,
const VectorBase< Scalar > &  v2,
const std::string &  maxRelErr_error_name,
const typename Teuchos::ScalarTraits< Scalar >::magnitudeType &  maxRelErr_error,
const std::string &  maxRelErr_warning_name,
const typename Teuchos::ScalarTraits< Scalar >::magnitudeType &  maxRelErr_warning,
std::ostream *  out,
const Teuchos::EVerbosityLevel  verbLevel = Teuchos::VERB_LOW,
const std::string &  leadingIndent = std::string("") 
)

Compute, check and optionally print the relative errors in two vectors.

This function only looks at the difference in the relative errors in the natural norm of the difference between two vectors. This does not perform a component-by-component check.

ToDo: Finish documentation!

Definition at line 106 of file Thyra_TestingTools.hpp.

template<class Scalar >
bool Thyra::testMaxErr ( const std::string &  error_name,
const Scalar &  error,
const std::string &  max_error_name,
const typename Teuchos::ScalarTraits< Scalar >::magnitudeType &  max_error,
const std::string &  max_warning_name,
const typename Teuchos::ScalarTraits< Scalar >::magnitudeType &  max_warning,
std::ostream *  out,
const std::string &  leadingIndent = std::string("") 
)

Check that an error is less than some error tolerence.

ToDo: Finish documentation!

Definition at line 171 of file Thyra_TestingTools.hpp.

template<class Scalar >
bool Thyra::testMaxErrors ( const std::string &  error_name,
const ArrayView< const typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &  errors,
const std::string &  max_error_name,
const typename Teuchos::ScalarTraits< Scalar >::magnitudeType &  max_error,
const std::string &  max_warning_name,
const typename Teuchos::ScalarTraits< Scalar >::magnitudeType &  max_warning,
const Ptr< std::ostream > &  out,
const std::string &  leadingIndent = std::string("") 
)

Check that an array of errors is less than some error tolerence.

Parameters
error[in] Array (length num_scalars).

ToDo: Finish documentation!

Definition at line 207 of file Thyra_TestingTools.hpp.

bool Thyra::testBoolExpr ( const std::string &  boolExprName,
const bool &  boolExpr,
const bool &  boolExpected,
const Ptr< std::ostream > &  out,
const std::string &  leadingIndent = std::string("") 
)

Check a boolean result against expected result.

ToDo: Finish documentation!

Definition at line 13 of file Thyra_TestingTools.cpp.

template<class Scalar >
std::ostream & Thyra::operator<< ( std::ostream &  o,
const VectorBase< Scalar > &  v 
)

Output operator to pretty print any Thyra::VectorBase object.

Calls v.describe(o, Teuchos::VERB_EXTREME);

Definition at line 261 of file Thyra_TestingTools.hpp.

template<class Scalar >
std::ostream & Thyra::operator<< ( std::ostream &  o,
const LinearOpBase< Scalar > &  M 
)

Output operator to pretty print any Thyra::LinearOpBase (and therefore MultiVectorBase) object.

Calls M.describe(o, Teuchos::VERB_EXTREME);

Definition at line 268 of file Thyra_TestingTools.hpp.