Thyra Version of the Day
Loading...
Searching...
No Matches
Thyra_DefaultMultipliedLinearOp_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#ifndef THYRA_DEFAULT_MULTIPLIED_LINEAR_OP_DECL_HPP
43#define THYRA_DEFAULT_MULTIPLIED_LINEAR_OP_DECL_HPP
44
45#include "Thyra_MultipliedLinearOpBase.hpp"
46#include "Teuchos_ConstNonconstObjectContainer.hpp"
47
48
49namespace Thyra {
50
51
119template<class Scalar>
121{
122public:
123
126
134
152 void initialize(const ArrayView<const RCP<LinearOpBase<Scalar> > > &Ops);
153
171 void initialize(const ArrayView<const RCP<const LinearOpBase<Scalar> > > &Ops );
172
179 void uninitialize();
180
182
185
187 int numOps() const;
189 bool opIsConst(const int k) const;
193 RCP<const LinearOpBase<Scalar> > getOp(const int k) const;
194
196
199
204
209
212
214
217
221 std::string description() const;
222
230 void describe(
232 const Teuchos::EVerbosityLevel verbLevel
233 ) const;
234
236
237protected:
238
241
245 bool opSupportedImpl(EOpTransp M_trans) const;
246
248 void applyImpl(
249 const EOpTransp M_trans,
251 const Ptr<MultiVectorBase<Scalar> > &Y,
252 const Scalar alpha,
253 const Scalar beta
254 ) const;
255
257
258public:
259
260private:
261
263
264 inline void assertInitialized() const;
265 inline std::string getClassName() const;
266 inline Ordinal getRangeDim() const;
267 inline Ordinal getDomainDim() const;
268
269 void validateOps();
270 void setupDefaultObjectLabel();
271
272 // Not defined and not to be called
275
276};
277
278
283template<class Scalar>
284inline
287{
289}
290
291
296template<class Scalar>
299{
300 RCP<DefaultMultipliedLinearOp<Scalar> > dmlo = defaultMultipliedLinearOp<Scalar>();
301 dmlo->initialize(Ops);
302 return dmlo;
303}
304
305
310template<class Scalar>
313{
314 RCP<DefaultMultipliedLinearOp<Scalar> > dmlo = defaultMultipliedLinearOp<Scalar>();
315 dmlo->initialize(Ops);
316 return dmlo;
317}
318
319
325template<class Scalar>
328 const RCP<LinearOpBase<Scalar> > &A,
329 const RCP<LinearOpBase<Scalar> > &B,
330 const std::string &M_label = ""
331 );
332
333
339template<class Scalar>
342 const RCP<const LinearOpBase<Scalar> > &A,
343 const RCP<const LinearOpBase<Scalar> > &B,
344 const std::string &M_label = ""
345 );
346
347
353template<class Scalar>
356 const RCP<const LinearOpBase<Scalar> > &A,
357 const RCP<const LinearOpBase<Scalar> > &B,
358 const RCP<const LinearOpBase<Scalar> > &C,
359 const std::string &M_label = ""
360 );
361
362
363} // end namespace Thyra
364
365
366#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)