18#ifndef PM_BASE_MATRIX_RA_H
19#define PM_BASE_MATRIX_RA_H
24namespace persistence_matrix {
52template <
typename Row,
typename Row_container,
bool has_removable_rows,
typename ID_index>
68 if constexpr (!has_removable_rows) {
69 rows_->resize(numberOfRows);
78 : rows_(new Row_container())
80 if constexpr (!has_removable_rows) {
81 rows_->resize(toCopy.rows_->size());
104 if constexpr (has_removable_rows) {
105 return rows_->at(rowIndex);
107 return rows_->operator[](rowIndex);
119 if constexpr (has_removable_rows) {
120 return rows_->at(rowIndex);
122 return rows_->operator[](rowIndex);
132 static_assert(has_removable_rows,
"'erase_empty_row' is not implemented for the chosen options.");
134 auto it = rows_->find(rowIndex);
135 if (it != rows_->end() && it->second.empty()) rows_->erase(it);
142 if constexpr (has_removable_rows)
143 rows_->reserve(other.rows_->size());
145 rows_->resize(other.rows_->size());
158 Row_container* rows_;
Class managing the row access for the inheriting matrix.
Definition: matrix_row_access.h:54
friend void swap(Matrix_row_access &matrix1, Matrix_row_access &matrix2)
Swap operator.
Definition: matrix_row_access.h:151
const Row & get_row(ID_index rowIndex) const
Returns the row at the given row index. The type of the row depends on the chosen options,...
Definition: matrix_row_access.h:118
Matrix_row_access()
Default constructor.
Definition: matrix_row_access.h:59
Matrix_row_access & operator=(const Matrix_row_access &other)
Assign operator.
Definition: matrix_row_access.h:141
~Matrix_row_access()
Destructor.
Definition: matrix_row_access.h:93
void erase_empty_row(ID_index rowIndex)
Only available if PersistenceMatrixOptions::has_removable_rows is true. Removes the given row from th...
Definition: matrix_row_access.h:131
Row & get_row(ID_index rowIndex)
Returns the row at the given row index. The type of the row depends on the chosen options,...
Definition: matrix_row_access.h:103
Matrix_row_access(const Matrix_row_access &toCopy)
Copy constructor.
Definition: matrix_row_access.h:77
Matrix_row_access(unsigned int numberOfRows)
Constructor reserving space for the given number of rows.
Definition: matrix_row_access.h:67
Matrix_row_access(Matrix_row_access &&other) noexcept
Move constructor.
Definition: matrix_row_access.h:89
Gudhi namespace.
Definition: SimplicialComplexForAlpha.h:14
Empty structure. Inherited instead of Matrix_row_access, when the the row access is not enabled.
Definition: matrix_row_access.h:33