Kokkos Core Kernels Package
Version of the Day
|
View of a row of a sparse matrix. More...
#include <Kokkos_CrsMatrix.hpp>
Public Types | |
typedef MatrixType::value_type | value_type |
The type of the values in the row. More... | |
typedef MatrixType::ordinal_type | ordinal_type |
The type of the column indices in the row. More... | |
Public Member Functions | |
KOKKOS_INLINE_FUNCTION | SparseRowView (value_type *const values, ordinal_type *const colidx__, const int stride, const int count) |
Constructor. More... | |
KOKKOS_INLINE_FUNCTION | SparseRowView (const typename MatrixType::values_type &values, const typename MatrixType::index_type &colidx__, const int &stride, const int &count, const int &idx) |
Constructor. More... | |
KOKKOS_INLINE_FUNCTION value_type & | value (const int &i) const |
Reference to the value of entry i in this row of the sparse matrix. More... | |
KOKKOS_INLINE_FUNCTION ordinal_type & | colidx (const int &i) const |
Reference to the column index of entry i in this row of the sparse matrix. More... | |
Public Attributes | |
const int | length |
Number of entries in the row. More... | |
View of a row of a sparse matrix.
MatrixType | Sparse matrix type, such as (but not limited to) CrsMatrix. |
This class provides a generic view of a row of a sparse matrix. We intended this class to view a row of a CrsMatrix, but MatrixType need not necessarily be CrsMatrix.
The row view is suited for computational kernels like sparse matrix-vector multiply, as well as for modifying entries in the sparse matrix. Whether the view is const or not, depends on whether MatrixType is a const or nonconst view of the matrix. If you always want a const view, use SparseRowViewConst (see below).
Here is an example loop over the entries in the row:
MatrixType must provide the value_type
and ordinal_type
typedefs. In addition, it must make sense to use SparseRowView to view a row of MatrixType. In particular, the values and column indices of a row must be accessible using the values
resp. colidx
arrays given to the constructor of this class, with a constant stride
between successive entries. The stride is one for the compressed sparse row storage format (as is used by CrsMatrix), but may be greater than one for other sparse matrix storage formats (e.g., ELLPACK or jagged diagonal).
Definition at line 114 of file Kokkos_CrsMatrix.hpp.
typedef MatrixType::value_type Kokkos::SparseRowView< MatrixType >::value_type |
The type of the values in the row.
Definition at line 116 of file Kokkos_CrsMatrix.hpp.
typedef MatrixType::ordinal_type Kokkos::SparseRowView< MatrixType >::ordinal_type |
The type of the column indices in the row.
Definition at line 118 of file Kokkos_CrsMatrix.hpp.
|
inline |
Constructor.
values | [in] Array of the row's values. |
colidx | [in] Array of the row's column indices. |
stride | [in] (Constant) stride between matrix entries in each of the above arrays. |
count | [in] Number of entries in the row. |
Definition at line 137 of file Kokkos_CrsMatrix.hpp.
|
inline |
Constructor.
values | [in] Array of the row's values. |
colidx | [in] Array of the row's column indices. |
stride | [in] (Constant) stride between matrix entries in each of the above arrays. |
count | [in] Number of entries in the row. |
Definition at line 151 of file Kokkos_CrsMatrix.hpp.
|
inline |
Reference to the value of entry i in this row of the sparse matrix.
"Entry i" is not necessarily the entry with column index i, nor does i necessarily correspond to the (local) row index.
Definition at line 171 of file Kokkos_CrsMatrix.hpp.
|
inline |
Reference to the column index of entry i in this row of the sparse matrix.
"Entry i" is not necessarily the entry with column index i, nor does i necessarily correspond to the (local) row index.
Definition at line 180 of file Kokkos_CrsMatrix.hpp.
const int Kokkos::SparseRowView< MatrixType >::length |
Number of entries in the row.
This is a public const field rather than a public const method, in order to avoid possible overhead of a method call if the compiler is unable to inline that method call.
Definition at line 164 of file Kokkos_CrsMatrix.hpp.