18#ifndef PM_ROW_ACCESS_H
19#define PM_ROW_ACCESS_H
24namespace persistence_matrix {
37 template <
typename Index,
class Row_container>
38 Dummy_row_access([[maybe_unused]] Index columnIndex, [[maybe_unused]] Row_container& rows) {}
49template <
class Master_matrix>
53 using Index =
typename Master_matrix::Index;
54 using ID_index =
typename Master_matrix::ID_index;
111 std::swap(r1.rows_, r2.rows_);
112 std::swap(r1.columnIndex_, r2.columnIndex_);
120 using Base_hook_matrix_row =
typename Master_matrix::Base_hook_matrix_row;
123template <
class Master_matrix>
125 : columnIndex_(Master_matrix::template get_null_value<
Index>()), rows_(nullptr)
128template <
class Master_matrix>
130 : columnIndex_(columnIndex), rows_(rows)
133template <
class Master_matrix>
135 : columnIndex_(std::exchange(other.columnIndex_, 0)), rows_(other.rows_)
138template <
class Master_matrix>
141 if (rows_ ==
nullptr)
return;
143 if constexpr (!Master_matrix::Option_list::has_removable_rows) {
144 if (rows_->size() < rowIndex + 1) rows_->resize(rowIndex + 1);
148 if constexpr (Master_matrix::Option_list::has_intrusive_rows) {
149 rows_->operator[](rowIndex).push_back(*entry);
151 rows_->operator[](rowIndex).insert(*entry);
155template <
class Master_matrix>
158 if (rows_ ==
nullptr)
return;
160 if constexpr (Master_matrix::Option_list::has_intrusive_rows) {
161 entry->Base_hook_matrix_row::unlink();
163 if constexpr (Master_matrix::Option_list::has_removable_rows) {
164 auto it = rows_->find(entry->get_row_index());
165 it->second.erase(*entry);
167 rows_->operator[](entry->get_row_index()).erase(*entry);
172template <
class Master_matrix>
175 if constexpr (!Master_matrix::Option_list::has_intrusive_rows) {
176 if (rows_ ==
nullptr)
return;
177 auto& row = rows_->at(entry.get_row_index());
178 auto it = row.find(entry);
180 row.insert(it, entry);
184template <
class Master_matrix>
Class managing the row access for the columns.
Definition: row_access.h:51
typename Master_matrix::Matrix_entry Matrix_entry
Definition: row_access.h:55
Row_access()
Default constructor. Sets the column index to null index and the row container to nullptr....
Definition: row_access.h:124
typename Master_matrix::ID_index ID_index
Definition: row_access.h:54
typename Master_matrix::Row_container Row_container
Definition: row_access.h:56
void unlink(Matrix_entry *entry)
Removes the given entry from its row.
Definition: row_access.h:156
void insert_entry(ID_index rowIndex, Matrix_entry *entry)
Inserts the given entry at the given row index.
Definition: row_access.h:139
void update_entry(const Matrix_entry &entry)
If PersistenceMatrixOptions::has_intrusive_rows is false, updates the copy of the entry in its row....
Definition: row_access.h:173
typename Master_matrix::Index Index
Definition: row_access.h:53
friend void swap(Row_access &r1, Row_access &r2)
Swap operator.
Definition: row_access.h:110
Index get_column_index() const
Returns the MatIdx column index.
Definition: row_access.h:185
Gudhi namespace.
Definition: SimplicialComplexForAlpha.h:14
Empty structure. Inherited instead of Row_access, if the row access is not enabled.
Definition: row_access.h:33