Thyra::ScalarProdBase< Scalar > Class Template Reference
[Basic Support Subclasses Abstracting Application-Specific Scalar Products]

Abstract interface for scalar products. More...

#include <Thyra_ScalarProdBaseDecl.hpp>

Inheritance diagram for Thyra::ScalarProdBase< Scalar >:

[legend]
List of all members.

Destructor

virtual ~ScalarProdBase ()
 

Public pure virtual functions that must be overridden

virtual void scalarProds (const MultiVectorBase< Scalar > &X, const MultiVectorBase< Scalar > &Y, Scalar scalar_prods[]) const =0
 Return the scalar product of each column in two multi-vectors in the vector space.
virtual void apply (const EuclideanLinearOpBase< Scalar > &M, const ETransp M_trans, const MultiVectorBase< Scalar > &X, MultiVectorBase< Scalar > *Y, const Scalar alpha, const Scalar beta) const =0
 Modify the application of a Euclidean linear operator by inserting the vector space's scalar product.

Public virtual functions with default implementations

virtual bool isEuclidean () const
 Return if this is a Euclidean (identity) scalar product is the same as the dot product.
virtual Scalar scalarProd (const VectorBase< Scalar > &x, const VectorBase< Scalar > &y) const
 Return the scalar product of two vectors in the vector space.

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 VectorSpaceStdBase 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 74 of file Thyra_ScalarProdBaseDecl.hpp.


Constructor & Destructor Documentation

template<class Scalar>
virtual Thyra::ScalarProdBase< Scalar >::~ScalarProdBase (  )  [inline, virtual]

Definition at line 81 of file Thyra_ScalarProdBaseDecl.hpp.


Member Function Documentation

template<class Scalar>
virtual void Thyra::ScalarProdBase< Scalar >::scalarProds ( const MultiVectorBase< Scalar > &  X,
const MultiVectorBase< Scalar > &  Y,
Scalar  scalar_prods[] 
) const [pure virtual]

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:

Implemented in Thyra::EuclideanScalarProd< Scalar >, and Thyra::LinearOpScalarProd< Scalar >.

template<class Scalar>
virtual void Thyra::ScalarProdBase< Scalar >::apply ( const EuclideanLinearOpBase< Scalar > &  M,
const ETransp  M_trans,
const MultiVectorBase< Scalar > &  X,
MultiVectorBase< Scalar > *  Y,
const Scalar  alpha,
const Scalar  beta 
) const [pure virtual]

Modify the application of a Euclidean linear operator by inserting the vector space's scalar product.

Note that one responsibility of an implementation of this function is to provide the block scalar product implementation of MultiVectorBase objects that derive from EuclideanLinearOpBase. For example, let M be a MultiVectorBase object and consider the operation

Y = adjoint(M)*X

where M_trans==CONJTRANS. This function may, or many not, call the EuclideanLinearOpBase::euclideanApplyTranspose() function in order to implement this block Scalar product.

Note that the special case of M==X should also be supported which provides the symmetric operation

Y = adjoint(X)*X

that can be performed in half the flops as the general case.

ToDo: Finish documentation!

Implemented in Thyra::EuclideanScalarProd< Scalar >, and Thyra::LinearOpScalarProd< Scalar >.

template<class Scalar>
bool Thyra::ScalarProdBase< Scalar >::isEuclidean (  )  const [virtual]

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).

Reimplemented in Thyra::EuclideanScalarProd< Scalar >.

Definition at line 39 of file Thyra_ScalarProdBase.hpp.

template<class Scalar>
Scalar Thyra::ScalarProdBase< Scalar >::scalarProd ( const VectorBase< Scalar > &  x,
const VectorBase< Scalar > &  y 
) const [virtual]

Return the scalar product of two vectors in the vector space.

Preconditions:

Postconditions:

The default implementation calls on the multi-vector version scalarProds().

Definition at line 45 of file Thyra_ScalarProdBase.hpp.


The documentation for this class was generated from the following files:
Generated on Tue Oct 20 12:47:01 2009 for Thyra Operator/Vector Support by doxygen 1.4.7