Kokkos Core Kernels Package
Version of the Day
|
View of a row of a sparse graph. More...
#include <Kokkos_StaticCrsGraph.hpp>
Public Types | |
using | ordinal_type = const typename GraphType::data_type |
The type of the column indices in the row. More... | |
Public Member Functions | |
KOKKOS_INLINE_FUNCTION | GraphRowViewConst (ordinal_type *const colidx_in, const ordinal_type &stride, const ordinal_type &count) |
Constructor. More... | |
template<class OffsetType > | |
KOKKOS_INLINE_FUNCTION | GraphRowViewConst (const typename GraphType::entries_type &colidx_in, const ordinal_type &stride, const ordinal_type &count, const OffsetType &idx, const std::enable_if_t< std::is_integral< OffsetType >::value, int > &=0) |
Constructor with offset into colidx array. More... | |
KOKKOS_INLINE_FUNCTION ordinal_type & | colidx (const ordinal_type &i) const |
(Const) reference to the column index of entry i in this row of the sparse matrix. More... | |
KOKKOS_INLINE_FUNCTION ordinal_type & | operator() (const ordinal_type &i) const |
An alias for colidx. More... | |
Public Attributes | |
const ordinal_type | length |
Number of entries in the row. More... | |
View of a row of a sparse graph.
GraphType | Sparse graph type, such as (but not limited to) StaticCrsGraph. |
This class provides a generic view of a row of a sparse graph. We intended this class to view a row of a StaticCrsGraph, but GraphType 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. The view is always const as it does not allow graph modification.
Here is an example loop over the entries in the row:
GraphType must provide the data_type
aliases. In addition, it must make sense to use GraphRowViewConst to view a row of GraphType. In particular, column indices of a row must be accessible using the entries
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 147 of file Kokkos_StaticCrsGraph.hpp.
using Kokkos::GraphRowViewConst< GraphType >::ordinal_type = const typename GraphType::data_type |
The type of the column indices in the row.
Definition at line 149 of file Kokkos_StaticCrsGraph.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 172 of file Kokkos_StaticCrsGraph.hpp.
|
inline |
Constructor with offset into colidx
array.
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. |
idx | [in] Start offset into colidx array |
OffsetType | The type of idx (see above). Must be a built-in integer type. This may differ from ordinal_type. For example, the matrix may have dimensions that fit in int, but a number of entries that does not fit in int. |
Definition at line 189 of file Kokkos_StaticCrsGraph.hpp.
|
inline |
(Const) 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 214 of file Kokkos_StaticCrsGraph.hpp.
|
inline |
An alias for colidx.
Definition at line 220 of file Kokkos_StaticCrsGraph.hpp.
const ordinal_type Kokkos::GraphRowViewConst< GraphType >::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.
We assume that rows contain no duplicate entries (i.e., entries with the same column index). Thus, a row may have up to A.numCols() entries. This means that the correct type of 'length' is ordinal_type.
Definition at line 206 of file Kokkos_StaticCrsGraph.hpp.