18 using auto_const_t =
typename Base::template auto_const_t<U>;
21 static_assert(!std::is_const_v<Ty>,
"Ty must be non-const");
32 int m_triplet_index_offset = 0;
33 int m_triplet_count = 0;
34 int m_total_triplet_count = 0;
37 int2 m_submatrix_offset = {0, 0};
38 int2 m_submatrix_extent = {0, 0};
41 auto_const_t<int>* m_row_indices;
42 auto_const_t<int>* m_col_indices;
43 auto_const_t<Ty>* m_values;
45 mutable cusparseMatDescr_t m_legacy_descr =
nullptr;
46 mutable cusparseSpMatDescr_t m_descr =
nullptr;
53 int triplet_index_offset,
55 int total_triplet_count,
56 int2 submatrix_offset,
57 int2 submatrix_extent,
58 auto_const_t<int>* row_indices,
59 auto_const_t<int>* col_indices,
60 auto_const_t<Ty>* values,
61 cusparseSpMatDescr_t descr,
62 cusparseMatDescr_t legacy_descr,
67 , m_triplet_index_offset(triplet_index_offset)
68 , m_triplet_count(triplet_count)
69 , m_total_triplet_count(total_triplet_count)
70 , m_row_indices(row_indices)
71 , m_col_indices(col_indices)
73 , m_submatrix_offset(submatrix_offset)
74 , m_submatrix_extent(submatrix_extent)
76 , m_legacy_descr(legacy_descr)
79 MUDA_KERNEL_ASSERT(triplet_index_offset + triplet_count <= total_triplet_count,
80 "COOMatrixView: out of range, m_total_triplet_count=%d, "
81 "your triplet_index_offset=%d, triplet_count=%d",
87 MUDA_KERNEL_ASSERT(submatrix_offset.x >= 0 && submatrix_offset.y >= 0,
88 "TripletMatrixView: submatrix_offset is out of range, submatrix_offset.x=%d, submatrix_offset.y=%d",
92 MUDA_KERNEL_ASSERT(submatrix_offset.x + submatrix_extent.x <= rows,
93 "TripletMatrixView: submatrix is out of range, submatrix_offset.x=%d, submatrix_extent.x=%d, total_block_rows=%d",
98 MUDA_KERNEL_ASSERT(submatrix_offset.y + submatrix_extent.y <= cols,
99 "TripletMatrixView: submatrix is out of range, submatrix_offset.y=%d, submatrix_extent.y=%d, total_block_cols=%d",
107 int total_triplet_count,
108 auto_const_t<int>* row_indices,
109 auto_const_t<int>* col_indices,
110 auto_const_t<Ty>* values,
111 cusparseSpMatDescr_t descr,
112 cusparseMatDescr_t legacy_descr,
130 MUDA_GENERIC
auto as_const()
const
134 m_triplet_index_offset,
136 m_total_triplet_count,
147 MUDA_GENERIC
operator ConstView()
const {
return as_const(); }
149 MUDA_GENERIC
auto cviewer()
const
151 MUDA_KERNEL_ASSERT(!m_trans,
152 "COOMatrixView: cviewer() is not supported for "
153 "transposed matrix, please use a non-transposed view of this matrix");
156 m_triplet_index_offset,
158 m_total_triplet_count,
166 MUDA_GENERIC
auto viewer()
168 MUDA_ASSERT(!m_trans,
169 "COOMatrixView: viewer() is not supported for "
170 "transposed matrix, please use a non-transposed view of this matrix");
173 m_triplet_index_offset,
175 m_total_triplet_count,
184 auto_const_t<Ty>* block_values() {
return m_values; }
185 auto_const_t<int>* block_row_indices() {
return m_row_indices; }
186 auto_const_t<int>* block_col_indices() {
return m_col_indices; }
190 auto block_values()
const {
return m_values; }
191 auto block_row_indices()
const {
return m_row_indices; }
192 auto block_col_indices()
const {
return m_col_indices; }
194 auto block_rows()
const {
return m_rows; }
195 auto block_cols()
const {
return m_cols; }
196 auto triplet_count()
const {
return m_triplet_count; }
197 auto tripet_index_offset()
const {
return m_triplet_index_offset; }
198 auto total_triplet_count()
const {
return m_total_triplet_count; }
199 auto is_trans()
const {
return m_trans; }
201 auto legacy_descr()
const {
return m_legacy_descr; }
202 auto descr()
const {
return m_descr; }