Thyra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Thyra_DefaultZeroLinearOp_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_ZERO_LINEAR_OP_DECL_HPP
43 #define THYRA_DEFAULT_ZERO_LINEAR_OP_DECL_HPP
44 
45 #include "Thyra_ZeroLinearOpBase.hpp"
46 #include "Thyra_RowStatLinearOpBase.hpp"
47 #include "Thyra_ScaledLinearOpBase.hpp"
48 #include "Teuchos_ConstNonconstObjectContainer.hpp"
49 
50 
51 namespace Thyra {
52 
53 
70 template<class Scalar>
72  : virtual public ZeroLinearOpBase<Scalar>
73  , virtual public RowStatLinearOpBase<Scalar>
74  , virtual public ScaledLinearOpBase<Scalar>
75 {
76 public:
77 
80 
88 
92  const RCP<const VectorSpaceBase<Scalar> > &range,
93  const RCP<const VectorSpaceBase<Scalar> > &domain
94  );
95 
112  void initialize(
113  const RCP<const VectorSpaceBase<Scalar> > &range,
114  const RCP<const VectorSpaceBase<Scalar> > &domain
115  );
116 
123  void uninitialize();
124 
126 
129 
132 
135 
138 
140 
143 
147  std::string description() const;
148 
150 
151 protected:
152 
155 
157  bool opSupportedImpl(EOpTransp M_trans) const;
158 
160  void applyImpl(
161  const EOpTransp M_trans,
162  const MultiVectorBase<Scalar> &X,
163  const Ptr<MultiVectorBase<Scalar> > &Y,
164  const Scalar alpha,
165  const Scalar beta
166  ) const;
167 
169 
172 
174  virtual bool rowStatIsSupportedImpl(
175  const RowStatLinearOpBaseUtils::ERowStat rowStat) const;
176 
178  virtual void getRowStatImpl(
179  const RowStatLinearOpBaseUtils::ERowStat rowStat,
180  const Teuchos::Ptr<VectorBase< Scalar> > &rowStatVec) const;
181 
183 
186 
188  virtual bool supportsScaleLeftImpl() const
189  { return true; }
190 
192  virtual bool supportsScaleRightImpl() const
193  { return true; }
194  // Meaningless operation
196  virtual void scaleLeftImpl(const VectorBase< Scalar > &/* row_scaling */)
197  { }
198  // Meaningless operation
200  virtual void scaleRightImpl(const VectorBase< Scalar > &/* col_scaling */)
201  { }
202 
204 
205 private:
206 
209 
210  // Not defined and not to be called
212  DefaultZeroLinearOp& operator=(const DefaultZeroLinearOp&);
213 
214 };
215 
216 
221 template<class Scalar>
222 RCP<const LinearOpBase<Scalar> >
223 zero(
224  const RCP<const VectorSpaceBase<Scalar> > &range,
225  const RCP<const VectorSpaceBase<Scalar> > &domain
226  );
227 
235 template<class Scalar>
236 RCP<LinearOpBase<Scalar> >
237 nonconstZero(
238  const RCP<const VectorSpaceBase<Scalar> > &range,
239  const RCP<const VectorSpaceBase<Scalar> > &domain
240  );
241 
242 
243 } // end namespace Thyra
244 
245 
246 #endif // THYRA_DEFAULT_ZERO_LINEAR_OP_DECL_HPP
void uninitialize()
Set to uninitialized.
virtual bool rowStatIsSupportedImpl(const RowStatLinearOpBaseUtils::ERowStat rowStat) const
EOpTransp
Enumeration for determining how a linear operator is applied. `*.
virtual void getRowStatImpl(const RowStatLinearOpBaseUtils::ERowStat rowStat, const Teuchos::Ptr< VectorBase< Scalar > > &rowStatVec) const
RCP< const VectorSpaceBase< Scalar > > domain() const
Returns Teuchos::null if uninitialized.
Interface class for zero linear operators.
Abstract interface for objects that represent a space for vectors.
bool opSupportedImpl(EOpTransp M_trans) const
Returns true .
RCP< const LinearOpBase< Scalar > > clone() const
Interface for a collection of column vectors called a multi-vector.
DefaultZeroLinearOp()
Construct to uninitialized.
Abstract interface for finite-dimensional dense vectors.
virtual void scaleRightImpl(const VectorBase< Scalar > &)
Applies left or right sclaing to the linear operator.
RCP< const VectorSpaceBase< Scalar > > range() const
Returns Teuchos::null if uninitialized.
Interface for exxtracting row statistics as a VectorBase from a supporting LinearOpBase object...
Represents a zero linear operator M = 0.
virtual void scaleLeftImpl(const VectorBase< Scalar > &)
std::string description() const
Prints just the name DefaultZeroLinearOp along with the overall dimensions.
void initialize(const RCP< const VectorSpaceBase< Scalar > > &range, const RCP< const VectorSpaceBase< Scalar > > &domain)
Initialize given a list of non-const linear operators.
void applyImpl(const EOpTransp M_trans, const MultiVectorBase< Scalar > &X, const Ptr< MultiVectorBase< Scalar > > &Y, const Scalar alpha, const Scalar beta) const