Thyra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Thyra_DefaultAdjointLinearOpWithSolve_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_DEFAULT_ADJOINT_LINEAR_OP_WITH_SOLVE_DEF_HPP
11 #define THYRA_DEFAULT_ADJOINT_LINEAR_OP_WITH_SOLVE_DEF_HPP
12 
13 
14 #include "Thyra_DefaultAdjointLinearOpWithSolve_decl.hpp"
15 #include "Thyra_LinearOpWithSolveBase.hpp"
16 
17 
18 namespace Thyra {
19 
20 
21 // Constructors/initializers/accessors
22 
23 
24 template<class Scalar>
26  : transp_(NOTRANS)
27 {}
28 
29 
30 template<class Scalar>
32  const RCP<LinearOpWithSolveBase<Scalar> > &lows,
33  const EOpTransp transp )
34 {
35  lows_ = lows;
36  transp_ = transp;
37 }
38 
39 
40 template<class Scalar>
42  const RCP<const LinearOpWithSolveBase<Scalar> > &lows,
43  const EOpTransp transp )
44 {
45  lows_ = lows;
46  transp_ = transp;
47 }
48 
49 
50 template<class Scalar>
53 {
54  return lows_.getNonconstObj();
55 }
56 
57 
58 template<class Scalar>
61 {
62  return lows_.getConstObj();
63 }
64 
65 
66 // Overridden from LinearOpBase */
67 
68 
69 template<class Scalar>
72 {
73  return ( real_trans(transp_) == NOTRANS
74  ? lows_()->range() : lows_()->domain() );
75 }
76 
77 
78 template<class Scalar>
81 {
82  return ( real_trans(transp_) == NOTRANS
83  ? lows_()->domain() : lows_()->range() );
84 }
85 
86 
87 // protected
88 
89 
90 // Overridden from LinearOpBase
91 
92 
93 template<class Scalar>
95  EOpTransp M_trans) const
96 {
97  return Thyra::opSupported(*lows_(), trans_trans(transp_, M_trans));
98 }
99 
100 
101 template<class Scalar>
103  const EOpTransp M_trans,
104  const MultiVectorBase<Scalar> &X,
105  const Ptr<MultiVectorBase<Scalar> > &Y,
106  const Scalar alpha,
107  const Scalar beta
108  ) const
109 {
110  Thyra::apply( *lows_(), trans_trans(transp_, M_trans),
111  X, Y, alpha, beta );
112 }
113 
114 
115 // Overridden from LinearOpWithSolveBase
116 
117 
118 template<class Scalar>
120 {
121  return Thyra::solveSupports(*lows_(), trans_trans(transp_, M_trans));
122 }
123 
124 
125 template<class Scalar>
127  EOpTransp M_trans, const SolveMeasureType& solveMeasureType) const
128 {
129  return Thyra::solveSupportsSolveMeasureType(*lows_(),
130  trans_trans(transp_, M_trans), solveMeasureType );
131 }
132 
133 
134 
135 template<class Scalar>
138  const EOpTransp transp,
139  const MultiVectorBase<Scalar> &B,
140  const Ptr<MultiVectorBase<Scalar> > &X,
141  const Ptr<const SolveCriteria<Scalar> > solveCriteria
142  ) const
143 {
144  return Thyra::solve( *lows_(), trans_trans(transp_, transp),
145  B, X, solveCriteria );
146 }
147 
148 
149 } // namespace Thyra
150 
151 
152 #endif // THYRA_DEFAULT_ADJOINT_LINEAR_OP_WITH_SOLVE_DEF_HPP
bool solveSupportsSolveMeasureTypeImpl(EOpTransp M_trans, const SolveMeasureType &solveMeasureType) const
Base class for all linear operators that can support a high-level solve operation.
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...
const RCP< const LinearOpWithSolveBase< Scalar > > getOp() const
Get the const underlying LOWSB object.
RCP< const VectorSpaceBase< Scalar > > range() const
Interface for a collection of column vectors called a multi-vector.
const RCP< LinearOpWithSolveBase< Scalar > > getNonconstOp()
Get the non-const underlying LOWSB object.
EOpTransp trans_trans(EOpTransp trans1, EOpTransp trans2)
Combine two transpose arguments.
SolveStatus< Scalar > solveImpl(const EOpTransp transp, const MultiVectorBase< Scalar > &B, const Ptr< MultiVectorBase< Scalar > > &X, const Ptr< const SolveCriteria< Scalar > > solveCriteria) const
Simple struct for the return status from a solve.
RCP< const VectorSpaceBase< Scalar > > domain() const
Simple struct that defines the requested solution criteria for a solve.
void applyImpl(const EOpTransp M_trans, const MultiVectorBase< Scalar > &X, const Ptr< MultiVectorBase< Scalar > > &Y, const Scalar alpha, const Scalar beta) const
void initialize(const RCP< LinearOpWithSolveBase< Scalar > > &lows, const EOpTransp transp)
Initialize with non-const LOWSB .