Thyra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Thyra_VectorDefaultBase_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_VECTOR_DEFAULT_BASE_DECL_HPP
11 #define THYRA_VECTOR_DEFAULT_BASE_DECL_HPP
12 
13 #include "Thyra_VectorBase.hpp"
14 #include "Thyra_MultiVectorDefaultBase_decl.hpp"
15 
16 
17 namespace Thyra {
18 
19 
40 template<class Scalar>
42  : virtual public VectorBase<Scalar>,
43  virtual protected MultiVectorDefaultBase<Scalar>
44 {
45 public:
46 
49 
51  virtual std::string description() const;
52 
75  virtual void describe(
77  ,const Teuchos::EVerbosityLevel verbLevel
78  ) const;
79 
81 
84 
86  virtual RCP< const VectorSpaceBase<Scalar> > range() const;
91 
93 
96 
99 
101 
104 
109 
111 
112 protected:
113 
116 
118  virtual void assignVecImpl(const VectorBase<Scalar>& x);
119 
121  virtual void randomizeImpl(Scalar l, Scalar u);
122 
124  virtual void absImpl(const VectorBase<Scalar>& x);
125 
127  virtual void reciprocalImpl(const VectorBase<Scalar>& x);
128 
130  virtual void eleWiseScaleImpl(const VectorBase<Scalar>& x);
131 
133  virtual void updateVecImpl(
134  Scalar alpha,
135  const VectorBase<Scalar>& x);
136 
138  virtual void linearCombinationVecImpl(
139  const ArrayView<const Scalar>& alpha,
140  const ArrayView<const Ptr<const VectorBase<Scalar> > >& x,
141  const Scalar& beta
142  );
143 
145  virtual Scalar dotImpl(const VectorBase<Scalar>& x) const;
146 
149  norm1Impl() const;
150 
153  norm2Impl() const;
154 
157  norm2WeightedImpl(const VectorBase<Scalar>& x) const;
158 
161  normInfImpl() const;
162 
167  contigSubViewImpl( const Range1D& col_rng ) const;
170  nonconstContigSubViewImpl( const Range1D& col_rng );
173  nonContigSubViewImpl( const ArrayView<const int> &cols ) const;
179  const Range1D &rowRng,
180  const Range1D &colRng,
182  ) const;
186  ) const;
189  const Range1D &rowRng,
190  const Range1D &colRng,
192  );
196  );
197 
199 
202 
217  virtual void acquireDetachedVectorViewImpl(
218  const Range1D& rng, RTOpPack::ConstSubVectorView<Scalar>* sub_vec
219  ) const;
227  virtual void releaseDetachedVectorViewImpl(
229  ) const;
244  const Range1D& rng, RTOpPack::SubVectorView<Scalar>* sub_vec
245  );
254  );
264  virtual void setSubVectorImpl( const RTOpPack::SparseSubVectorT<Scalar>& sub_vec );
265 
267 
270 
275  bool opSupportedImpl(EOpTransp M_trans) const;
276 
280  void applyImpl(
281  const EOpTransp M_trans,
282  const MultiVectorBase<Scalar> &X,
283  const Ptr<MultiVectorBase<Scalar> > &Y,
284  const Scalar alpha,
285  const Scalar beta
286  ) const;
287 
289 
290 private:
291 
292  // /////////////////////////////////////
293  // Private data members
294 
295  mutable RCP<const VectorSpaceBase<Scalar> > domain_;
296  // Above only initialized if *this is used as a MultiVectorBase
297 
298  // /////////////////////////////////////
299  // Private member functions
300 
301  void validateColRng( const Range1D &rowRng ) const;
302  void validateColIndexes( const ArrayView<const int> &cols ) const;
303 
304 };
305 
306 
307 } // end namespace Thyra
308 
309 
310 #endif // THYRA_VECTOR_DEFAULT_BASE_DECL_HPP
virtual Scalar dotImpl(const VectorBase< Scalar > &x) const
Default implementation of dot using RTOps.
RCP< MultiVectorBase< Scalar > > clone_mv() const
Returns this-&gt;clone_v().
virtual RCP< MultiVectorBase< Scalar > > nonconstContigSubViewImpl(const Range1D &col_rng)
Returns Teuchos::rcp(this,false).
EOpTransp
Enumeration for determining how a linear operator is applied. `*.
virtual void acquireDetachedMultiVectorViewImpl(const Range1D &rowRng, const Range1D &colRng, RTOpPack::ConstSubMultiVectorView< Scalar > *sub_mv) const
Implemented in terms of this-&gt;acquireDetachedView().
virtual std::string description() const
Default description that gives the label, type, and dimenstion .
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
Generates a default outputting for all vectors.
virtual void releaseDetachedVectorViewImpl(RTOpPack::ConstSubVectorView< Scalar > *sub_vec) const
virtual Teuchos::ScalarTraits< Scalar >::magnitudeType norm1Impl() const
Default implementation of norm_1 using RTOps.
virtual void eleWiseScaleImpl(const VectorBase< Scalar > &x)
Default implementation of ele_wise_scale using RTOps.
virtual void reciprocalImpl(const VectorBase< Scalar > &x)
Default implementation of reciprocal using RTOps.
virtual Teuchos::ScalarTraits< Scalar >::magnitudeType norm2Impl() const
Default implementation of norm_2 using RTOps.
virtual void absImpl(const VectorBase< Scalar > &x)
Default implementation of abs using RTOps.
RCP< VectorBase< Scalar > > clone_v() const
Simply creates a new vector and copies the contents from *this.
Node subclass that uses a default MultiVectorBase implementation to provide default implementations f...
virtual RCP< const VectorSpaceBase< Scalar > > range() const
Returns this-&gt;space().
virtual RCP< const MultiVectorBase< Scalar > > nonContigSubViewImpl(const ArrayView< const int > &cols) const
Returns Teuchos::rcp(this,false).
virtual void releaseDetachedMultiVectorViewImpl(RTOpPack::ConstSubMultiVectorView< Scalar > *sub_mv) const
Implemented in terms of this-&gt;releaseDetachedView().
virtual void acquireNonconstDetachedMultiVectorViewImpl(const Range1D &rowRng, const Range1D &colRng, RTOpPack::SubMultiVectorView< Scalar > *sub_mv)
Implemented in terms of this-&gt;acquireDetachedView().
Convenient node subclass for concrete VectorBase subclasses that relies on a default MultiVectorBase ...
Teuchos::Ordinal Ordinal
Type for the dimension of a vector space. `*.
Interface for a collection of column vectors called a multi-vector.
virtual RCP< VectorBase< Scalar > > nonconstColImpl(Ordinal j)
Returns Teuchos::rcp(this,false).
Abstract interface for finite-dimensional dense vectors.
bool opSupportedImpl(EOpTransp M_trans) const
For complex Scalar types returns true for NOTRANS and CONJTRANS and for real types returns true for a...
void applyImpl(const EOpTransp M_trans, const MultiVectorBase< Scalar > &X, const Ptr< MultiVectorBase< Scalar > > &Y, const Scalar alpha, const Scalar beta) const
. Applies vector or its adjoint (transpose) as a linear operator.
virtual RCP< const MultiVectorBase< Scalar > > contigSubViewImpl(const Range1D &col_rng) const
Returns Teuchos::rcp(this,false).
virtual void assignVecImpl(const VectorBase< Scalar > &x)
Default implementation of assign(vector) using RTOps.
virtual void updateVecImpl(Scalar alpha, const VectorBase< Scalar > &x)
Default implementation of update using RTOps.
virtual Teuchos::ScalarTraits< Scalar >::magnitudeType normInfImpl() const
Default implementation of norm_inf using RTOps.
virtual RCP< const VectorSpaceBase< Scalar > > domain() const
Returns a DefaultSerialVectorSpace object with dimension 1.
virtual Teuchos::ScalarTraits< Scalar >::magnitudeType norm2WeightedImpl(const VectorBase< Scalar > &x) const
Default implementation of norm_2 (weighted) using RTOps.
virtual void acquireDetachedVectorViewImpl(const Range1D &rng, RTOpPack::ConstSubVectorView< Scalar > *sub_vec) const
virtual void setSubVectorImpl(const RTOpPack::SparseSubVectorT< Scalar > &sub_vec)
virtual void commitNonconstDetachedMultiVectorViewImpl(RTOpPack::SubMultiVectorView< Scalar > *sub_mv)
Implemented in terms of this-&gt;commitDetachedView().
virtual void acquireNonconstDetachedVectorViewImpl(const Range1D &rng, RTOpPack::SubVectorView< Scalar > *sub_vec)
virtual void randomizeImpl(Scalar l, Scalar u)
Default implementation of randomize using RTOps.
virtual RCP< MultiVectorBase< Scalar > > nonconstNonContigSubViewImpl(const ArrayView< const int > &cols)
Returns Teuchos::rcp(this,false).
virtual void linearCombinationVecImpl(const ArrayView< const Scalar > &alpha, const ArrayView< const Ptr< const VectorBase< Scalar > > > &x, const Scalar &beta)
Default implementation of linear_combination using RTOps.
virtual void commitNonconstDetachedVectorViewImpl(RTOpPack::SubVectorView< Scalar > *sub_vec)