Thyra Version of the Day
Loading...
Searching...
No Matches
Thyra_DefaultMultipliedLinearOp_decl.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_MULTIPLIED_LINEAR_OP_DECL_HPP
11#define THYRA_DEFAULT_MULTIPLIED_LINEAR_OP_DECL_HPP
12
13#include "Thyra_MultipliedLinearOpBase.hpp"
14#include "Teuchos_ConstNonconstObjectContainer.hpp"
15
16
17namespace Thyra {
18
19
87template<class Scalar>
89{
90public:
91
94
102
120 void initialize(const ArrayView<const RCP<LinearOpBase<Scalar> > > &Ops);
121
139 void initialize(const ArrayView<const RCP<const LinearOpBase<Scalar> > > &Ops );
140
147 void uninitialize();
148
150
153
155 int numOps() const;
157 bool opIsConst(const int k) const;
161 RCP<const LinearOpBase<Scalar> > getOp(const int k) const;
162
164
167
172
177
180
182
185
189 std::string description() const;
190
198 void describe(
200 const Teuchos::EVerbosityLevel verbLevel
201 ) const;
202
204
205protected:
206
209
213 bool opSupportedImpl(EOpTransp M_trans) const;
214
215 void allocateVecs(const Ordinal dim) const;
216
218 void applyImpl(
219 const EOpTransp M_trans,
221 const Ptr<MultiVectorBase<Scalar> > &Y,
222 const Scalar alpha,
223 const Scalar beta
224 ) const;
225
227
228public:
229
230private:
231
233 mutable std::vector<Teuchos::RCP<MultiVectorBase<Scalar> > > T_k_;
234
235 inline void assertInitialized() const;
236 inline std::string getClassName() const;
237 inline Ordinal getRangeDim() const;
238 inline Ordinal getDomainDim() const;
239
240 void validateOps();
241 void setupDefaultObjectLabel();
242
243 // Not defined and not to be called
246
247};
248
249
254template<class Scalar>
255inline
261
262
267template<class Scalar>
270{
271 RCP<DefaultMultipliedLinearOp<Scalar> > dmlo = defaultMultipliedLinearOp<Scalar>();
272 dmlo->initialize(Ops);
273 return dmlo;
274}
275
276
281template<class Scalar>
284{
285 RCP<DefaultMultipliedLinearOp<Scalar> > dmlo = defaultMultipliedLinearOp<Scalar>();
286 dmlo->initialize(Ops);
287 return dmlo;
288}
289
290
296template<class Scalar>
299 const RCP<LinearOpBase<Scalar> > &A,
300 const RCP<LinearOpBase<Scalar> > &B,
301 const std::string &M_label = ""
302 );
303
304
310template<class Scalar>
313 const RCP<const LinearOpBase<Scalar> > &A,
314 const RCP<const LinearOpBase<Scalar> > &B,
315 const std::string &M_label = ""
316 );
317
318
324template<class Scalar>
327 const RCP<const LinearOpBase<Scalar> > &A,
328 const RCP<const LinearOpBase<Scalar> > &B,
329 const RCP<const LinearOpBase<Scalar> > &C,
330 const std::string &M_label = ""
331 );
332
333
334} // end namespace Thyra
335
336
337#endif // THYRA_DEFAULT_MULTIPLIED_LINEAR_OP_DECL_HPP
Concrete composite LinearOpBase subclass that creates an implicitly multiplied linear operator out of...
RCP< LinearOpBase< Scalar > > nonconstMultiply(const RCP< LinearOpBase< Scalar > > &A, const RCP< LinearOpBase< Scalar > > &B, const std::string &M_label="")
Form an implicit multiplication of two linear operators: M = A.
RCP< const LinearOpBase< Scalar > > getOp(const int k) const
RCP< DefaultMultipliedLinearOp< Scalar > > defaultMultipliedLinearOp(const ArrayView< const RCP< const LinearOpBase< Scalar > > > &Ops)
Nonmember constructor.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
Prints the details about the constituent linear operators.
RCP< const VectorSpaceBase< Scalar > > range() const
Returns this->getOp(0).range() if <t>this->numOps() > 0 and returns Teuchos::null otherwise.
void initialize(const ArrayView< const RCP< LinearOpBase< Scalar > > > &Ops)
Initialize given a list of non-const linear operators.
RCP< const VectorSpaceBase< Scalar > > domain() const
Returns this->getOp(this->numOps()-1).domain() if <t>this->numOps() > 0 and returns Teuchos::null oth...
std::string description() const
Prints just the name DefaultMultipliedLinearOp along with the overall dimensions and the number of co...
RCP< const LinearOpBase< Scalar > > clone() const
RCP< DefaultMultipliedLinearOp< Scalar > > defaultMultipliedLinearOp()
Nonmember constructor.
RCP< LinearOpBase< Scalar > > getNonconstOp(const int k)
RCP< const LinearOpBase< Scalar > > multiply(const RCP< const LinearOpBase< Scalar > > &A, const RCP< const LinearOpBase< Scalar > > &B, const RCP< const LinearOpBase< Scalar > > &C, const std::string &M_label="")
Form an implicit multiplication of three linear operators: M = A * B * C.
bool opSupportedImpl(EOpTransp M_trans) const
Returns true only if all constituent operators support M_trans.
RCP< const LinearOpBase< Scalar > > multiply(const RCP< const LinearOpBase< Scalar > > &A, const RCP< const LinearOpBase< Scalar > > &B, const std::string &M_label="")
Form an implicit multiplication of two linear operators: M = A.
RCP< DefaultMultipliedLinearOp< Scalar > > defaultMultipliedLinearOp(const ArrayView< const RCP< LinearOpBase< Scalar > > > &Ops)
Nonmember constructor.
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.
Interface for a collection of column vectors called a multi-vector.
Interface class for implicitly multiplied linear operators.
EOpTransp
Enumeration for determining how a linear operator is applied. `*.
Teuchos::Ordinal Ordinal
Type for the dimension of a vector space. `*.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)