16 template <
typename U,
int M>
18 using BlockMatrix = Eigen::Matrix<T, N, N>;
36 void reshape(
int row,
int col)
42 void resize_triplets(
size_t nonzero_count)
44 m_block_values.resize(nonzero_count);
45 m_block_row_indices.resize(nonzero_count);
46 m_block_col_indices.resize(nonzero_count);
49 void reserve_triplets(
size_t nonzero_count)
51 m_block_values.reserve(nonzero_count);
52 m_block_row_indices.reserve(nonzero_count);
53 m_block_col_indices.reserve(nonzero_count);
56 void resize(
int row,
int col,
size_t nonzero_count)
59 resize_triplets(nonzero_count);
62 static constexpr int block_dim() {
return N; }
64 auto block_values() {
return m_block_values.view(); }
65 auto block_values()
const {
return m_block_values.view(); }
66 auto block_row_indices() {
return m_block_row_indices.view(); }
67 auto block_row_indices()
const {
return m_block_row_indices.view(); }
68 auto block_col_indices() {
return m_block_col_indices.view(); }
69 auto block_col_indices()
const {
return m_block_col_indices.view(); }
71 auto block_rows()
const {
return m_block_rows; }
72 auto block_cols()
const {
return m_block_cols; }
73 auto triplet_count()
const {
return m_block_values.size(); }
74 auto triplet_capacity()
const {
return m_block_values.capacity(); }
80 (int)m_block_values.size(),
81 m_block_row_indices.data(),
82 m_block_col_indices.data(),
83 m_block_values.data()};
86 auto view()
const {
return remove_const(*this).view().as_const(); }
88 auto cview()
const {
return view(); }
90 auto viewer() {
return view().viewer(); }
92 auto cviewer()
const {
return view().cviewer(); }
101 m_block_values.clear();
102 m_block_row_indices.clear();
103 m_block_col_indices.clear();
111 template <
typename U,
int M>
130 void reshape(
int row,
int col)
136 void resize_triplets(
size_t nonzero_count)
138 m_values.resize(nonzero_count);
139 m_row_indices.resize(nonzero_count);
140 m_col_indices.resize(nonzero_count);
143 void reserve_triplets(
size_t nonzero_count)
145 m_values.reserve(nonzero_count);
146 m_row_indices.reserve(nonzero_count);
147 m_col_indices.reserve(nonzero_count);
150 void resize(
int row,
int col,
size_t nonzero_count)
153 resize_triplets(nonzero_count);
156 static constexpr int block_size() {
return 1; }
158 auto values() {
return m_values.view(); }
159 auto values()
const {
return m_values.view(); }
160 auto row_indices() {
return m_row_indices.view(); }
161 auto row_indices()
const {
return m_row_indices.view(); }
162 auto col_indices() {
return m_col_indices.view(); }
163 auto col_indices()
const {
return m_col_indices.view(); }
165 auto rows()
const {
return m_rows; }
166 auto cols()
const {
return m_cols; }
167 auto triplet_count()
const {
return m_values.size(); }
169 auto view()
const {
return remove_const(*this).view().as_const(); }
175 (int)m_values.size(),
176 m_row_indices.data(),
177 m_col_indices.data(),
181 auto viewer() {
return view().viewer(); }
182 auto cviewer()
const {
return view().cviewer(); }
192 m_row_indices.clear();
193 m_col_indices.clear();