Thyra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Thyra_MultiVectorAdapterBase_def.hpp
1 // @HEADER
2 // *****************************************************************************
3 // Thyra: Interfaces and Support for Abstract Numerical Algorithms
4 //
5 // Copyright 2004 NTESS and the Thyra contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef THYRA_MULTI_VECTOR_ADAPTER_BASE_DEF_HPP
11 #define THYRA_MULTI_VECTOR_ADAPTER_BASE_DEF_HPP
12 
13 #include "Thyra_MultiVectorAdapterBase_decl.hpp"
14 #include "Thyra_ScalarProdVectorSpaceBase.hpp"
15 #include "Thyra_ScalarProdBase.hpp"
16 
17 
18 namespace Thyra {
19 
20 
21 // Overridden functions from LinearOp
22 
23 
24 template<class Scalar>
25 RCP<const VectorSpaceBase<Scalar> >
27 {
28  return rangeScalarProdVecSpc();
29 }
30 
31 
32 template<class Scalar>
35 {
36  return domainScalarProdVecSpc();
37 }
38 
39 
40 // Overridden protected functions from LinearOpBase
41 
42 
43 template<class Scalar>
45 {
47  return (M_trans == NOTRANS || M_trans == CONJTRANS);
48  return true;
49 }
50 
51 
52 template<class Scalar>
54  const EOpTransp M_trans,
55  const MultiVectorBase<Scalar> &X,
56  const Ptr<MultiVectorBase<Scalar> > &Y,
57  const Scalar alpha,
58  const Scalar beta
59  ) const
60 {
61  //
62  // Perform:
63  //
64  // NOTRANS: Y = beta*Y + alpha * M * Q_D * X
65  //
66  // CONJTRANS: Y = beta*Y + alpha * M^H * Q_R * X
67  //
68  // where T = Q_D * X or Q_R * X
69  //
71  ( real_trans(M_trans) == NOTRANS
72  ? domainScalarProdVecSpc()
73  : rangeScalarProdVecSpc() );
74  RCP<const ScalarProdBase<Scalar> > scalarProd = scalarProdVecSpc->getScalarProd();
75  if (scalarProd->isEuclidean()) {
76  // Y = beta*Y + alpha * op(M) * X
77  this->euclideanApply(M_trans, X, Y, alpha, beta);
78  }
79  else {
80  // T = Q * X
81  RCP<MultiVectorBase<Scalar> > T = createMembers(X.range(), X.domain());
82  ::Thyra::apply(*scalarProd->getLinearOp(), NOTRANS, X, T.ptr());
83  // Y = beta*Y + alpha * op(M) * T
84  this->euclideanApply(M_trans, *T, Y, alpha, beta);
85  }
86 }
87 
88 
89 } // namespace Thyra
90 
91 
92 #endif // THYRA_MULTI_VECTOR_ADAPTER_BASE_DEF_HPP
RCP< const VectorSpaceBase< Scalar > > domain() const
Returns this-&gt;domainScalarProdVecSpc()
void applyImpl(const EOpTransp M_trans, const MultiVectorBase< Scalar > &X, const Ptr< MultiVectorBase< Scalar > > &Y, const Scalar alpha, const Scalar beta) const
virtual RCP< const VectorSpaceBase< Scalar > > range() const =0
Return a smart pointer for the range space for this operator.
EOpTransp
Enumeration for determining how a linear operator is applied. `*.
Use the non-transposed operator.
EOpTransp real_trans(EOpTransp transp)
Return NOTRANS or TRANS for real scalar valued operators and this also is used for determining struct...
Use the transposed operator with complex-conjugate clements (same as TRANS for real scalar types)...
Interface for a collection of column vectors called a multi-vector.
bool opSupportedImpl(EOpTransp M_trans) const
Ptr< T > ptr() const
virtual RCP< const VectorSpaceBase< Scalar > > domain() const =0
Return a smart pointer for the domain space for this operator.
RCP< const VectorSpaceBase< Scalar > > range() const
Returns this-&gt;rangeScalarProdVecSpc()