18#ifndef PM_ROW_ACCESS_H
19#define PM_ROW_ACCESS_H
32struct Dummy_row_access {
33 friend void swap([[maybe_unused]] Dummy_row_access& d1, [[maybe_unused]] Dummy_row_access& d2)
noexcept {}
35 Dummy_row_access() =
default;
37 template <
typename Index,
class Row_container>
38 Dummy_row_access([[maybe_unused]] Index columnIndex, [[maybe_unused]] Row_container& rows)
50template <
class Master_matrix>
54 using Index =
typename Master_matrix::Index;
55 using ID_index =
typename Master_matrix::ID_index;
122 std::swap(r1.rows_, r2.rows_);
123 std::swap(r1.columnIndex_, r2.columnIndex_);
130 using Base_hook_matrix_row =
typename Master_matrix::Base_hook_matrix_row;
133template <
class Master_matrix>
135 : columnIndex_(Master_matrix::template get_null_value<
Index>()), rows_(nullptr)
138template <
class Master_matrix>
140 : columnIndex_(columnIndex), rows_(rows)
143template <
class Master_matrix>
145 : columnIndex_(std::exchange(other.columnIndex_, 0)), rows_(other.rows_)
148template <
class Master_matrix>
151 if (rows_ ==
nullptr)
return;
153 if constexpr (!Master_matrix::Option_list::has_removable_rows) {
154 if (rows_->size() < rowIndex + 1) rows_->resize(rowIndex + 1);
158 if constexpr (Master_matrix::Option_list::has_intrusive_rows) {
159 rows_->operator[](rowIndex).push_back(*entry);
161 rows_->operator[](rowIndex).insert(*entry);
165template <
class Master_matrix>
168 if (rows_ ==
nullptr)
return;
170 if constexpr (Master_matrix::Option_list::has_intrusive_rows) {
171 entry->Base_hook_matrix_row::unlink();
173 if constexpr (Master_matrix::Option_list::has_removable_rows) {
174 auto it = rows_->find(entry->get_row_index());
175 it->second.erase(*entry);
177 rows_->operator[](entry->get_row_index()).erase(*entry);
182template <
class Master_matrix>
185 if constexpr (!Master_matrix::Option_list::has_intrusive_rows) {
186 if (rows_ ==
nullptr)
return;
187 auto& row = rows_->at(entry.get_row_index());
188 auto it = row.find(entry);
190 row.insert(it, entry);
194template <
class Master_matrix>
typename Master_matrix::Matrix_entry Matrix_entry
Definition row_access.h:56
Row_access()
Default constructor. Sets the column index to null index and the row container to nullptr....
Definition row_access.h:134
typename Master_matrix::ID_index ID_index
Definition row_access.h:55
typename Master_matrix::Row_container Row_container
Definition row_access.h:57
void unlink(Matrix_entry *entry)
Removes the given entry from its row.
Definition row_access.h:166
void insert_entry(ID_index rowIndex, Matrix_entry *entry)
Inserts the given entry at the given row index.
Definition row_access.h:149
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:183
friend void swap(Row_access &r1, Row_access &r2) noexcept
Swap operator.
Definition row_access.h:120
typename Master_matrix::Index Index
Definition row_access.h:54
Index get_column_index() const
Returns the MatIdx column index.
Definition row_access.h:195
Persistence matrix namespace.
Definition FieldOperators.h:18
Gudhi namespace.
Definition SimplicialComplexForAlpha.h:14