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

Base node implementation class for SPMD multi-vectors. More...

#include <Thyra_SpmdMultiVectorDefaultBase_decl.hpp>

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

Constructors / initializers / accessors

 SpmdMultiVectorDefaultBase ()
 

Overridden public functions from MultiVectorAdapterBase

RCP< const
ScalarProdVectorSpaceBase
< Scalar > > 
rangeScalarProdVecSpc () const
 Returns spmdSpace. More...
 

Protected funtions overridden from SpmdMultiVectorBase.

RTOpPack::SubMultiVectorView
< Scalar > 
getNonconstLocalSubMultiVectorImpl ()
 
RTOpPack::ConstSubMultiVectorView
< Scalar > 
getLocalSubMultiVectorImpl () const
 

Protected functions overridden from MultiVectorBase

void mvMultiReductApplyOpImpl (const RTOpPack::RTOpT< Scalar > &primary_op, const ArrayView< const Ptr< const MultiVectorBase< Scalar > > > &multi_vecs, const ArrayView< const Ptr< MultiVectorBase< Scalar > > > &targ_multi_vecs, const ArrayView< const Ptr< RTOpPack::ReductTarget > > &reduct_objs, const Ordinal primary_global_offset) const
 
void acquireDetachedMultiVectorViewImpl (const Range1D &rowRng, const Range1D &colRng, RTOpPack::ConstSubMultiVectorView< Scalar > *sub_mv) const
 
void releaseDetachedMultiVectorViewImpl (RTOpPack::ConstSubMultiVectorView< Scalar > *sub_mv) const
 
void acquireNonconstDetachedMultiVectorViewImpl (const Range1D &rowRng, const Range1D &colRng, RTOpPack::SubMultiVectorView< Scalar > *sub_mv)
 
void commitNonconstDetachedMultiVectorViewImpl (RTOpPack::SubMultiVectorView< Scalar > *sub_mv)
 

Protected functions overridden from MultiVectorAdapterBase

void euclideanApply (const EOpTransp M_trans, const MultiVectorBase< Scalar > &X, const Ptr< MultiVectorBase< Scalar > > &Y, const Scalar alpha, const Scalar beta) const
 Uses GEMM() and Teuchos::reduceAll() to implement. More...
 

Protected functions for subclasses to call.

virtual void updateSpmdSpace ()
 Subclasses should call whenever the structure of the VectorSpaceBase changes. More...
 
Range1D validateRowRange (const Range1D &rowRng) const
 Validate and resize the row range. More...
 
Range1D validateColRange (const Range1D &rowCol) const
 Validate and resize the column range. More...
 

Additional Inherited Members

- Public Member Functions inherited from Thyra::SpmdMultiVectorBase< Scalar >
RCP< const SpmdVectorSpaceBase
< Scalar > > 
spmdSpace () const
 Returns the SPMD vector space object for the range of *this multi-vector. More...
 
RTOpPack::SubMultiVectorView
< Scalar > 
getNonconstLocalSubMultiVector ()
 Get a non-const generalized view of local multi-vector data. More...
 
RTOpPack::ConstSubMultiVectorView
< Scalar > 
getLocalSubMultiVector () const
 Get a const generalized view of local multi-vector data. More...
 
void getNonconstLocalData (const Ptr< ArrayRCP< Scalar > > &localValues, const Ptr< Ordinal > &leadingDim)
 Returns a non-const pointer to a Fortran-style view of the local multi-vector data. More...
 
void getLocalData (const Ptr< ArrayRCP< const Scalar > > &localValues, const Ptr< Ordinal > &leadingDim) const
 Returns a const pointer to a Fortran-style view of the local multi-vector data. More...
 
- Public Member Functions inherited from Thyra::MultiVectorBase< Scalar >
void assign (Scalar alpha)
 V = alpha. More...
 
void assign (const MultiVectorBase< Scalar > &mv)
 V = mv. More...
 
void scale (Scalar alpha)
 
void update (Scalar alpha, const MultiVectorBase< Scalar > &mv)
 
void linear_combination (const ArrayView< const Scalar > &alpha, const ArrayView< const Ptr< const MultiVectorBase< Scalar > > > &mv, const Scalar &beta)
 Y.col(j)(i) = beta*Y.col(j)(i) + sum( alpha[k]*X[k].col(j)(i), More...
 
void dots (const MultiVectorBase< Scalar > &mv, const ArrayView< Scalar > &prods) const
 Column-wise Euclidean dot product. More...
 
void norms_1 (const ArrayView< typename ScalarTraits< Scalar >::magnitudeType > &norms) const
 Column-wise 1-norms. More...
 
void norms_2 (const ArrayView< typename ScalarTraits< Scalar >::magnitudeType > &norms) const
 Column-wise 2-norms. More...
 
void norms_inf (const ArrayView< typename ScalarTraits< Scalar >::magnitudeType > &norms) const
 Column-wise infinity-norms. More...
 
RCP< const VectorBase< Scalar > > col (Ordinal j) const
 Calls colImpl(). More...
 
RCP< VectorBase< Scalar > > col (Ordinal j)
 Calls nonconstColImpl(). More...
 
RCP< const MultiVectorBase
< Scalar > > 
subView (const Range1D &colRng) const
 Calls contigSubViewImpl(). More...
 
RCP< MultiVectorBase< Scalar > > subView (const Range1D &colRng)
 Calls nonconstContigSubViewImpl(). More...
 
RCP< const MultiVectorBase
< Scalar > > 
subView (const ArrayView< const int > &cols) const
 nonContigSubViewImpl(). More...
 
RCP< MultiVectorBase< Scalar > > subView (const ArrayView< const int > &cols)
 nonconstNonContigSubViewImpl(). More...
 
void applyOp (const RTOpPack::RTOpT< Scalar > &primary_op, const ArrayView< const Ptr< const MultiVectorBase< Scalar > > > &multi_vecs, const ArrayView< const Ptr< MultiVectorBase< Scalar > > > &targ_multi_vecs, const ArrayView< const Ptr< RTOpPack::ReductTarget > > &reduct_objs, const Ordinal primary_global_offset) const
 Calls mvMultiReductApplyOpImpl(). More...
 
void applyOp (const RTOpPack::RTOpT< Scalar > &primary_op, const RTOpPack::RTOpT< Scalar > &secondary_op, const ArrayView< const Ptr< const MultiVectorBase< Scalar > > > &multi_vecs, const ArrayView< const Ptr< MultiVectorBase< Scalar > > > &targ_multi_vecs, const Ptr< RTOpPack::ReductTarget > &reduct_obj, const Ordinal primary_global_offset) const
 mvSingleReductApplyOpImpl(). More...
 
void acquireDetachedView (const Range1D &rowRng, const Range1D &colRng, RTOpPack::ConstSubMultiVectorView< Scalar > *sub_mv) const
 Calls acquireDetachedMultiVectorViewImpl(). More...
 
void releaseDetachedView (RTOpPack::ConstSubMultiVectorView< Scalar > *sub_mv) const
 Calls releaseDetachedMultiVectorViewImpl(). More...
 
void acquireDetachedView (const Range1D &rowRng, const Range1D &colRng, RTOpPack::SubMultiVectorView< Scalar > *sub_mv)
 Calls acquireNonconstDetachedMultiVectorViewImpl(). More...
 
void commitDetachedView (RTOpPack::SubMultiVectorView< Scalar > *sub_mv)
 Calls commitNonconstDetachedMultiVectorViewImpl(). More...
 
RCP< const LinearOpBase< Scalar > > clone () const
 This function is simply overridden to return this->clone_mv(). More...
 
- Public Member Functions inherited from Thyra::LinearOpBase< Scalar >
bool opSupported (EOpTransp M_trans) const
 Return if the M_trans operation of apply() is supported or not. More...
 
void apply (const EOpTransp M_trans, const MultiVectorBase< Scalar > &X, const Ptr< MultiVectorBase< Scalar > > &Y, const Scalar alpha, const Scalar beta) const
 Apply the linear operator to a multi-vector : Y = alpha*op(M)*X + beta*Y. More...
 
- Public Member Functions inherited from Thyra::RowStatLinearOpBase< Scalar >
bool rowStatIsSupported (const RowStatLinearOpBaseUtils::ERowStat rowStat) const
 Determine if a given row stat is supported. More...
 
void getRowStat (const RowStatLinearOpBaseUtils::ERowStat rowStat, const Ptr< VectorBase< Scalar > > &rowStatVec) const
 Get some statistics about a supported row. More...
 
- Public Member Functions inherited from Thyra::ScaledLinearOpBase< Scalar >
bool supportsScaleLeft () const
 Determines if this objects supports left scaling. More...
 
bool supportsScaleRight () const
 Determines if this objects supports right scaling. More...
 
void scaleLeft (const VectorBase< Scalar > &row_scaling)
 Left scales operator with diagonal scaling operator. More...
 
void scaleRight (const VectorBase< Scalar > &col_scaling)
 Right scales operator with diagonal scaling operator. More...
 
- Public Member Functions inherited from Thyra::MultiVectorAdapterBase< Scalar >
virtual RCP< const
ScalarProdVectorSpaceBase
< Scalar > > 
domainScalarProdVecSpc () const =0
 
RCP< const VectorSpaceBase
< Scalar > > 
range () const
 Returns this->rangeScalarProdVecSpc() More...
 
RCP< const VectorSpaceBase
< Scalar > > 
domain () const
 Returns this->domainScalarProdVecSpc() More...
 
- Public Member Functions inherited from Thyra::MultiVectorDefaultBase< Scalar >
virtual RCP< MultiVectorBase
< Scalar > > 
clone_mv () const
 
- Protected Member Functions inherited from Thyra::SpmdMultiVectorBase< Scalar >
virtual RCP< const
SpmdVectorSpaceBase< Scalar > > 
spmdSpaceImpl () const =0
 Virtual implementation for spmdSpace(). More...
 
virtual void getNonconstLocalMultiVectorDataImpl (const Ptr< ArrayRCP< Scalar > > &localValues, const Ptr< Ordinal > &leadingDim)=0
 Virtual implementation for getNonconstLocalData(). More...
 
virtual void getLocalMultiVectorDataImpl (const Ptr< ArrayRCP< const Scalar > > &localValues, const Ptr< Ordinal > &leadingDim) const =0
 Virtual implementation for getLocalData(). More...
 
- Protected Member Functions inherited from Thyra::MultiVectorBase< Scalar >
void absRowSum (const Teuchos::Ptr< Thyra::VectorBase< Scalar > > &output) const
 
void absColSum (const Teuchos::Ptr< Thyra::VectorBase< Scalar > > &output) const
 
virtual RCP< const VectorBase
< Scalar > > 
colImpl (Ordinal j) const
 Return a non-changeable view of a constituent column vector. More...
 
virtual RCP< VectorBase< Scalar > > nonconstColImpl (Ordinal j)=0
 Return a changeable view of a constituent column vector. More...
 
virtual bool rowStatIsSupportedImpl (const RowStatLinearOpBaseUtils::ERowStat rowStat) const
 
virtual void getRowStatImpl (const RowStatLinearOpBaseUtils::ERowStat rowStat, const Ptr< VectorBase< Scalar > > &rowStatVec) const
 
virtual bool supportsScaleLeftImpl () const
 
virtual bool supportsScaleRightImpl () const
 
virtual void scaleLeftImpl (const VectorBase< Scalar > &row_scaling)
 
virtual void scaleRightImpl (const VectorBase< Scalar > &col_scaling)
 
- Protected Member Functions inherited from Thyra::LinearOpBase< Scalar >
- Protected Member Functions inherited from Thyra::RowStatLinearOpBase< Scalar >
- Protected Member Functions inherited from Thyra::ScaledLinearOpBase< Scalar >
- Protected Member Functions inherited from Thyra::MultiVectorAdapterBase< Scalar >
bool opSupportedImpl (EOpTransp M_trans) const
 
void applyImpl (const EOpTransp M_trans, const MultiVectorBase< Scalar > &X, const Ptr< MultiVectorBase< Scalar > > &Y, const Scalar alpha, const Scalar beta) const
 
- Protected Member Functions inherited from Thyra::MultiVectorDefaultBase< Scalar >
virtual void assignImpl (Scalar alpha)
 Default implementation of assign(scalar) using RTOps. More...
 
virtual void assignMultiVecImpl (const MultiVectorBase< Scalar > &mv)
 Default implementation of assign(MV) using RTOps. More...
 
virtual void scaleImpl (Scalar alpha)
 Default implementation of scale using RTOps. More...
 
virtual void updateImpl (Scalar alpha, const MultiVectorBase< Scalar > &mv)
 Default implementation of update using RTOps. More...
 
virtual void linearCombinationImpl (const ArrayView< const Scalar > &alpha, const ArrayView< const Ptr< const MultiVectorBase< Scalar > > > &mv, const Scalar &beta)
 Default implementation of linear_combination using RTOps. More...
 
virtual void dotsImpl (const MultiVectorBase< Scalar > &mv, const ArrayView< Scalar > &prods) const
 Default implementation of dots using RTOps. More...
 
virtual void norms1Impl (const ArrayView< typename ScalarTraits< Scalar >::magnitudeType > &norms) const
 Default implementation of norms_1 using RTOps. More...
 
virtual void norms2Impl (const ArrayView< typename ScalarTraits< Scalar >::magnitudeType > &norms) const
 Default implementation of norms_2 using RTOps. More...
 
virtual void normsInfImpl (const ArrayView< typename ScalarTraits< Scalar >::magnitudeType > &norms) const
 Default implementation of norms_inf using RTOps. More...
 
RCP< const MultiVectorBase
< Scalar > > 
contigSubViewImpl (const Range1D &colRng) const
 
RCP< MultiVectorBase< Scalar > > nonconstContigSubViewImpl (const Range1D &colRng)
 
RCP< const MultiVectorBase
< Scalar > > 
nonContigSubViewImpl (const ArrayView< const int > &cols) const
 
RCP< MultiVectorBase< Scalar > > nonconstNonContigSubViewImpl (const ArrayView< const int > &cols)
 
virtual void mvSingleReductApplyOpImpl (const RTOpPack::RTOpT< Scalar > &primary_op, const RTOpPack::RTOpT< Scalar > &secondary_op, const ArrayView< const Ptr< const MultiVectorBase< Scalar > > > &multi_vecs, const ArrayView< const Ptr< MultiVectorBase< Scalar > > > &targ_multi_vecs, const Ptr< RTOpPack::ReductTarget > &reduct_obj, const Ordinal primary_global_offset) const
 
- Protected Member Functions inherited from Thyra::LinearOpDefaultBase< Scalar >
std::string description () const
 Default description that gives the label, type, and dimenstion . More...
 
void describe (Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
 Generates a default outputting for all linear operators. More...
 

Detailed Description

template<class Scalar>
class Thyra::SpmdMultiVectorDefaultBase< Scalar >

Base node implementation class for SPMD multi-vectors.

By inheriting from this base class, multi-vector implementations allow their multi-vector objects to be seamlessly combined with other SPMD multi-vector objects (of different concrete types) in applyOp() and apply(). A big part of this protocol is that every multi-vector object can expose an SpmdVectorSpaceBase object through the virtual function spmdSpace().

Notes to subclass developers

Concrete subclasses must override only five functions: spmdSpace(), getLocalData(const Scalar**,Ordinal*), freeLocalData(const Scalar**,Ordinal*), getLocalData(Scalar**,Ordinal*), and commitLocalData(Scalar**,Ordinal*). Note that overriding the spmdSpace() function requires implementing or using a pre-implemented concrete SpmdVectorSpaceBase subclass.

If the acquireDetachedView() functions are ever called with index ranges outside of those of the local process, then the default implementations in MultiVectorBase of all of the functions (const) MultiVectorBase::acquireDetachedView(), MultiVectorBase::releaseDetachedView(), (non-const) MultiVectorBase::acquireDetachedView() and MultiVectorBase::commitDetachedView() are called in instead. Alternatively, a subclass could provide more specialized implementations of these functions (for more efficient gather/scatter operations) if desired but this should not be needed for most use cases.

It is interesting to note that in the above use case that the explicit subvector access functions call on its default implementation defined in MultiVectorBase (which calls on applyOp()) and the operator will be properly applied since the version of applyOp() implemented in this class will only request local vector data and hence there will only be two levels of recursion for any call to an explicit subvector access function. This is a truly elegant result.

Note that a multi-vector subclass derived from this base class must only be directly used in SPMD mode for this to work properly.

Definition at line 98 of file Thyra_SpmdMultiVectorDefaultBase_decl.hpp.

Constructor & Destructor Documentation

template<class Scalar >
Thyra::SpmdMultiVectorDefaultBase< Scalar >::SpmdMultiVectorDefaultBase ( )

Definition at line 77 of file Thyra_SpmdMultiVectorDefaultBase_def.hpp.

Member Function Documentation

template<class Scalar >
RCP< const ScalarProdVectorSpaceBase< Scalar > > Thyra::SpmdMultiVectorDefaultBase< Scalar >::rangeScalarProdVecSpc ( ) const
virtual

Returns spmdSpace.

Implements Thyra::MultiVectorAdapterBase< Scalar >.

Definition at line 91 of file Thyra_SpmdMultiVectorDefaultBase_def.hpp.

template<class Scalar >
RTOpPack::SubMultiVectorView< Scalar > Thyra::SpmdMultiVectorDefaultBase< Scalar >::getNonconstLocalSubMultiVectorImpl ( )
protectedvirtual
template<class Scalar >
RTOpPack::ConstSubMultiVectorView< Scalar > Thyra::SpmdMultiVectorDefaultBase< Scalar >::getLocalSubMultiVectorImpl ( ) const
protectedvirtual
template<class Scalar >
void Thyra::SpmdMultiVectorDefaultBase< Scalar >::mvMultiReductApplyOpImpl ( const RTOpPack::RTOpT< Scalar > &  primary_op,
const ArrayView< const Ptr< const MultiVectorBase< Scalar > > > &  multi_vecs,
const ArrayView< const Ptr< MultiVectorBase< Scalar > > > &  targ_multi_vecs,
const ArrayView< const Ptr< RTOpPack::ReductTarget > > &  reduct_objs,
const Ordinal  primary_global_offset 
) const
protectedvirtual
template<class Scalar >
void Thyra::SpmdMultiVectorDefaultBase< Scalar >::acquireDetachedMultiVectorViewImpl ( const Range1D rowRng,
const Range1D colRng,
RTOpPack::ConstSubMultiVectorView< Scalar > *  sub_mv 
) const
protectedvirtual
template<class Scalar >
void Thyra::SpmdMultiVectorDefaultBase< Scalar >::releaseDetachedMultiVectorViewImpl ( RTOpPack::ConstSubMultiVectorView< Scalar > *  sub_mv) const
protectedvirtual
template<class Scalar >
void Thyra::SpmdMultiVectorDefaultBase< Scalar >::acquireNonconstDetachedMultiVectorViewImpl ( const Range1D rowRng,
const Range1D colRng,
RTOpPack::SubMultiVectorView< Scalar > *  sub_mv 
)
protectedvirtual
template<class Scalar >
void Thyra::SpmdMultiVectorDefaultBase< Scalar >::commitNonconstDetachedMultiVectorViewImpl ( RTOpPack::SubMultiVectorView< Scalar > *  sub_mv)
protectedvirtual
template<class Scalar >
void Thyra::SpmdMultiVectorDefaultBase< Scalar >::euclideanApply ( const EOpTransp  M_trans,
const MultiVectorBase< Scalar > &  X,
const Ptr< MultiVectorBase< Scalar > > &  Y,
const Scalar  alpha,
const Scalar  beta 
) const
protectedvirtual

Uses GEMM() and Teuchos::reduceAll() to implement.

ToDo: Finish documentation!

Implements Thyra::MultiVectorAdapterBase< Scalar >.

Reimplemented in Thyra::TpetraMultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

Definition at line 344 of file Thyra_SpmdMultiVectorDefaultBase_def.hpp.

template<class Scalar >
void Thyra::SpmdMultiVectorDefaultBase< Scalar >::updateSpmdSpace ( )
protectedvirtual

Subclasses should call whenever the structure of the VectorSpaceBase changes.

WARNING! This function can be overridden by subclasses but this particular function implementation must be called back from within any override (i.e. call SpmdMultiVectorDefaultBase<Scalar>::updateSpmdSpace();).

Definition at line 665 of file Thyra_SpmdMultiVectorDefaultBase_def.hpp.

template<class Scalar >
Range1D Thyra::SpmdMultiVectorDefaultBase< Scalar >::validateRowRange ( const Range1D rowRng) const
protected

Validate and resize the row range.

This function throws an exception if the input range is invalid

Definition at line 686 of file Thyra_SpmdMultiVectorDefaultBase_def.hpp.

template<class Scalar >
Range1D Thyra::SpmdMultiVectorDefaultBase< Scalar >::validateColRange ( const Range1D rowCol) const
protected

Validate and resize the column range.

This function throws an exception if the input range is invalid

Definition at line 702 of file Thyra_SpmdMultiVectorDefaultBase_def.hpp.


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