10#ifndef THYRA_DEFAULT_COLUMNWISE_MULTI_VECTOR_DEF_HPP 
   11#define THYRA_DEFAULT_COLUMNWISE_MULTI_VECTOR_DEF_HPP 
   13#include "Thyra_DefaultColumnwiseMultiVector_decl.hpp" 
   14#include "Thyra_MultiVectorDefaultBase.hpp" 
   15#include "Thyra_VectorSpaceBase.hpp" 
   16#include "Thyra_VectorBase.hpp" 
   17#include "Thyra_MultiVectorBase.hpp" 
   18#include "Thyra_VectorStdOps.hpp" 
   19#include "Thyra_VectorSpaceFactoryBase.hpp" 
   20#include "Thyra_AssertOp.hpp" 
   21#include "Teuchos_Assert.hpp" 
   22#include "Teuchos_as.hpp" 
   40  this->initialize(col_vec);
 
 
   51  this->initialize(range_in, domain_in, col_vecs_in);
 
 
   61  const std::string err_msg =
 
   62    "DefaultColumnwiseMultiVector<Scalar>::initialize(...): Error!";
 
   66  range_  = col_vec->space();
 
   67  domain_ = range_->smallVecSpcFcty()->createVecSpc(1);
 
   69  col_vecs_[0] = col_vec;
 
 
   81  const std::string err_msg =
 
   82    "DefaultColumnwiseMultiVector<Scalar>::initialize(...): Error!";
 
   89  const int domainDim = domain_in->dim();
 
   93  col_vecs_.reserve(domainDim);
 
   94  if (col_vecs.size()) {
 
   95    for( 
Ordinal j = 0; j < domainDim; ++j )
 
   96      col_vecs_.push_back(col_vecs[j]);
 
   99    for( 
Ordinal j = 0; j < domainDim; ++j )
 
  100      col_vecs_.push_back(createMember(range_));
 
 
  105template<
class Scalar>
 
  117template<
class Scalar>
 
  125template<
class Scalar>
 
  136template<
class Scalar>
 
  139  const Ordinal m = col_vecs_.size();
 
  140  for (
Ordinal col_j = 0; col_j < m; ++col_j) {
 
  141    col_vecs_[col_j]->assign(alpha);
 
 
  146template<
class Scalar>
 
  155  for (
Ordinal col_j = 0; col_j < col_vecs_.size(); ++col_j) {
 
  156    col_vecs_[col_j]->assign(*mv.
col(col_j));
 
 
  161template<
class Scalar>
 
  164  for (
Ordinal col_j = 0; col_j < col_vecs_.size(); ++col_j) {
 
  165    col_vecs_[col_j]->scale(alpha);
 
 
  170template<
class Scalar>
 
  180  for (
Ordinal col_j = 0; col_j < col_vecs_.size(); ++col_j) {
 
  181    col_vecs_[col_j]->update(alpha, *mv.
col(col_j));
 
 
  186template<
class Scalar>
 
  195  for (
Ordinal i = 0; i < mv.size(); ++i) {
 
  202  for (
Ordinal col_j = 0; col_j < col_vecs_.size(); ++col_j) {
 
  203    for (
Ordinal i = 0; i < mv.size(); ++i) {
 
  204      v_rcp[i] = mv[i]->col(col_j);
 
  205      v[i] = v_rcp[i].ptr();
 
  207    col_vecs_[col_j]->linear_combination(alpha, v(), beta);
 
 
  212template<
class Scalar>
 
  223  for (
Ordinal col_j = 0; col_j < col_vecs_.size(); ++col_j) {
 
  224    prods[col_j] = col_vecs_[col_j]->dot(*mv.
col(col_j));
 
 
  229template<
class Scalar>
 
  237  for (
Ordinal col_j = 0; col_j < col_vecs_.size(); ++col_j) {
 
  238    norms[col_j] = col_vecs_[col_j]->norm_1();
 
 
  243template<
class Scalar>
 
  251  for (
Ordinal col_j = 0; col_j < col_vecs_.size(); ++col_j) {
 
  252    norms[col_j] = col_vecs_[col_j]->norm_2();
 
 
  257template<
class Scalar>
 
  265  for (
Ordinal col_j = 0; col_j < col_vecs_.size(); ++col_j) {
 
  266    norms[col_j] = col_vecs_[col_j]->norm_inf();
 
 
  275template<
class Scalar>
 
  279  return ( ST::isComplex ? ( M_trans==
NOTRANS || M_trans==
CONJTRANS ) : true );
 
 
  283template<
class Scalar>
 
  294    "MultiVectorBase<Scalar>::apply()", *
this, M_trans, X, &*Y);
 
  296  const Ordinal nc = this->domain()->dim();
 
  298  for (
Ordinal col_j = 0; col_j < m; ++col_j) {
 
  302    Vt_S(y_j.
ptr(), beta);
 
  310      x_j->acquireDetachedView(
Range1D(), &x_sub_vec);
 
  312      for (
Ordinal j = 0; j < nc; ++j )
 
  313        Vp_StV( y_j.
ptr(), Scalar(alpha*x_sub_vec(j)), *this->col(j) );
 
  315      x_j->releaseDetachedView(&x_sub_vec);
 
  326      y_j->acquireDetachedView(
Range1D(), &y_sub_vec);
 
  328      for (
Ordinal j = 0; j < nc; ++j )
 
  329        y_sub_vec(j) += alpha*dot(*this->col(j), *x_j);
 
  331      y_j->commitDetachedView(&y_sub_vec);
 
 
  340template<
class Scalar>
 
  345  const int num_cols = col_vecs_.size();
 
  347    !(  0 <= j  && j < num_cols ), std::logic_error
 
  348    ,
"Error, j = " << j << 
" does not fall in the range [0,"<<(num_cols-1)<< 
"]!" 
 
  354template<
class Scalar>
 
  360  const Ordinal numCols = domain_->dim();
 
  361  const Range1D col_rng = Teuchos::full_range(col_rng_in,0,numCols-1);
 
  364    !( col_rng.
ubound() < numCols ), std::logic_error
 
  365    ,
"DefaultColumnwiseMultiVector<Scalar>::subView(col_rng):" 
  366    "Error, the input range col_rng = ["<<col_rng.
lbound()
 
  367    <<
","<<col_rng.
ubound()<<
"] " 
  368    "is not in the range [0,"<<(numCols-1)<<
"]!" 
  374      domain_->smallVecSpcFcty()->createVecSpc(col_rng.
size()),
 
 
Default subclass for MultiVectorBase implemented using columns of separate abstract vectors.
 
virtual void scaleImpl(Scalar alpha)
 
void applyImpl(const EOpTransp M_trans, const MultiVectorBase< Scalar > &X, const Ptr< MultiVectorBase< Scalar > > &Y, const Scalar alpha, const Scalar beta) const
This function is implemented in terms of the multi-vector applyOp() function.
 
virtual void assignMultiVecImpl(const MultiVectorBase< Scalar > &mv)
 
RCP< MultiVectorBase< Scalar > > nonconstContigSubViewImpl(const Range1D &col_rng)
 
virtual void linearCombinationImpl(const ArrayView< const Scalar > &alpha, const ArrayView< const Ptr< const MultiVectorBase< Scalar > > > &mv, const Scalar &beta)
 
virtual void updateImpl(Scalar alpha, const MultiVectorBase< Scalar > &mv)
 
void uninitialize()
Set uninitialized.
 
virtual void dotsImpl(const MultiVectorBase< Scalar > &mv, const ArrayView< Scalar > &prods) const
 
virtual void norms2Impl(const ArrayView< typename ScalarTraits< Scalar >::magnitudeType > &norms) const
 
virtual void normsInfImpl(const ArrayView< typename ScalarTraits< Scalar >::magnitudeType > &norms) const
 
virtual void norms1Impl(const ArrayView< typename ScalarTraits< Scalar >::magnitudeType > &norms) const
 
RCP< const VectorSpaceBase< Scalar > > domain() const
 
void initialize(const RCP< VectorBase< Scalar > > &col_vec)
Initialize given a single vector object.
 
virtual void assignImpl(Scalar alpha)
 
RCP< const VectorSpaceBase< Scalar > > range() const
 
DefaultColumnwiseMultiVector()
Construct to initialized.
 
RCP< VectorBase< Scalar > > nonconstColImpl(Ordinal j)
 
bool opSupportedImpl(EOpTransp M_trans) const
For complex Scalar types returns true for NOTRANS and CONJTRANS and for real types returns true for a...
 
virtual RCP< const VectorSpaceBase< Scalar > > range() const =0
Return a smart pointer for the range space for this operator.
 
virtual RCP< const VectorSpaceBase< Scalar > > domain() const =0
Return a smart pointer for the domain space for this operator.
 
Interface for a collection of column vectors called a multi-vector.
 
RCP< const VectorBase< Scalar > > col(Ordinal j) const
Calls colImpl().
 
Abstract interface for finite-dimensional dense vectors.
 
Abstract interface for objects that represent a space for vectors.
 
#define TEUCHOS_ASSERT(assertion_test)
 
#define TEUCHOS_TEST_FOR_EXCEPT_MSG(throw_exception_test, msg)
 
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
 
#define TEUCHOS_ASSERT_EQUALITY(val1, val2)
 
#define THYRA_ASSERT_LINEAR_OP_MULTIVEC_APPLY_SPACES(FUNC_NAME, M, M_T, X, Y)
This is a very useful macro that should be used to validate that the spaces for the multi-vector vers...
 
EOpTransp
Enumeration for determining how a linear operator is applied. `*.
 
Teuchos::Ordinal Ordinal
Type for the dimension of a vector space. `*.
 
@ NOTRANS
Use the non-transposed operator.
 
@ CONJTRANS
Use the transposed operator with complex-conjugate clements (same as TRANS for real scalar types).
 
TypeTo as(const TypeFrom &t)
 
T_To & dyn_cast(T_From &from)
 
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)