 |
Ginkgo
Generated from pipelines/2406079695 branch based on develop. Ginkgo version 1.12.0
A numerical linear algebra library targeting many-core architectures
|
5 #ifndef GKO_PUBLIC_CORE_MATRIX_DEVICE_DENSE_HPP_
6 #define GKO_PUBLIC_CORE_MATRIX_DEVICE_DENSE_HPP_
10 #include <ginkgo/core/base/dim.hpp>
26 template <
typename ValueType>
34 : size{size}, stride{stride}, values{values}
36 assert(stride >= size[1]);
48 assert(row < size[0] && col < size[1]);
49 return values[row * stride + col];
62 template <
typename ValueType,
typename IndexType>
72 IndexType* row_idxs, IndexType* col_idxs)
74 num_stored_elements{num_stored_elements},
84 size, num_stored_elements, values, row_idxs, col_idxs};
97 template <
typename ValueType,
typename IndexType>
107 size_type stride, ValueType* values, IndexType* col_idxs)
109 num_stored_elements_per_row{num_stored_elements_per_row},
114 assert(stride >= size[0]);
121 size, num_stored_elements_per_row, stride, values, col_idxs};
127 return values[this->linearize_index(row, idx)];
133 return col_idxs[this->linearize_index(row, idx)];
141 assert(idx < num_stored_elements_per_row && row < size[0]);
142 return row + stride * idx;
152 #endif // GKO_PUBLIC_CORE_MATRIX_DEVICE_DENSE_HPP_
Non-owning view of a matrix::Dense to be used inside device kernels.
Definition: device_views.hpp:27
constexpr ell< const ValueType, const IndexType > as_const() const
Returns a const view of the same values.
Definition: device_views.hpp:118
Non-owning view of a matrix::Coo to be used inside device kernels.
Definition: device_views.hpp:63
constexpr IndexType & col_at(size_type row, size_type idx) const
accessing the column index of the idx-th element within the given row
Definition: device_views.hpp:131
constexpr ell(dim< 2 > size, size_type num_stored_elements_per_row, size_type stride, ValueType *values, IndexType *col_idxs)
Constructs a ell view.
Definition: device_views.hpp:106
std::size_t size_type
Integral type used for allocation quantities.
Definition: types.hpp:90
Non-owning view of a matrix::Ell to be used inside device kernels.
Definition: device_views.hpp:98
The Ginkgo namespace.
Definition: abstract_factory.hpp:20
constexpr coo< const ValueType, const IndexType > as_const() const
Returns a const view of the same data.
Definition: device_views.hpp:81
constexpr dense(dim< 2 > size, size_type stride, ValueType *values)
Constructs a dense view from size, stride and values.
Definition: device_views.hpp:33
constexpr ValueType & val_at(size_type row, size_type idx) const
accessing the value of the idx-th element within the given row
Definition: device_views.hpp:125
constexpr ValueType & operator()(size_type row, size_type col) const
Subscript operator accessing the given row and column.
Definition: device_views.hpp:46
constexpr dense< const ValueType > as_const() const
Returns a const view of the same values.
Definition: device_views.hpp:40
constexpr coo(dim< 2 > size, size_type num_stored_elements, ValueType *values, IndexType *row_idxs, IndexType *col_idxs)
Constructs a coo view from size, nnz, values, row and column indices.
Definition: device_views.hpp:71