21#ifndef PM_MATRIX_ENTRY_H
22#define PM_MATRIX_ENTRY_H
36struct Dummy_entry_column_index_mixin {
37 Dummy_entry_column_index_mixin() =
default;
39 template <
typename Index>
40 Dummy_entry_column_index_mixin([[maybe_unused]] Index columnIndex)
50struct Dummy_entry_field_element_mixin {
51 Dummy_entry_field_element_mixin() =
default;
53 template <
class Field_element>
54 Dummy_entry_field_element_mixin([[maybe_unused]] Field_element t)
57 static constexpr bool get_element() {
return true; };
58 static constexpr void set_element(
bool ) {}
68template <
typename Index>
108template <
class Field_element>
142 void set_element(
const Field_element& element) { element_ = element; }
145 Field_element element_;
158template <
class Master_matrix>
159class Entry :
public Master_matrix::Entry_column_index_option,
160 public Master_matrix::Entry_field_element_option,
161 public Master_matrix::Row_hook,
162 public Master_matrix::Column_hook
165 using col_opt =
typename Master_matrix::Entry_column_index_option;
166 using field_opt =
typename Master_matrix::Entry_field_element_option;
170 using Index =
typename Master_matrix::Index;
190 Entry(
Index columnIndex,
ID_index rowIndex) : col_opt(columnIndex), field_opt(), rowIndex_(rowIndex) {};
197 : col_opt(static_cast<const col_opt&>(entry)),
198 field_opt(static_cast<const field_opt&>(entry)),
199 rowIndex_(entry.rowIndex_) {};
206 : col_opt(std::move(
static_cast<col_opt&
>(entry))),
207 field_opt(std::move(
static_cast<field_opt&
>(entry))),
208 rowIndex_(std::exchange(entry.rowIndex_, 0)) {};
231 col_opt::operator=(std::move(other));
232 field_opt::operator=(std::move(other));
233 std::swap(rowIndex_, other.rowIndex_);
242 if (
this == &other)
return *
this;
244 col_opt::operator=(std::move(other));
245 field_opt::operator=(std::move(other));
246 rowIndex_ = std::exchange(other.rowIndex_, 0);
282 operator std::pair<ID_index, Field_element>()
const
284 return {rowIndex_, field_opt::get_element()};
304template <
class Master_matrix>
305struct std::hash<
Gudhi::persistence_matrix::Entry<Master_matrix> > {
Entry_column_index()
Default constructor. Sets to the column index to -1.
Definition entry_types.h:75
Entry_column_index(Index columnIndex)
Stores the given column index.
Definition entry_types.h:81
void set_column_index(Index columnIndex)
Sets the column index to the given value.
Definition entry_types.h:95
Index get_column_index() const
Returns the MatIdx column index stored in the entry.
Definition entry_types.h:88
void set_element(const Field_element &element)
Sets the value.
Definition entry_types.h:142
const Field_element & get_element() const
Returns the value stored in the entry.
Definition entry_types.h:135
Field_element & get_element()
Returns the value stored in the entry.
Definition entry_types.h:128
Entry_field_element(Field_element element)
Stores the given element.
Definition entry_types.h:121
Entry_field_element()
Default constructor. Sets to the element to 0.
Definition entry_types.h:115
Matrix entry class. Stores by default only the row index it belongs to, but can also store its column...
Definition entry_types.h:163
Matrix< PersistenceMatrixOptions > Master
Definition entry_types.h:169
typename Matrix< PersistenceMatrixOptions >::Index Index
Definition entry_types.h:170
typename Matrix< PersistenceMatrixOptions >::ID_index ID_index
Definition entry_types.h:171
Entry(const Entry &entry)
Copy constructor.
Definition entry_types.h:196
Entry & operator=(Entry &&other) &&noexcept
Move assign operator.
Definition entry_types.h:240
void set_row_index(ID_index rowIndex)
Sets the row index stored in the entry.
Definition entry_types.h:224
friend bool operator==(const Entry &c1, const Entry &c2)
Equality comparator.
Definition entry_types.h:268
Entry(ID_index rowIndex)
Constructs an entry with given row index. Other possible attributes are set at default values.
Definition entry_types.h:183
Entry & operator=(Entry other) &
Assign operator.
Definition entry_types.h:229
Entry(Index columnIndex, ID_index rowIndex)
Constructs an entry with given row and column index. Other possible attributes are set at default val...
Definition entry_types.h:190
ID_index get_row_index() const
Returns the row index stored in the entry.
Definition entry_types.h:217
typename Matrix< PersistenceMatrixOptions >::Element Field_element
Definition entry_types.h:172
Entry()=default
Constructs an entry with all attributes at default values.
friend bool operator<(const Entry &c1, const Entry &c2)
Strictly smaller than comparator.
Definition entry_types.h:258
Entry(Entry &&entry) noexcept
Move constructor.
Definition entry_types.h:205
Persistence matrix namespace.
Definition FieldOperators.h:18
Gudhi namespace.
Definition SimplicialComplexForAlpha.h:14