Thyra Version of the Day
Loading...
Searching...
No Matches
Thyra_VectorDefaultBase_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_VECTOR_DEFAULT_BASE_DECL_HPP
43#define THYRA_VECTOR_DEFAULT_BASE_DECL_HPP
44
45#include "Thyra_VectorBase.hpp"
46#include "Thyra_MultiVectorDefaultBase_decl.hpp"
47
48
49namespace Thyra {
50
51
72template<class Scalar>
74 : virtual public VectorBase<Scalar>,
75 virtual protected MultiVectorDefaultBase<Scalar>
76{
77public:
78
81
83 virtual std::string description() const;
84
107 virtual void describe(
109 ,const Teuchos::EVerbosityLevel verbLevel
110 ) const;
111
113
116
123
125
128
131
133
136
141
143
144protected:
145
148
150 virtual void assignVecImpl(const VectorBase<Scalar>& x);
151
153 virtual void randomizeImpl(Scalar l, Scalar u);
154
156 virtual void absImpl(const VectorBase<Scalar>& x);
157
159 virtual void reciprocalImpl(const VectorBase<Scalar>& x);
160
162 virtual void eleWiseScaleImpl(const VectorBase<Scalar>& x);
163
165 virtual void updateVecImpl(
166 Scalar alpha,
167 const VectorBase<Scalar>& x);
168
170 virtual void linearCombinationVecImpl(
171 const ArrayView<const Scalar>& alpha,
172 const ArrayView<const Ptr<const VectorBase<Scalar> > >& x,
173 const Scalar& beta
174 );
175
177 virtual Scalar dotImpl(const VectorBase<Scalar>& x) const;
178
181 norm1Impl() const;
182
185 norm2Impl() const;
186
190
193 normInfImpl() const;
194
199 contigSubViewImpl( const Range1D& col_rng ) const;
202 nonconstContigSubViewImpl( const Range1D& col_rng );
205 nonContigSubViewImpl( const ArrayView<const int> &cols ) const;
211 const Range1D &rowRng,
212 const Range1D &colRng,
214 ) const;
218 ) const;
221 const Range1D &rowRng,
222 const Range1D &colRng,
224 );
228 );
229
231
234
251 ) const;
261 ) const;
276 const Range1D& rng, RTOpPack::SubVectorView<Scalar>* sub_vec
277 );
286 );
296 virtual void setSubVectorImpl( const RTOpPack::SparseSubVectorT<Scalar>& sub_vec );
297
299
302
307 bool opSupportedImpl(EOpTransp M_trans) const;
308
312 void applyImpl(
313 const EOpTransp M_trans,
315 const Ptr<MultiVectorBase<Scalar> > &Y,
316 const Scalar alpha,
317 const Scalar beta
318 ) const;
319
321
322private:
323
324 // /////////////////////////////////////
325 // Private data members
326
327 mutable RCP<const VectorSpaceBase<Scalar> > domain_;
328 // Above only initialized if *this is used as a MultiVectorBase
329
330 // /////////////////////////////////////
331 // Private member functions
332
333 void validateColRng( const Range1D &rowRng ) const;
334 void validateColIndexes( const ArrayView<const int> &cols ) const;
335
336};
337
338
339} // end namespace Thyra
340
341
342#endif // THYRA_VECTOR_DEFAULT_BASE_DECL_HPP
Interface for a collection of column vectors called a multi-vector.
Node subclass that uses a default MultiVectorBase implementation to provide default implementations f...
Abstract interface for finite-dimensional dense vectors.
Convenient node subclass for concrete VectorBase subclasses that relies on a default MultiVectorBase ...
virtual void acquireNonconstDetachedMultiVectorViewImpl(const Range1D &rowRng, const Range1D &colRng, RTOpPack::SubMultiVectorView< Scalar > *sub_mv)
Implemented in terms of this->acquireDetachedView().
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 VectorSpaceBase< Scalar > > range() const
Returns this->space().
virtual void acquireNonconstDetachedVectorViewImpl(const Range1D &rng, RTOpPack::SubVectorView< Scalar > *sub_vec)
virtual RCP< const VectorSpaceBase< Scalar > > domain() const
Returns a DefaultSerialVectorSpace object with dimension 1.
virtual RCP< const MultiVectorBase< Scalar > > nonContigSubViewImpl(const ArrayView< const int > &cols) const
Returns Teuchos::rcp(this,false).
virtual Teuchos::ScalarTraits< Scalar >::magnitudeType norm2WeightedImpl(const VectorBase< Scalar > &x) const
Default implementation of norm_2 (weighted) using RTOps.
virtual Teuchos::ScalarTraits< Scalar >::magnitudeType norm2Impl() const
Default implementation of norm_2 using RTOps.
virtual void randomizeImpl(Scalar l, Scalar u)
Default implementation of randomize using RTOps.
virtual void acquireDetachedVectorViewImpl(const Range1D &rng, RTOpPack::ConstSubVectorView< Scalar > *sub_vec) const
bool opSupportedImpl(EOpTransp M_trans) const
For complex Scalar types returns true for NOTRANS and CONJTRANS and for real types returns true for a...
virtual RCP< const MultiVectorBase< Scalar > > contigSubViewImpl(const Range1D &col_rng) const
Returns Teuchos::rcp(this,false).
virtual Teuchos::ScalarTraits< Scalar >::magnitudeType normInfImpl() const
Default implementation of norm_inf using RTOps.
virtual std::string description() const
Default description that gives the label, type, and dimenstion .
RCP< VectorBase< Scalar > > clone_v() const
Simply creates a new vector and copies the contents from *this.
virtual Scalar dotImpl(const VectorBase< Scalar > &x) const
Default implementation of dot using RTOps.
virtual void reciprocalImpl(const VectorBase< Scalar > &x)
Default implementation of reciprocal using RTOps.
virtual void absImpl(const VectorBase< Scalar > &x)
Default implementation of abs using RTOps.
virtual void acquireDetachedMultiVectorViewImpl(const Range1D &rowRng, const Range1D &colRng, RTOpPack::ConstSubMultiVectorView< Scalar > *sub_mv) const
Implemented in terms of this->acquireDetachedView().
virtual RCP< VectorBase< Scalar > > nonconstColImpl(Ordinal j)
Returns Teuchos::rcp(this,false).
virtual void assignVecImpl(const VectorBase< Scalar > &x)
Default implementation of assign(vector) using RTOps.
virtual void eleWiseScaleImpl(const VectorBase< Scalar > &x)
Default implementation of ele_wise_scale using RTOps.
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
Generates a default outputting for all vectors.
virtual void setSubVectorImpl(const RTOpPack::SparseSubVectorT< Scalar > &sub_vec)
RCP< MultiVectorBase< Scalar > > clone_mv() const
Returns this->clone_v().
virtual RCP< MultiVectorBase< Scalar > > nonconstContigSubViewImpl(const Range1D &col_rng)
Returns Teuchos::rcp(this,false).
virtual void releaseDetachedMultiVectorViewImpl(RTOpPack::ConstSubMultiVectorView< Scalar > *sub_mv) const
Implemented in terms of this->releaseDetachedView().
virtual Teuchos::ScalarTraits< Scalar >::magnitudeType norm1Impl() const
Default implementation of norm_1 using RTOps.
virtual RCP< MultiVectorBase< Scalar > > nonconstNonContigSubViewImpl(const ArrayView< const int > &cols)
Returns Teuchos::rcp(this,false).
virtual void releaseDetachedVectorViewImpl(RTOpPack::ConstSubVectorView< Scalar > *sub_vec) const
virtual void commitNonconstDetachedMultiVectorViewImpl(RTOpPack::SubMultiVectorView< Scalar > *sub_mv)
Implemented in terms of this->commitDetachedView().
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)
virtual void updateVecImpl(Scalar alpha, const VectorBase< Scalar > &x)
Default implementation of update using RTOps.
EOpTransp
Enumeration for determining how a linear operator is applied. `*.
Teuchos::Ordinal Ordinal
Type for the dimension of a vector space. `*.