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

Abstract interface for scalar products. More...

#include <Thyra_ScalarProdBase_decl.hpp>

Inheritance diagram for Thyra::ScalarProdBase< Scalar >:

Inheritance graph
[legend]
List of all members.

Destructor

virtual ~ScalarProdBase ()
 

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.
void euclideanApply (const EuclideanLinearOpBase< Scalar > &M, const EOpTransp M_trans, const MultiVectorBase< Scalar > &X, const Ptr< MultiVectorBase< Scalar > > &Y, const Scalar alpha, const Scalar beta) const
 Modify the application of a Euclidean linear operator by inserting the vector space's scalar product.
virtual bool isEuclideanImpl () const =0
 Protected virtual functions. .
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 void euclideanApplyImpl (const EuclideanLinearOpBase< Scalar > &M, const EOpTransp M_trans, const MultiVectorBase< Scalar > &X, const Ptr< MultiVectorBase< Scalar > > &Y, const Scalar alpha, const Scalar beta) const =0
 

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 77 of file Thyra_ScalarProdBase_decl.hpp.


Constructor & Destructor Documentation

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

Definition at line 84 of file Thyra_ScalarProdBase_decl.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 97 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 default implementation calls on the multi-vector version scalarProds().

Definition at line 121 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:

Definition at line 159 of file Thyra_ScalarProdBase_decl.hpp.

template<class Scalar>
void Thyra::ScalarProdBase< Scalar >::euclideanApply ( const EuclideanLinearOpBase< Scalar > &  M,
const EOpTransp  M_trans,
const MultiVectorBase< Scalar > &  X,
const Ptr< MultiVectorBase< Scalar > > &  Y,
const Scalar  alpha,
const Scalar  beta 
) const [inline]

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!

Definition at line 189 of file Thyra_ScalarProdBase_decl.hpp.

template<class Scalar>
virtual bool Thyra::ScalarProdBase< Scalar >::isEuclideanImpl (  )  const [protected, pure virtual]

Protected virtual functions. .

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

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

Default implementation calls scalarProdsImpl().

Definition at line 44 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 [protected, pure virtual]

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

template<class Scalar>
virtual void Thyra::ScalarProdBase< Scalar >::euclideanApplyImpl ( const EuclideanLinearOpBase< Scalar > &  M,
const EOpTransp  M_trans,
const MultiVectorBase< Scalar > &  X,
const Ptr< MultiVectorBase< Scalar > > &  Y,
const Scalar  alpha,
const Scalar  beta 
) const [protected, pure virtual]

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


The documentation for this class was generated from the following files:
Generated on Wed May 12 21:27:03 2010 for Thyra Operator/Vector Support by  doxygen 1.4.7