18 static_assert(N >= 2,
"Block size must be >= 2");
21 using BlockMatrix = Eigen::Matrix<Ty, N, N>;
27 mutable cusparseSpMatDescr_t m_descr =
nullptr;
28 mutable cusparseMatDescr_t m_legacy_descr =
nullptr;
43 void reshape(
int row,
int col);
44 void reserve(
int non_zero_blocks);
45 void reserve_offsets(
int size);
46 void resize(
int non_zero_blocks);
48 static constexpr int block_size() {
return N; }
50 auto block_values() {
return m_block_values.view(); }
51 auto block_values()
const {
return m_block_values.view(); }
53 auto block_row_offsets() {
return m_block_row_offsets.view(); }
54 auto block_row_offsets()
const {
return m_block_row_offsets.view(); }
56 auto block_col_indices() {
return m_block_col_indices.view(); }
57 auto block_col_indices()
const {
return m_block_col_indices.view(); }
59 auto block_rows()
const {
return m_row; }
60 auto block_cols()
const {
return m_col; }
61 auto non_zero_blocks()
const {
return m_block_values.size(); }
63 cusparseSpMatDescr_t descr()
const;
64 cusparseMatDescr_t legacy_descr()
const;
70 m_block_row_offsets.data(),
71 m_block_col_indices.data(),
72 m_block_values.data(),
73 (int)m_block_values.size(),
85 m_block_row_offsets.data(),
86 m_block_col_indices.data(),
87 m_block_values.data(),
88 (int)m_block_values.size(),
96 auto cview()
const {
return view(); }
98 auto T()
const {
return view().T(); }
99 auto T() {
return view().T(); }
104 void destroy_all_descr()
const;