|
Thyra Package Browser (Single Doxygen Collection) Version of the Day
|
Abstract interface for scalar products. More...
#include <Thyra_ScalarProdBase_decl.hpp>

Non-virtual public interface | |
| bool | isEuclidean () const |
| Return if this is a Euclidean (identity) scalar product is the same as the dot product. | |
| Scalar | scalarProd (const VectorBase< Scalar > &x, const VectorBase< Scalar > &y) const |
| Return the scalar product of two vectors in the vector space. | |
| void | scalarProds (const MultiVectorBase< Scalar > &X, const MultiVectorBase< Scalar > &Y, const ArrayView< Scalar > &scalarProds_out) const |
| Return the scalar product of each column in two multi-vectors in the vector space. | |
| RCP< const LinearOpBase< Scalar > > | getLinearOp () const |
Return a linear operator representing the scalar product Q. | |
Protected virtual functions. | |
| virtual bool | isEuclideanImpl () const =0 |
| | |
| virtual Scalar | scalarProdImpl (const VectorBase< Scalar > &x, const VectorBase< Scalar > &y) const |
| Default implementation calls scalarProdsImpl(). | |
| virtual void | scalarProdsImpl (const MultiVectorBase< Scalar > &X, const MultiVectorBase< Scalar > &Y, const ArrayView< Scalar > &scalarProds_out) const =0 |
| | |
| virtual RCP< const LinearOpBase< Scalar > > | getLinearOpImpl () const |
| | |
Abstract interface for scalar products.
This interface is not considered a user-level interface. Instead, this interface is designed to be sub-classed off of and used with ScalarProdVectorSpaceBase objects to define their scalar products. Applications should create subclasses of this interface to define application-specific scalar products (i.e. such as PDE finite-element codes often do).
This interface requires subclasses to override a multi-vector version of the scalar product function scalarProds(). This version yields the most efficient implementation in a distributed memory environment by requiring only a single global reduction operation and a single communication.
Note that one of the preconditions on the vector and multi-vector arguments in scalarProds() is a little vague in stating that the vector or multi-vector objects must be "compatible" with the underlying implementation of *this. The reason that this precondition must be vague is that we can not expose a method to return a VectorSpaceBase object that could be checked for compatibility since ScalarProdBase is used to define a VectorSpaceBase object (through the ScalarProdVectorSpaceBase node subclass). Also, some definitions of ScalarProdBase (i.e. EuclideanScalarProd) will work for any vector space implementation since they only rely on RTOp operators. In other cases, however, an application-specific scalar product may a have dependency on the data-structure of vector and multi-vector objects in which case one can not just use this with any vector or multi-vector implementation.
This interface class also defines functions to modify the application of a Euclidean linear operator to insert the definition of the application specific scalar product.
Definition at line 77 of file Thyra_ScalarProdBase_decl.hpp.
| bool Thyra::ScalarProdBase< Scalar >::isEuclidean | ( | ) | const [inline] |
Return if this is a Euclidean (identity) scalar product is the same as the dot product.
The default implementation returns false (evenn though on average the truth is most likely true).
Definition at line 89 of file Thyra_ScalarProdBase_decl.hpp.
References Thyra::ScalarProdBase< Scalar >::isEuclideanImpl().
| Scalar Thyra::ScalarProdBase< Scalar >::scalarProd | ( | const VectorBase< Scalar > & | x, |
| const VectorBase< Scalar > & | y | ||
| ) | const [inline] |
Return the scalar product of two vectors in the vector space.
Preconditions:
The vectors x and y are compatible with *this implementation or an exception will be thrown.
x.space()->isCompatible(*y.space()) (throw Exceptions::IncompatibleVectorSpaces)
Postconditions:
The scalar product is returned.
The default implementation calls on the multi-vector version scalarProds().
Definition at line 113 of file Thyra_ScalarProdBase_decl.hpp.
References Thyra::ScalarProdBase< Scalar >::scalarProdImpl().
| void Thyra::ScalarProdBase< Scalar >::scalarProds | ( | const MultiVectorBase< Scalar > & | X, |
| const MultiVectorBase< Scalar > & | Y, | ||
| const ArrayView< Scalar > & | scalarProds_out | ||
| ) | const [inline] |
Return the scalar product of each column in two multi-vectors in the vector space.
| X | [in] Multi-vector. |
| Y | [in] Multi-vector. |
| scalar_prod | [out] Array (length X.domain()->dim()) containing the scalar products scalar_prod[j] = this->scalarProd(*X.col(j),*Y.col(j)), for j = 0 ... X.domain()->dim()-1. |
Preconditions:
X.domain()->isCompatible(*Y.domain()) (throw Exceptions::IncompatibleVectorSpaces)
X.range()->isCompatible(*Y.range()) (throw Exceptions::IncompatibleVectorSpaces)
The MultiVectorBase objects X and Y are compatible with this implementation or an exception will be thrown.
Postconditions:
scalar_prod[j] = this->scalarProd(*X.col(j),*Y.col(j)), for j = 0 ... X.domain()->dim()-1
Definition at line 151 of file Thyra_ScalarProdBase_decl.hpp.
References Thyra::ScalarProdBase< Scalar >::scalarProdsImpl().
| RCP<const LinearOpBase<Scalar> > Thyra::ScalarProdBase< Scalar >::getLinearOp | ( | ) | const [inline] |
Return a linear operator representing the scalar product Q.
All scalar products are not required to return this operator so a return value of null is allowed. Note that if this->isEuclidean() == true then there is no reason to return an identity operator.
Definition at line 164 of file Thyra_ScalarProdBase_decl.hpp.
References Thyra::ScalarProdBase< Scalar >::getLinearOpImpl().
| virtual bool Thyra::ScalarProdBase< Scalar >::isEuclideanImpl | ( | ) | const [protected, pure virtual] |
Implemented in Thyra::EuclideanScalarProd< Scalar >, Thyra::LinearOpScalarProd< Scalar >, and Thyra::DiagonalScalarProd< Scalar >.
Referenced by Thyra::ScalarProdBase< Scalar >::isEuclidean().
| Scalar Thyra::ScalarProdBase< Scalar >::scalarProdImpl | ( | const VectorBase< Scalar > & | x, |
| const VectorBase< Scalar > & | y | ||
| ) | const [protected, virtual] |
Default implementation calls scalarProdsImpl().
Definition at line 43 of file Thyra_ScalarProdBase_def.hpp.
Referenced by Thyra::ScalarProdBase< Scalar >::scalarProd().
| virtual void Thyra::ScalarProdBase< Scalar >::scalarProdsImpl | ( | const MultiVectorBase< Scalar > & | X, |
| const MultiVectorBase< Scalar > & | Y, | ||
| const ArrayView< Scalar > & | scalarProds_out | ||
| ) | const [protected, pure virtual] |
Implemented in Thyra::EuclideanScalarProd< Scalar >, Thyra::LinearOpScalarProd< Scalar >, and Thyra::DiagonalScalarProd< Scalar >.
Referenced by Thyra::ScalarProdBase< Scalar >::scalarProds().
| virtual RCP<const LinearOpBase<Scalar> > Thyra::ScalarProdBase< Scalar >::getLinearOpImpl | ( | ) | const [inline, protected, virtual] |
Reimplemented in Thyra::LinearOpScalarProd< Scalar >, and Thyra::DiagonalScalarProd< Scalar >.
Definition at line 188 of file Thyra_ScalarProdBase_decl.hpp.
Referenced by Thyra::ScalarProdBase< Scalar >::getLinearOp().
1.7.4