Thyra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
17 namespace Thyra {
18 
19 
87 template<class Scalar>
88 class DefaultMultipliedLinearOp : virtual public MultipliedLinearOpBase<Scalar>
89 {
90 public:
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 
205 protected:
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,
220  const MultiVectorBase<Scalar> &X,
221  const Ptr<MultiVectorBase<Scalar> > &Y,
222  const Scalar alpha,
223  const Scalar beta
224  ) const;
225 
227 
228 public:
229 
230 private:
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 
254 template<class Scalar>
255 inline
258 {
260 }
261 
262 
267 template<class Scalar>
270 {
271  RCP<DefaultMultipliedLinearOp<Scalar> > dmlo = defaultMultipliedLinearOp<Scalar>();
272  dmlo->initialize(Ops);
273  return dmlo;
274 }
275 
276 
281 template<class Scalar>
284 {
285  RCP<DefaultMultipliedLinearOp<Scalar> > dmlo = defaultMultipliedLinearOp<Scalar>();
286  dmlo->initialize(Ops);
287  return dmlo;
288 }
289 
290 
296 template<class Scalar>
298 nonconstMultiply(
299  const RCP<LinearOpBase<Scalar> > &A,
300  const RCP<LinearOpBase<Scalar> > &B,
301  const std::string &M_label = ""
302  );
303 
304 
310 template<class Scalar>
312 multiply(
313  const RCP<const LinearOpBase<Scalar> > &A,
314  const RCP<const LinearOpBase<Scalar> > &B,
315  const std::string &M_label = ""
316  );
317 
318 
324 template<class Scalar>
326 multiply(
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
EOpTransp
Enumeration for determining how a linear operator is applied. `*.
RCP< const VectorSpaceBase< Scalar > > domain() const
Returns this-&gt;getOp(this-&gt;numOps()-1).domain() if &lt;t&gt;this-&gt;numOps() &gt; 0 and returns Teuchos::null oth...
DefaultMultipliedLinearOp()
Constructs to uninitialized.
RCP< DefaultMultipliedLinearOp< Scalar > > defaultMultipliedLinearOp(const ArrayView< const RCP< const LinearOpBase< Scalar > > > &Ops)
Nonmember constructor.
RCP< DefaultMultipliedLinearOp< Scalar > > defaultMultipliedLinearOp()
Nonmember constructor.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
Prints the details about the constituent linear operators.
void initialize(const ArrayView< const RCP< LinearOpBase< Scalar > > > &Ops)
Initialize given a list of non-const linear operators.
Interface class for implicitly multiplied linear operators.
bool opSupportedImpl(EOpTransp M_trans) const
Returns true only if all constituent operators support M_trans.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Teuchos::Ordinal Ordinal
Type for the dimension of a vector space. `*.
Interface for a collection of column vectors called a multi-vector.
RCP< const LinearOpBase< Scalar > > clone() const
RCP< LinearOpBase< Scalar > > getNonconstOp(const int k)
Concrete composite LinearOpBase subclass that creates an implicitly multiplied linear operator out of...
RCP< DefaultMultipliedLinearOp< Scalar > > defaultMultipliedLinearOp(const ArrayView< const RCP< LinearOpBase< Scalar > > > &Ops)
Nonmember constructor.
Base class for all linear operators.
std::string description() const
Prints just the name DefaultMultipliedLinearOp along with the overall dimensions and the number of co...
void applyImpl(const EOpTransp M_trans, const MultiVectorBase< Scalar > &X, const Ptr< MultiVectorBase< Scalar > > &Y, const Scalar alpha, const Scalar beta) const
RCP< const LinearOpBase< Scalar > > getOp(const int k) const
RCP< const VectorSpaceBase< Scalar > > range() const
Returns this-&gt;getOp(0).range() if &lt;t&gt;this-&gt;numOps() &gt; 0 and returns Teuchos::null otherwise...