21#ifndef PM_MATRIX_ENTRY_H 
   22#define PM_MATRIX_ENTRY_H 
   28namespace persistence_matrix {
 
   39  template <
typename Index>
 
   52  template <
class Field_element>
 
   63template <
typename Index>
 
  107    std::swap(columnIndex_, other.columnIndex_);
 
  122template <
class Field_element>
 
  166  void set_element(
const Field_element& element) { element_ = element; }
 
  172    std::swap(element_, other.element_);
 
  177  Field_element element_;  
 
  190template <
class Master_matrix>
 
  191class Entry : 
public Master_matrix::Entry_column_index_option,
 
  192             public Master_matrix::Entry_field_element_option,
 
  193             public Master_matrix::Row_hook,
 
  194             public Master_matrix::Column_hook 
 
  197  using col_opt = 
typename Master_matrix::Entry_column_index_option;
 
  198  using field_opt = 
typename Master_matrix::Entry_field_element_option;
 
  202  using Index = 
typename Master_matrix::Index;            
 
  222  Entry(
Index columnIndex, 
ID_index rowIndex) : col_opt(columnIndex), field_opt(), rowIndex_(rowIndex){};
 
  229      : col_opt(static_cast<const col_opt&>(entry)),
 
  230        field_opt(static_cast<const field_opt&>(entry)),
 
  231        rowIndex_(entry.rowIndex_){};
 
  238      : col_opt(std::move(
static_cast<col_opt&
>(entry))),
 
  239        field_opt(std::move(
static_cast<field_opt&
>(entry))),
 
  240        rowIndex_(std::exchange(entry.rowIndex_, 0)){};
 
  259    col_opt::operator=(other);
 
  260    field_opt::operator=(other);
 
  261    std::swap(rowIndex_, other.rowIndex_);
 
  295  operator std::pair<ID_index, Field_element>()
 const {
 
  296    if constexpr (Master_matrix::Option_list::is_z2) {
 
  297      return {rowIndex_, 1};
 
  299      return {rowIndex_, field_opt::element_};
 
  320template <
class Master_matrix>
 
  321struct std::hash<
Gudhi::persistence_matrix::Entry<Master_matrix> > {
 
Class managing the column index access of an entry.
Definition: entry_types.h:65
 
Entry_column_index & operator=(Entry_column_index other)
Assign operator.
Definition: entry_types.h:106
 
Entry_column_index()
Default constructor. Sets to the column index to -1.
Definition: entry_types.h:70
 
Entry_column_index(Index columnIndex)
Stores the given column index.
Definition: entry_types.h:76
 
Entry_column_index(const Entry_column_index &entry)
Copy constructor.
Definition: entry_types.h:82
 
void set_column_index(Index columnIndex)
Sets the column index to the given value.
Definition: entry_types.h:101
 
Entry_column_index(Entry_column_index &&entry) noexcept
Move constructor.
Definition: entry_types.h:88
 
Index get_column_index() const
Returns the MatIdx column index stored in the entry.
Definition: entry_types.h:95
 
Class managing the value access of an entry.
Definition: entry_types.h:124
 
void set_element(const Field_element &element)
Sets the value.
Definition: entry_types.h:166
 
const Field_element & get_element() const
Returns the value stored in the entry.
Definition: entry_types.h:160
 
Entry_field_element(const Entry_field_element &entry)
Copy constructor.
Definition: entry_types.h:141
 
Entry_field_element(Entry_field_element &&entry) noexcept
Move constructor.
Definition: entry_types.h:147
 
Field_element & get_element()
Returns the value stored in the entry.
Definition: entry_types.h:154
 
Entry_field_element(Field_element element)
Stores the given element.
Definition: entry_types.h:135
 
Entry_field_element & operator=(Entry_field_element other)
Assign operator.
Definition: entry_types.h:171
 
Entry_field_element()
Default constructor. Sets to the element to 0.
Definition: entry_types.h:129
 
Matrix entry class. Stores by default only the row index it belongs to, but can also store its column...
Definition: entry_types.h:195
 
Master_matrix Master
Definition: entry_types.h:201
 
typename Master_matrix::Index Index
Definition: entry_types.h:202
 
typename Master_matrix::ID_index ID_index
Definition: entry_types.h:203
 
Entry(const Entry &entry)
Copy constructor.
Definition: entry_types.h:228
 
Entry()
Constructs an entry with all attributes at default values.
Definition: entry_types.h:209
 
void set_row_index(ID_index rowIndex)
Sets the row index stored in the entry.
Definition: entry_types.h:253
 
friend bool operator==(const Entry &c1, const Entry &c2)
Equality comparator.
Definition: entry_types.h:282
 
Entry(ID_index rowIndex)
Constructs an entry with given row index. Other possible attributes are set at default values.
Definition: entry_types.h:215
 
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:222
 
Entry & operator=(Entry other)
Assign operator.
Definition: entry_types.h:258
 
ID_index get_row_index() const
Returns the row index stored in the entry.
Definition: entry_types.h:247
 
typename Master_matrix::Element Field_element
Definition: entry_types.h:204
 
friend bool operator<(const Entry &c1, const Entry &c2)
Strictly smaller than comparator.
Definition: entry_types.h:273
 
Entry(Entry &&entry) noexcept
Move constructor.
Definition: entry_types.h:237
 
Gudhi namespace.
Definition: SimplicialComplexForAlpha.h:14
 
Empty structure. Inherited instead of Entry_column_index, when the row access is disabled.
Definition: entry_types.h:37
 
Empty structure. Inherited instead of Entry_field_element, when PersistenceMatrixOptions::is_z2 is tr...
Definition: entry_types.h:50