Belos Version of the Day
Loading...
Searching...
No Matches
BelosDenseMatTraits.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_DENSE_MAT_TRAITS_HPP
11#define BELOS_DENSE_MAT_TRAITS_HPP
12
17//#include "BelosConfigDefs.hpp"
18
19#include "Teuchos_RCP.hpp"
20#include "Teuchos_ScalarTraits.hpp"
21
22#include "BelosDenseSolver.hpp"
23
24namespace Belos {
25
32 template< class ScalarType, class DM >
34 {
36
40 static inline ScalarType notDefined() { return DM::this_type_is_missing_a_specialization(); };
41 };
42
50 template<class ScalarType, class DM>
52 {
53 public:
54
56
61 static Teuchos::RCP<DM> Create()
62 { UndefinedDenseMatTraits<ScalarType, DM>::notDefined(); return Teuchos::null; }
63
69 static Teuchos::RCP<DM> Create( const int numrows, const int numcols, bool initZero = true)
70 { UndefinedDenseMatTraits<ScalarType, DM>::notDefined(); return Teuchos::null; }
71
76 static Teuchos::RCP<DM> CreateCopy(const DM & dm, bool transpose=false)
78
79/* Kokkos Ex View-from-ptr constructor:
80View(const pointer_type &ptr, const IntType&... indices)
81
82 Unmanaged data wrapping constructor.
83
84 ptr: pointer to a user provided memory allocation. Must provide storage of size View::required_allocation_size(n0,...,nR)
85 indices: Extents of the View.
86 Requires: sizeof(IntType...)==rank_dynamic() or sizeof(IntType...)==rank(). In the latter case, the extents corresponding to compile-time dimensions must match the View type’s compile-time extents.
87 Requires: array_layout::is_regular == true.
88*/
89
97
99 static ScalarType const * GetConstRawHostPtr(const DM & dm )
100 { UndefinedDenseMatTraits<ScalarType, DM>::notDefined(); return Teuchos::null; }
101
105 //static void RawPtrDataModified(DM & dm)
106 //{ UndefinedDenseMatTraits<ScalarType, DM>::notDefined(); }
107
109 // Row and column indexing is zero-based.
110 // Source - Reference to another dense matrix from which values are to be copied.
111 // numRows - The number of rows in this matrix.
112 // numCols - The number of columns in this matrix.
113 // startRow - The row of Source from which the submatrix copy should start.
114 // startCol - The column of Source from which the submatrix copy should start.
115 //
116 // Should ints be const? Should they be ints or some other ordinal type?
117 static Teuchos::RCP<DM> Subview( DM & source, int numRows, int numCols, int startRow=0, int startCol=0)
118 { UndefinedDenseMatTraits<ScalarType, DM>::notDefined(); return Teuchos::null; }
119
120 static Teuchos::RCP<const DM> SubviewConst( const DM & source, int numRows, int numCols, int startRow=0, int startCol=0)
121 { UndefinedDenseMatTraits<ScalarType, DM>::notDefined(); return Teuchos::null; }
122
124 static Teuchos::RCP<DM> SubviewCopy( const DM & source, int numRows, int numCols, int startRow=0, int startCol=0)
125 { UndefinedDenseMatTraits<ScalarType, DM>::notDefined(); return Teuchos::null; }
127
129
131 static int GetNumRows( const DM& dm )
133
135 static int GetNumCols( const DM& dm )
137
139 static int GetStride( const DM& dm )
141
143
145
146 /* \brief Reshaping method for changing the size of \c dm,
147 * keeping the entries.
148 */
149
150 /* \brief Reshaping method for changing the size of \c dm to have \c numrows rows and \c numcols columns.
151 * All values will be initialized to zero if the final argument is true.
152 * If the final argument is fale, the previous entries in
153 * the matrix will be maintained. For new entries that did not exist in the previous matrix, values will
154 * contain noise from memory.
155 */
156 static void Reshape( DM& dm, const int numrows, const int numcols, bool initZero = false)
158
160
162
164 static ScalarType & Value( DM& dm, const int i, const int j )
166
168 static const ScalarType & ValueConst( const DM& dm, const int i, const int j )
170
173
176
178
179
183
185 static void PutScalar( DM& dm, ScalarType value = Teuchos::ScalarTraits<ScalarType>::zero())
187
191
196
200
202 static typename Teuchos::ScalarTraits<ScalarType>::magnitudeType NormFrobenius(const DM& dm)
204
206 static typename Teuchos::ScalarTraits<ScalarType>::magnitudeType NormOne(const DM& dm)
208
210
211
213 static Teuchos::RCP<DenseSolver<ScalarType, DM>> createDenseSolver()
214 { UndefinedDenseMatTraits<ScalarType, DM>::notDefined(); return Teuchos::null; }
216
217 };
218
219} // namespace Belos
220
221#endif // end file BELOS_DENSE_MAT_TRAITS_HPP
Virtual base class which defines solvers for dense matrix type.
Virtual base class which defines basic traits for the multi-vector type.
static Teuchos::RCP< DM > Subview(DM &source, int numRows, int numCols, int startRow=0, int startCol=0)
Marks host data modified to avoid device sync errors.
static Teuchos::RCP< DM > SubviewCopy(const DM &source, int numRows, int numCols, int startRow=0, int startCol=0)
Returns a deep copy of the requested subview.
static Teuchos::RCP< DM > Create(const int numrows, const int numcols, bool initZero=true)
Creates a new empty DM containing numvecs columns. Will be initialized to zeros if last parameter is ...
static void SyncHostToDevice(DM &dm)
static void PutScalar(DM &dm, ScalarType value=Teuchos::ScalarTraits< ScalarType >::zero())
Fill all entries with value. Value is zero if not specified.
static int GetNumRows(const DM &dm)
Obtain the number of rows of dm.
static void Scale(DM &dm, ScalarType value)
Multiply all entries by a scalar. DM = value.*DM.
static Teuchos::RCP< DM > CreateCopy(const DM &dm, bool transpose=false)
Create a new copy DM, possibly transposed.
static ScalarType * GetRawHostPtr(DM &dm)
Returns a raw pointer to the (non-const) data on the host.
static const ScalarType & ValueConst(const DM &dm, const int i, const int j)
Access a const reference to the (i,j) entry of dm, e_i^T dm e_j.
static void SyncDeviceToHost(DM &dm)
static void Assign(DM &thisDM, const DM &sourceDM)
Copies entries of sourceDM to thisDM (deep copy).
static Teuchos::RCP< DenseSolver< ScalarType, DM > > createDenseSolver()
Returns a dense solver object for the dense matrix.
static Teuchos::RCP< const DM > SubviewConst(const DM &source, int numRows, int numCols, int startRow=0, int startCol=0)
static void Add(DM &thisDM, const DM &sourceDM)
Adds sourceDM to thisDM and returns answer in thisDM.
static void Randomize(DM &dm)
Fill the DM with random entries.
static void Reshape(DM &dm, const int numrows, const int numcols, bool initZero=false)
static ScalarType const * GetConstRawHostPtr(const DM &dm)
Returns a raw pointer to const data on the host.
static ScalarType & Value(DM &dm, const int i, const int j)
Access a reference to the (i,j) entry of dm, e_i^T dm e_j.
static Teuchos::ScalarTraits< ScalarType >::magnitudeType NormFrobenius(const DM &dm)
Returns the Frobenius norm of the dense matrix.
static Teuchos::ScalarTraits< ScalarType >::magnitudeType NormOne(const DM &dm)
Returns the one-norm of the dense matrix.
static int GetStride(const DM &dm)
Obtain the stride between the columns of dm.
static Teuchos::RCP< DM > Create()
Creates a new empty DM with no dimension.
static int GetNumCols(const DM &dm)
Obtain the number of columns of dm.
Alternative run-time polymorphic interface for operators.
This is the default struct used by DenseMatrixTraits<OrdinalType, ScalarType> class to produce a comp...
static ScalarType notDefined()
This function should not compile if there is an attempt to instantiate!

Generated for Belos by doxygen 1.9.8