Modules | |
| group | Collection of standard multi-vector operations. |
| group | Collection of all vector operations |
| group | Helper functions for creating MultiplicativeLinearOp objects. |
| group | Helper functions for creating scaled/adjoint linear operators. |
| group | Miscellaneous C++ utility code for testing and debugging. |
Classes | |
| class | Thyra::DiagonalLinearOp< Scalar > |
Concrete LinearOpBase subclass for diagonal linear operators. More... | |
| class | Thyra::ExplicitMultiVectorView< Scalar > |
Create an explicit non-mutable (const) view of a MultiVectorBase object. More... | |
| class | Thyra::ExplicitMutableMultiVectorView< Scalar > |
Create an explicit mutable (non-const) view of a MultiVectorBase object. More... | |
| class | Thyra::ExplicitVectorView< Scalar > |
Create an explicit non-mutable (const) view of a VectorBase object. More... | |
| class | Thyra::ExplicitMutableVectorView< Scalar > |
Create an explicit mutable (non-const) view of a VectorBase object. More... | |
| class | Thyra::LinearOpTester< RangeScalar, DomainScalar > |
Testing class for LinearOpBase. More... | |
| class | Thyra::LinearOpWithSolveTester< RangeScalar, DomainScalar > |
Testing class for LinearOpWithSolveBase. More... | |
| class | Thyra::ListedMultiVectorRandomizer< Scalar > |
MultiVectorRandomizerBase subclass that returns a revolving list of preset MultiVectorBase objects. More... | |
| class | Thyra::MultiplicativeLinearOp< Scalar > |
Concrete composite LinearOpBase subclass that creates a multiplicative linear operator out of one or more constituent LinearOpBase objects. More... | |
| class | Thyra::MultiVectorTester< Scalar > |
Unit testing class for a MultiVectorBase object. More... | |
| class | Thyra::ProductVector< Scalar > |
| Concrete implementation of a product vector. More... | |
| class | Thyra::ProductVectorSpace< Scalar > |
| Standard concrete implementation of a product vector space. More... | |
| class | Thyra::ScaledAdjointLinearOp< 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::UniversalMultiVectorRandomizer< Scalar > |
Univeral MultiVectorRandomizerBase subclass that is compatible with all MultiVectorBase objects. 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... | |
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.
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:
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 rabartl@sandia.gov if you need a new vector or multi-vector operation that is not already supported).
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::ExplicitVectorView 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::ExplicitMutableVectorView 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::ExplicitMultiVectorView 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::ExplicitMutableMultiVectorView 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.
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).
One particularly useful category of composite linear algebra objects is the product vector space
where
, for
, are different constituent vector spaces. Product vector spaces give rise to product vectors
(where
) and product multi-vectors
(where
and
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:
Thyra::ProductVectorSpace is a general concrete implementation of Thyra::ProductVectorSpaceBase that should be sufficient for most use cases. Thyra::ProductVector is a general concrete implementation of Thyra::ProductVectorBase that should be sufficient for most use cases. Thyra::ProductMultiVector is a general concrete implementation of Thyra::ProductMultiVectorBase that should be sufficient for most use cases. (ToDo: This needs to be implemented!) 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::ProductVectorSpace object is first created and then Thyra::ProductVector and Thyra::ProductMultiVector objects are created by the functions Thyra::ProductVectorSpace::createMember() and Thyra::ProductVectorSpace::createMembers(). See this example of how product vector spaces are used.
There are several different types of useful composite Thyra::LinearOpBase subclasses that one can define. A few useful composite linear operator subclasses are shown below:
Thyra::DiagonalLinearOp is a simple concrete subclass that defines a diagonal Thyra::LinearOpBase
out of any Thyra::VectorBase object for the diagonal
. Thyra::ScaledAdjointLinearOp is a simple concrete decorator subclass that defines an implicit scaled and/or adjoined (or transposed) linear operator
. Thyra::MultiplicativeLinearOp is a simple concrete composite subclass that defines a composite multiplicative Thyra::LinearOpBase of the form
composed out of one or more constituent linear operators
.
This is basic testing software for Thyra:
Thyra::LinearOpTester is a unit testing class that validates the implementation of a Thyra::LinearOpBase object by checking its linear properties, and/or its adjoint, and/or symmetry. In addition, it can check if two linear operators are the same. Thyra::MultiVectorTester is a unit testing class that validates the implementation of a Thyra::MultiVectorBase object. This class exposes a Thyra::LinearOpTester object for testing the LinearOpBase base interface of Thyra::MultiVectorBase. Thyra::VectorTester is a unit testing class that validates the implementation of a Thyra::VectorBase object. This class exposes a Thyra::MultiVectorTester object for testing the MultiVectorBase base interface of Thyra::VectorBase. Thyra::VectorSpaceTester is a unit testing class that accepts any Thyra::VectorSpaceBase object and then proceeds to create a number of Thyra::VectorBase and Thyra::MultiVectorBase objects and then and validates all of these objects. This class class, therefore, is a unit testing class for all three interfaces Thyra::VectorSpaceBase, Thyra::VectorBase, and Thyra::MultiVectorBase. Thyra::VectorStdOpsTester is a unit testing class that accepts any Thyra::VectorSpaceBase object and then tests all of the standard vector RTOp wrappers documented here. Thyra::MultiVectorStdOpsTester is a unit testing class that accepts any Thyra::VectorSpaceBase object and then tests all of the standard multi-vector RTOp wrappers documented here.
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.
sillyPowerMethod() is a simple example ANA that implements the power method for estimating the dominate eigenvalue of a linear operator.
sillyCgSolve() is a simple example ANA that implements the conjugate gradient method for solving a symmetric positive definite linear system.
Thyra::LinearOpTester::check() shows how to access a Thyra::LinearOpBase objects domain and range spaces, how to use these spaces to create vectors and multi-vectors and how to perform various types of operations involving vectors, multi-vectors and linear operators.
1.3.9.1