17 #ifndef PM_BASE_MATRIX_RA_H
18 #define PM_BASE_MATRIX_RA_H
23 namespace persistence_matrix {
50 template <
typename Row_type,
typename Row_container_type,
bool has_removable_rows,
typename id_index>
66 if constexpr (!has_removable_rows) {
67 rows_->resize(numberOfRows);
76 : rows_(new Row_container_type())
78 if constexpr (!has_removable_rows) {
79 rows_->resize(toCopy.rows_->size());
102 if constexpr (has_removable_rows) {
103 return rows_->at(rowIndex);
105 return rows_->operator[](rowIndex);
116 const Row_type&
get_row(id_index rowIndex)
const {
117 if constexpr (has_removable_rows) {
118 return rows_->at(rowIndex);
120 return rows_->operator[](rowIndex);
130 static_assert(has_removable_rows,
"'erase_empty_row' is not implemented for the chosen options.");
132 auto it = rows_->find(rowIndex);
133 if (it != rows_->end() && it->second.empty()) rows_->erase(it);
140 if constexpr (has_removable_rows)
141 rows_->reserve(other.rows_->size());
143 rows_->resize(other.rows_->size());
156 Row_container_type* rows_;
Class managing the row access for the inheritating matrix.
Definition: matrix_row_access.h:52
Matrix_row_access & operator=(const Matrix_row_access &other)
Assign operator.
Definition: matrix_row_access.h:139
Matrix_row_access(unsigned int numberOfRows)
Constructor reserving space for the given number of rows.
Definition: matrix_row_access.h:65
friend void swap(Matrix_row_access &matrix1, Matrix_row_access &matrix2)
Swap operator.
Definition: matrix_row_access.h:149
const Row_type & get_row(id_index rowIndex) const
Returns the row at the given row index. The type of the row depends on the choosen options,...
Definition: matrix_row_access.h:116
Row_type & get_row(id_index rowIndex)
Returns the row at the given row index. The type of the row depends on the choosen options,...
Definition: matrix_row_access.h:101
Matrix_row_access(const Matrix_row_access &toCopy)
Copy constructor.
Definition: matrix_row_access.h:75
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:129
Matrix_row_access()
Default constructor.
Definition: matrix_row_access.h:57
Matrix_row_access(Matrix_row_access &&other) noexcept
Move constructor.
Definition: matrix_row_access.h:87
~Matrix_row_access()
Destructor.
Definition: matrix_row_access.h:91
Gudhi namespace.
Definition: SimplicialComplexForAlpha.h:14
Empty structure. Inheritated instead of Matrix_row_access, when the the row access is not enabled.
Definition: matrix_row_access.h:31