Thyra Version of the Day
Loading...
Searching...
No Matches
Thyra_DefaultAdjointLinearOpWithSolve_decl.hpp
1// @HEADER
2// ***********************************************************************
3//
4// Thyra: Interfaces and Support for Abstract Numerical Algorithms
5// Copyright (2004) Sandia Corporation
6//
7// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8// license for use of this work by or on behalf of the U.S. Government.
9//
10// Redistribution and use in source and binary forms, with or without
11// modification, are permitted provided that the following conditions are
12// met:
13//
14// 1. Redistributions of source code must retain the above copyright
15// notice, this list of conditions and the following disclaimer.
16//
17// 2. Redistributions in binary form must reproduce the above copyright
18// notice, this list of conditions and the following disclaimer in the
19// documentation and/or other materials provided with the distribution.
20//
21// 3. Neither the name of the Corporation nor the names of the
22// contributors may be used to endorse or promote products derived from
23// this software without specific prior written permission.
24//
25// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36//
37// Questions? Contact Roscoe A. Bartlett (bartlettra@ornl.gov)
38//
39// ***********************************************************************
40// @HEADER
41
42
43#ifndef THYRA_DEFAULT_ADJOINT_LINEAR_OP_WITH_SOLVE_DECL_HPP
44#define THYRA_DEFAULT_ADJOINT_LINEAR_OP_WITH_SOLVE_DECL_HPP
45
46
47#include "Thyra_LinearOpWithSolveBase.hpp"
48#include "Teuchos_ConstNonconstObjectContainer.hpp"
49
50
51namespace Thyra {
52
53
59template<class Scalar>
61{
62public:
63
66
69
72 const EOpTransp transp );
73
75 void initialize( const RCP<const LinearOpWithSolveBase<Scalar> > &lows,
76 const EOpTransp transp );
77
80
83
85
88
93
95
96protected:
97
101 bool opSupportedImpl(EOpTransp M_trans) const;
103 void applyImpl(
104 const EOpTransp M_trans,
106 const Ptr<MultiVectorBase<Scalar> > &Y,
107 const Scalar alpha,
108 const Scalar beta
109 ) const;
111
115 bool solveSupportsImpl(EOpTransp M_trans) const;
118 EOpTransp M_trans, const SolveMeasureType& solveMeasureType) const;
121 const EOpTransp transp,
123 const Ptr<MultiVectorBase<Scalar> > &X,
124 const Ptr<const SolveCriteria<Scalar> > solveCriteria
125 ) const;
127
128private:
129
130 // //////////////////////////
131 // Private types
132
134 CNCLOWS;
135
136 // /////////////////////////
137 // Private data members
138
139 CNCLOWS lows_;
140 EOpTransp transp_;
141
142};
143
144
149template<class Scalar>
151defaultAdjointLinearOpWithSolve(
152 const RCP<const LinearOpWithSolveBase<Scalar> > &lows,
153 const EOpTransp transp )
154{
157 dalows->initialize(lows, transp);
158 return dalows;
159}
160
161
166template<class Scalar>
167RCP<DefaultAdjointLinearOpWithSolve<Scalar> >
168defaultAdjointLinearOpWithSolveNonconst(
169 const RCP<LinearOpWithSolveBase<Scalar> > &lows,
170 const EOpTransp transp )
171{
172 RCP<DefaultAdjointLinearOpWithSolve<Scalar> >
173 dalows = Teuchos::rcp(new DefaultAdjointLinearOpWithSolve<Scalar>);
174 dalows->initialize(lows, transp);
175 return dalows;
176}
177
178
183template<class Scalar>
184RCP<const LinearOpWithSolveBase<Scalar> >
185adjointLows( const RCP<const LinearOpWithSolveBase<Scalar> > &lows )
186{
187 return defaultAdjointLinearOpWithSolve<Scalar>(lows, CONJTRANS);
188}
189
190
195template<class Scalar>
196RCP<LinearOpWithSolveBase<Scalar> >
197nonconstAdjointLows( const RCP<LinearOpWithSolveBase<Scalar> > &lows )
198{
199 return defaultAdjointLinearOpWithSolveNonconst<Scalar>(lows, CONJTRANS);
200}
201
202
203
204} // end namespace Thyra
205
206
207#endif // THYRA_DEFAULT_ADJOINT_LINEAR_OP_WITH_SOLVE_DECL_HPP
Default concreate decorator subclass for a transpose/adjoint LinearOpWithSolveBase object.
void initialize(const RCP< LinearOpWithSolveBase< Scalar > > &lows, const EOpTransp transp)
Initialize with non-const LOWSB .
const RCP< const LinearOpWithSolveBase< Scalar > > getOp() const
Get the const underlying LOWSB object.
RCP< const VectorSpaceBase< Scalar > > domain() const
RCP< const VectorSpaceBase< Scalar > > range() const
const RCP< LinearOpWithSolveBase< Scalar > > getNonconstOp()
Get the non-const underlying LOWSB object.
SolveStatus< Scalar > solveImpl(const EOpTransp transp, const MultiVectorBase< Scalar > &B, const Ptr< MultiVectorBase< Scalar > > &X, const Ptr< const SolveCriteria< Scalar > > solveCriteria) const
bool solveSupportsSolveMeasureTypeImpl(EOpTransp M_trans, const SolveMeasureType &solveMeasureType) const
void applyImpl(const EOpTransp M_trans, const MultiVectorBase< Scalar > &X, const Ptr< MultiVectorBase< Scalar > > &Y, const Scalar alpha, const Scalar beta) const
Base class for all linear operators that can support a high-level solve operation.
Interface for a collection of column vectors called a multi-vector.
EOpTransp
Enumeration for determining how a linear operator is applied. `*.
@ CONJTRANS
Use the transposed operator with complex-conjugate clements (same as TRANS for real scalar types).
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Simple struct that defines the requested solution criteria for a solve.
Simple struct for the return status from a solve.