Belos  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BelosMultiVecTraits.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Belos: Block Linear Solvers Package
4 //
5 // Copyright 2004-2016 NTESS and the Belos contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 //
10 #ifndef BELOS_MULTI_VEC_TRAITS_HPP
11 #define BELOS_MULTI_VEC_TRAITS_HPP
12 
23 
24 #include "BelosTypes.hpp"
25 #include "BelosStubTsqrAdapter.hpp"
26 #include "Teuchos_Range1D.hpp"
27 #include "Teuchos_RCP.hpp"
29 
30 namespace Belos {
31 
38  template<class ScalarType, class MV>
40  {
47  static inline ScalarType notDefined() {
48  return MV::this_type_is_missing_a_specialization();
49  }
50  };
51 
96  template<class ScalarType, class MV>
98  public:
100 
101 
106  static Teuchos::RCP<MV> Clone( const MV& mv, const int numvecs )
107  { UndefinedMultiVecTraits<ScalarType, MV>::notDefined(); return Teuchos::null; }
108 
113  static Teuchos::RCP<MV> CloneCopy( const MV& mv )
114  { UndefinedMultiVecTraits<ScalarType, MV>::notDefined(); return Teuchos::null; }
115 
121  static Teuchos::RCP<MV> CloneCopy( const MV& mv, const std::vector<int>& index )
122  { UndefinedMultiVecTraits<ScalarType, MV>::notDefined(); return Teuchos::null; }
123 
133  static Teuchos::RCP<MV> CloneCopy( const MV& mv, const Teuchos::Range1D& index )
134  { UndefinedMultiVecTraits<ScalarType, MV>::notDefined(); return Teuchos::null; }
135 
141  static Teuchos::RCP<MV> CloneViewNonConst( MV& mv, const std::vector<int>& index )
142  { UndefinedMultiVecTraits<ScalarType, MV>::notDefined(); return Teuchos::null; }
143 
152  static Teuchos::RCP<MV> CloneViewNonConst( MV& mv, const Teuchos::Range1D& index )
153  { UndefinedMultiVecTraits<ScalarType, MV>::notDefined(); return Teuchos::null; }
154 
160  static Teuchos::RCP<const MV> CloneView( const MV& mv, const std::vector<int>& index )
161  { UndefinedMultiVecTraits<ScalarType, MV>::notDefined(); return Teuchos::null; }
162 
171  static Teuchos::RCP<MV> CloneView( MV& mv, const Teuchos::Range1D& index )
172  { UndefinedMultiVecTraits<ScalarType, MV>::notDefined(); return Teuchos::null; }
173 
175 
177 
178 
182  static ptrdiff_t GetGlobalLength( const MV& mv )
184 
186  static int GetNumberVecs( const MV& mv )
188 
211  static bool HasConstantStride( const MV& mv )
213 
215 
217 
218 
221  static void MvTimesMatAddMv( const ScalarType alpha, const MV& A,
223  const ScalarType beta, MV& mv )
225 
228  static void MvAddMv( const ScalarType alpha, const MV& A, const ScalarType beta, const MV& B, MV& mv )
230 
233  static void MvScale ( MV& mv, const ScalarType alpha )
235 
238  static void MvScale ( MV& mv, const std::vector<ScalarType>& alpha )
240 
243  static void MvTransMv( const ScalarType alpha, const MV& A, const MV& mv, Teuchos::SerialDenseMatrix<int,ScalarType>& B)
245 
248  static void MvDot ( const MV& mv, const MV& A, std::vector<ScalarType> &b)
250 
252 
254 
262  static void MvNorm( const MV& mv, std::vector<typename Teuchos::ScalarTraits<ScalarType>::magnitudeType>& normvec, NormType type = TwoNorm )
264 
266 
268 
269 
274  static void SetBlock( const MV& A, const std::vector<int>& index, MV& mv )
276 
289  static void SetBlock( const MV& A, const Teuchos::Range1D& index, MV& mv )
291 
295  static void Assign( const MV& A, MV& mv )
297 
300  static void MvRandom( MV& mv )
302 
305  static void MvInit( MV& mv, const ScalarType alpha = Teuchos::ScalarTraits<ScalarType>::zero() )
307 
309 
311 
312 
315  static void MvPrint( const MV& mv, std::ostream& os )
317 
319 
320 #ifdef HAVE_BELOS_TSQR
321  typedef Belos::details::StubTsqrAdapter<MV> tsqr_adaptor_type;
334 #endif // HAVE_BELOS_TSQR
335  };
336 
337 } // namespace Belos
338 
339 #endif // BELOS_MULTI_VEC_TRAITS_HPP
Collection of types and exceptions used within the Belos solvers.
static void MvDot(const MV &mv, const MV &A, std::vector< ScalarType > &b)
Compute a vector b where the components are the individual dot-products of the i-th columns of A and ...
static Teuchos::RCP< MV > CloneCopy(const MV &mv, const std::vector< int > &index)
Creates a new MV and copies the selected contents of mv into the new vector (deep copy)...
static void MvRandom(MV &mv)
Replace the vectors in mv with random vectors.
static Teuchos::RCP< MV > CloneView(MV &mv, const Teuchos::Range1D &index)
Const view of specified columns of mv.
static Teuchos::RCP< const MV > CloneView(const MV &mv, const std::vector< int > &index)
Creates a new const MV that shares the selected contents of mv (shallow copy).
static Teuchos::RCP< MV > CloneViewNonConst(MV &mv, const Teuchos::Range1D &index)
Non-const view of specified columns of mv.
static void MvInit(MV &mv, const ScalarType alpha=Teuchos::ScalarTraits< ScalarType >::zero())
Replace each element of the vectors in mv with alpha.
static void MvTransMv(const ScalarType alpha, const MV &A, const MV &mv, Teuchos::SerialDenseMatrix< int, ScalarType > &B)
Compute a dense matrix B through the matrix-matrix multiply .
static int GetNumberVecs(const MV &mv)
Obtain the number of vectors in mv.
static void Assign(const MV &A, MV &mv)
mv := A
static void MvAddMv(const ScalarType alpha, const MV &A, const ScalarType beta, const MV &B, MV &mv)
Replace mv with .
static void SetBlock(const MV &A, const Teuchos::Range1D &index, MV &mv)
Deep copy of A into specified columns of mv.
Used by MultiVecTraits to report lack of a specialization.
Traits class which defines basic operations on multivectors.
static void SetBlock(const MV &A, const std::vector< int > &index, MV &mv)
Copy the vectors in A to a set of vectors in mv indicated by the indices given in index...
static Teuchos::RCP< MV > CloneViewNonConst(MV &mv, const std::vector< int > &index)
Creates a new MV that shares the selected contents of mv (shallow copy).
static Teuchos::RCP< MV > Clone(const MV &mv, const int numvecs)
Creates a new empty MV containing numvecs columns.
static Teuchos::RCP< MV > CloneCopy(const MV &mv, const Teuchos::Range1D &index)
Deep copy of specified columns of mv.
static Teuchos::RCP< MV > CloneCopy(const MV &mv)
Creates a new MV and copies contents of mv into the new vector (deep copy).
static void MvTimesMatAddMv(const ScalarType alpha, const MV &A, const Teuchos::SerialDenseMatrix< int, ScalarType > &B, const ScalarType beta, MV &mv)
Update mv with .
&quot;Stub&quot; TSQR adaptor for unsupported multivector types.
&quot;Stub&quot; TSQR adapter for unsupported multivector types.
static bool HasConstantStride(const MV &mv)
Whether the given multivector mv has constant stride.
static ptrdiff_t GetGlobalLength(const MV &mv)
Return the number of rows in the given multivector mv.
NormType
The type of vector norm to compute.
Definition: BelosTypes.hpp:65
static ScalarType notDefined()
Any attempt to compile this method will result in a compile-time error.
static void MvNorm(const MV &mv, std::vector< typename Teuchos::ScalarTraits< ScalarType >::magnitudeType > &normvec, NormType type=TwoNorm)
Compute the norm of each individual vector of mv. Upon return, normvec[i] holds the value of ...
static void MvScale(MV &mv, const std::vector< ScalarType > &alpha)
Scale each element of the i-th vector in mv with alpha[i].
static void MvScale(MV &mv, const ScalarType alpha)
Scale each element of the vectors in mv with alpha.
static void MvPrint(const MV &mv, std::ostream &os)
Print the mv multi-vector to the os output stream.

Generated on Wed Oct 23 2024 09:24:26 for Belos by doxygen 1.8.5