Thyra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members
Thyra::ScalarProdBase< Scalar > Class Template Referenceabstract

Abstract interface for scalar products. More...

#include <Thyra_ScalarProdBase_decl.hpp>

Inheritance diagram for Thyra::ScalarProdBase< Scalar >:
Inheritance graph
[legend]

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
 

Detailed Description

template<class Scalar>
class Thyra::ScalarProdBase< Scalar >

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.

Member Function Documentation

template<class Scalar >
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 102 of file Thyra_ScalarProdBase_decl.hpp.

template<class Scalar >
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:

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.

template<class Scalar >
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.

Parameters
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:

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.

template<class Scalar >
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 177 of file Thyra_ScalarProdBase_decl.hpp.

template<class Scalar >
virtual bool Thyra::ScalarProdBase< Scalar >::isEuclideanImpl ( ) const
protectedpure virtual
template<class Scalar >
Scalar Thyra::ScalarProdBase< Scalar >::scalarProdImpl ( const VectorBase< Scalar > &  x,
const VectorBase< Scalar > &  y 
) const
protectedvirtual

Default implementation calls scalarProdsImpl().

Definition at line 56 of file Thyra_ScalarProdBase_def.hpp.

template<class Scalar >
virtual void Thyra::ScalarProdBase< Scalar >::scalarProdsImpl ( const MultiVectorBase< Scalar > &  X,
const MultiVectorBase< Scalar > &  Y,
const ArrayView< Scalar > &  scalarProds_out 
) const
protectedpure virtual
template<class Scalar >
virtual RCP<const LinearOpBase<Scalar> > Thyra::ScalarProdBase< Scalar >::getLinearOpImpl ( ) const
inlineprotectedvirtual

The documentation for this class was generated from the following files: