Thyra
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. More... | |
Scalar | scalarProd (const VectorBase< Scalar > &x, const VectorBase< Scalar > &y) const |
Return the scalar product of two vectors in the vector space. More... | |
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. More... | |
RCP< const LinearOpBase< Scalar > > | getLinearOp () const |
Return a linear operator representing the scalar product Q . More... | |
Protected virtual functions. | |
virtual bool | isEuclideanImpl () const =0 |
virtual Scalar | scalarProdImpl (const VectorBase< Scalar > &x, const VectorBase< Scalar > &y) const |
Default implementation calls scalarProdsImpl(). More... | |
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 49 of file Thyra_OperatorVectorAdapterSupportTypes.hpp.
|
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 102 of file Thyra_ScalarProdBase_decl.hpp.
|
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 126 of file Thyra_ScalarProdBase_decl.hpp.
|
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 164 of file Thyra_ScalarProdBase_decl.hpp.
|
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 177 of file Thyra_ScalarProdBase_decl.hpp.
|
protectedpure virtual |
|
protectedvirtual |
Default implementation calls scalarProdsImpl().
Definition at line 56 of file Thyra_ScalarProdBase_def.hpp.
|
protectedpure virtual |
|
inlineprotectedvirtual |
Reimplemented in Thyra::LinearOpScalarProd< Scalar >, and Thyra::DiagonalScalarProd< Scalar >.
Definition at line 201 of file Thyra_ScalarProdBase_decl.hpp.