multipers 2.3.3b6__cp310-cp310-manylinux_2_39_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of multipers might be problematic. Click here for more details.

Files changed (182) hide show
  1. multipers/__init__.py +33 -0
  2. multipers/_signed_measure_meta.py +453 -0
  3. multipers/_slicer_meta.py +211 -0
  4. multipers/array_api/__init__.py +45 -0
  5. multipers/array_api/numpy.py +41 -0
  6. multipers/array_api/torch.py +58 -0
  7. multipers/data/MOL2.py +458 -0
  8. multipers/data/UCR.py +18 -0
  9. multipers/data/__init__.py +1 -0
  10. multipers/data/graphs.py +466 -0
  11. multipers/data/immuno_regions.py +27 -0
  12. multipers/data/minimal_presentation_to_st_bf.py +0 -0
  13. multipers/data/pytorch2simplextree.py +91 -0
  14. multipers/data/shape3d.py +101 -0
  15. multipers/data/synthetic.py +113 -0
  16. multipers/distances.py +202 -0
  17. multipers/filtration_conversions.pxd +229 -0
  18. multipers/filtration_conversions.pxd.tp +84 -0
  19. multipers/filtrations/__init__.py +18 -0
  20. multipers/filtrations/density.py +574 -0
  21. multipers/filtrations/filtrations.py +361 -0
  22. multipers/filtrations.pxd +224 -0
  23. multipers/function_rips.cpython-310-x86_64-linux-gnu.so +0 -0
  24. multipers/function_rips.pyx +105 -0
  25. multipers/grids.cpython-310-x86_64-linux-gnu.so +0 -0
  26. multipers/grids.pyx +433 -0
  27. multipers/gudhi/Persistence_slices_interface.h +132 -0
  28. multipers/gudhi/Simplex_tree_interface.h +239 -0
  29. multipers/gudhi/Simplex_tree_multi_interface.h +551 -0
  30. multipers/gudhi/cubical_to_boundary.h +59 -0
  31. multipers/gudhi/gudhi/Bitmap_cubical_complex.h +450 -0
  32. multipers/gudhi/gudhi/Bitmap_cubical_complex_base.h +1070 -0
  33. multipers/gudhi/gudhi/Bitmap_cubical_complex_periodic_boundary_conditions_base.h +579 -0
  34. multipers/gudhi/gudhi/Debug_utils.h +45 -0
  35. multipers/gudhi/gudhi/Fields/Multi_field.h +484 -0
  36. multipers/gudhi/gudhi/Fields/Multi_field_operators.h +455 -0
  37. multipers/gudhi/gudhi/Fields/Multi_field_shared.h +450 -0
  38. multipers/gudhi/gudhi/Fields/Multi_field_small.h +531 -0
  39. multipers/gudhi/gudhi/Fields/Multi_field_small_operators.h +507 -0
  40. multipers/gudhi/gudhi/Fields/Multi_field_small_shared.h +531 -0
  41. multipers/gudhi/gudhi/Fields/Z2_field.h +355 -0
  42. multipers/gudhi/gudhi/Fields/Z2_field_operators.h +376 -0
  43. multipers/gudhi/gudhi/Fields/Zp_field.h +420 -0
  44. multipers/gudhi/gudhi/Fields/Zp_field_operators.h +400 -0
  45. multipers/gudhi/gudhi/Fields/Zp_field_shared.h +418 -0
  46. multipers/gudhi/gudhi/Flag_complex_edge_collapser.h +337 -0
  47. multipers/gudhi/gudhi/Matrix.h +2107 -0
  48. multipers/gudhi/gudhi/Multi_critical_filtration.h +1038 -0
  49. multipers/gudhi/gudhi/Multi_persistence/Box.h +174 -0
  50. multipers/gudhi/gudhi/Multi_persistence/Line.h +282 -0
  51. multipers/gudhi/gudhi/Off_reader.h +173 -0
  52. multipers/gudhi/gudhi/One_critical_filtration.h +1441 -0
  53. multipers/gudhi/gudhi/Persistence_matrix/Base_matrix.h +769 -0
  54. multipers/gudhi/gudhi/Persistence_matrix/Base_matrix_with_column_compression.h +686 -0
  55. multipers/gudhi/gudhi/Persistence_matrix/Boundary_matrix.h +842 -0
  56. multipers/gudhi/gudhi/Persistence_matrix/Chain_matrix.h +1350 -0
  57. multipers/gudhi/gudhi/Persistence_matrix/Id_to_index_overlay.h +1105 -0
  58. multipers/gudhi/gudhi/Persistence_matrix/Position_to_index_overlay.h +859 -0
  59. multipers/gudhi/gudhi/Persistence_matrix/RU_matrix.h +910 -0
  60. multipers/gudhi/gudhi/Persistence_matrix/allocators/entry_constructors.h +139 -0
  61. multipers/gudhi/gudhi/Persistence_matrix/base_pairing.h +230 -0
  62. multipers/gudhi/gudhi/Persistence_matrix/base_swap.h +211 -0
  63. multipers/gudhi/gudhi/Persistence_matrix/boundary_cell_position_to_id_mapper.h +60 -0
  64. multipers/gudhi/gudhi/Persistence_matrix/boundary_face_position_to_id_mapper.h +60 -0
  65. multipers/gudhi/gudhi/Persistence_matrix/chain_pairing.h +136 -0
  66. multipers/gudhi/gudhi/Persistence_matrix/chain_rep_cycles.h +190 -0
  67. multipers/gudhi/gudhi/Persistence_matrix/chain_vine_swap.h +616 -0
  68. multipers/gudhi/gudhi/Persistence_matrix/columns/chain_column_extra_properties.h +150 -0
  69. multipers/gudhi/gudhi/Persistence_matrix/columns/column_dimension_holder.h +106 -0
  70. multipers/gudhi/gudhi/Persistence_matrix/columns/column_utilities.h +219 -0
  71. multipers/gudhi/gudhi/Persistence_matrix/columns/entry_types.h +327 -0
  72. multipers/gudhi/gudhi/Persistence_matrix/columns/heap_column.h +1140 -0
  73. multipers/gudhi/gudhi/Persistence_matrix/columns/intrusive_list_column.h +934 -0
  74. multipers/gudhi/gudhi/Persistence_matrix/columns/intrusive_set_column.h +934 -0
  75. multipers/gudhi/gudhi/Persistence_matrix/columns/list_column.h +980 -0
  76. multipers/gudhi/gudhi/Persistence_matrix/columns/naive_vector_column.h +1092 -0
  77. multipers/gudhi/gudhi/Persistence_matrix/columns/row_access.h +192 -0
  78. multipers/gudhi/gudhi/Persistence_matrix/columns/set_column.h +921 -0
  79. multipers/gudhi/gudhi/Persistence_matrix/columns/small_vector_column.h +1093 -0
  80. multipers/gudhi/gudhi/Persistence_matrix/columns/unordered_set_column.h +1012 -0
  81. multipers/gudhi/gudhi/Persistence_matrix/columns/vector_column.h +1244 -0
  82. multipers/gudhi/gudhi/Persistence_matrix/matrix_dimension_holders.h +186 -0
  83. multipers/gudhi/gudhi/Persistence_matrix/matrix_row_access.h +164 -0
  84. multipers/gudhi/gudhi/Persistence_matrix/ru_pairing.h +156 -0
  85. multipers/gudhi/gudhi/Persistence_matrix/ru_rep_cycles.h +376 -0
  86. multipers/gudhi/gudhi/Persistence_matrix/ru_vine_swap.h +540 -0
  87. multipers/gudhi/gudhi/Persistent_cohomology/Field_Zp.h +118 -0
  88. multipers/gudhi/gudhi/Persistent_cohomology/Multi_field.h +173 -0
  89. multipers/gudhi/gudhi/Persistent_cohomology/Persistent_cohomology_column.h +128 -0
  90. multipers/gudhi/gudhi/Persistent_cohomology.h +745 -0
  91. multipers/gudhi/gudhi/Points_off_io.h +171 -0
  92. multipers/gudhi/gudhi/Simple_object_pool.h +69 -0
  93. multipers/gudhi/gudhi/Simplex_tree/Simplex_tree_iterators.h +463 -0
  94. multipers/gudhi/gudhi/Simplex_tree/Simplex_tree_node_explicit_storage.h +83 -0
  95. multipers/gudhi/gudhi/Simplex_tree/Simplex_tree_siblings.h +106 -0
  96. multipers/gudhi/gudhi/Simplex_tree/Simplex_tree_star_simplex_iterators.h +277 -0
  97. multipers/gudhi/gudhi/Simplex_tree/hooks_simplex_base.h +62 -0
  98. multipers/gudhi/gudhi/Simplex_tree/indexing_tag.h +27 -0
  99. multipers/gudhi/gudhi/Simplex_tree/serialization_utils.h +62 -0
  100. multipers/gudhi/gudhi/Simplex_tree/simplex_tree_options.h +157 -0
  101. multipers/gudhi/gudhi/Simplex_tree.h +2794 -0
  102. multipers/gudhi/gudhi/Simplex_tree_multi.h +152 -0
  103. multipers/gudhi/gudhi/distance_functions.h +62 -0
  104. multipers/gudhi/gudhi/graph_simplicial_complex.h +104 -0
  105. multipers/gudhi/gudhi/persistence_interval.h +253 -0
  106. multipers/gudhi/gudhi/persistence_matrix_options.h +170 -0
  107. multipers/gudhi/gudhi/reader_utils.h +367 -0
  108. multipers/gudhi/mma_interface_coh.h +256 -0
  109. multipers/gudhi/mma_interface_h0.h +223 -0
  110. multipers/gudhi/mma_interface_matrix.h +293 -0
  111. multipers/gudhi/naive_merge_tree.h +536 -0
  112. multipers/gudhi/scc_io.h +310 -0
  113. multipers/gudhi/truc.h +1403 -0
  114. multipers/io.cpython-310-x86_64-linux-gnu.so +0 -0
  115. multipers/io.pyx +644 -0
  116. multipers/ml/__init__.py +0 -0
  117. multipers/ml/accuracies.py +90 -0
  118. multipers/ml/invariants_with_persistable.py +79 -0
  119. multipers/ml/kernels.py +176 -0
  120. multipers/ml/mma.py +713 -0
  121. multipers/ml/one.py +472 -0
  122. multipers/ml/point_clouds.py +352 -0
  123. multipers/ml/signed_measures.py +1589 -0
  124. multipers/ml/sliced_wasserstein.py +461 -0
  125. multipers/ml/tools.py +113 -0
  126. multipers/mma_structures.cpython-310-x86_64-linux-gnu.so +0 -0
  127. multipers/mma_structures.pxd +128 -0
  128. multipers/mma_structures.pyx +2786 -0
  129. multipers/mma_structures.pyx.tp +1094 -0
  130. multipers/multi_parameter_rank_invariant/diff_helpers.h +84 -0
  131. multipers/multi_parameter_rank_invariant/euler_characteristic.h +97 -0
  132. multipers/multi_parameter_rank_invariant/function_rips.h +322 -0
  133. multipers/multi_parameter_rank_invariant/hilbert_function.h +769 -0
  134. multipers/multi_parameter_rank_invariant/persistence_slices.h +148 -0
  135. multipers/multi_parameter_rank_invariant/rank_invariant.h +369 -0
  136. multipers/multiparameter_edge_collapse.py +41 -0
  137. multipers/multiparameter_module_approximation/approximation.h +2330 -0
  138. multipers/multiparameter_module_approximation/combinatory.h +129 -0
  139. multipers/multiparameter_module_approximation/debug.h +107 -0
  140. multipers/multiparameter_module_approximation/euler_curves.h +0 -0
  141. multipers/multiparameter_module_approximation/format_python-cpp.h +286 -0
  142. multipers/multiparameter_module_approximation/heap_column.h +238 -0
  143. multipers/multiparameter_module_approximation/images.h +79 -0
  144. multipers/multiparameter_module_approximation/list_column.h +174 -0
  145. multipers/multiparameter_module_approximation/list_column_2.h +232 -0
  146. multipers/multiparameter_module_approximation/ru_matrix.h +347 -0
  147. multipers/multiparameter_module_approximation/set_column.h +135 -0
  148. multipers/multiparameter_module_approximation/structure_higher_dim_barcode.h +36 -0
  149. multipers/multiparameter_module_approximation/unordered_set_column.h +166 -0
  150. multipers/multiparameter_module_approximation/utilities.h +403 -0
  151. multipers/multiparameter_module_approximation/vector_column.h +223 -0
  152. multipers/multiparameter_module_approximation/vector_matrix.h +331 -0
  153. multipers/multiparameter_module_approximation/vineyards.h +464 -0
  154. multipers/multiparameter_module_approximation/vineyards_trajectories.h +649 -0
  155. multipers/multiparameter_module_approximation.cpython-310-x86_64-linux-gnu.so +0 -0
  156. multipers/multiparameter_module_approximation.pyx +235 -0
  157. multipers/pickle.py +90 -0
  158. multipers/plots.py +456 -0
  159. multipers/point_measure.cpython-310-x86_64-linux-gnu.so +0 -0
  160. multipers/point_measure.pyx +395 -0
  161. multipers/simplex_tree_multi.cpython-310-x86_64-linux-gnu.so +0 -0
  162. multipers/simplex_tree_multi.pxd +134 -0
  163. multipers/simplex_tree_multi.pyx +10840 -0
  164. multipers/simplex_tree_multi.pyx.tp +2009 -0
  165. multipers/slicer.cpython-310-x86_64-linux-gnu.so +0 -0
  166. multipers/slicer.pxd +3034 -0
  167. multipers/slicer.pxd.tp +234 -0
  168. multipers/slicer.pyx +20481 -0
  169. multipers/slicer.pyx.tp +1088 -0
  170. multipers/tensor/tensor.h +672 -0
  171. multipers/tensor.pxd +13 -0
  172. multipers/test.pyx +44 -0
  173. multipers/tests/__init__.py +62 -0
  174. multipers/torch/__init__.py +1 -0
  175. multipers/torch/diff_grids.py +240 -0
  176. multipers/torch/rips_density.py +310 -0
  177. multipers-2.3.3b6.dist-info/METADATA +128 -0
  178. multipers-2.3.3b6.dist-info/RECORD +182 -0
  179. multipers-2.3.3b6.dist-info/WHEEL +5 -0
  180. multipers-2.3.3b6.dist-info/licenses/LICENSE +21 -0
  181. multipers-2.3.3b6.dist-info/top_level.txt +1 -0
  182. multipers.libs/libtbb-ca48af5c.so.12.16 +0 -0
@@ -0,0 +1,327 @@
1
+ /* This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
2
+ * See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details.
3
+ * Author(s): Hannah Schreiber
4
+ *
5
+ * Copyright (C) 2022-24 Inria
6
+ *
7
+ * Modification(s):
8
+ * - YYYY/MM Author: Description of the modification
9
+ */
10
+
11
+ /**
12
+ * @file entry_types.h
13
+ * @author Hannah Schreiber
14
+ * @brief Contains the @ref Gudhi::persistence_matrix::Entry, @ref Gudhi::persistence_matrix::Entry_column_index and
15
+ * @ref Gudhi::persistence_matrix::Entry_field_element classes, as well as the
16
+ * @ref Gudhi::persistence_matrix::Dummy_entry_column_index_mixin and
17
+ * @ref Gudhi::persistence_matrix::Dummy_entry_field_element_mixin structures.
18
+ * Also defines the std::hash method for @ref Gudhi::persistence_matrix::Entry.
19
+ */
20
+
21
+ #ifndef PM_MATRIX_ENTRY_H
22
+ #define PM_MATRIX_ENTRY_H
23
+
24
+ #include <utility> //std::swap, std::exchange & std::move
25
+ #include <functional> //std::hash
26
+
27
+ namespace Gudhi {
28
+ namespace persistence_matrix {
29
+
30
+ /**
31
+ * @ingroup persistence_matrix
32
+ *
33
+ * @brief Empty structure.
34
+ * Inherited instead of @ref Entry_column_index, when the row access is disabled.
35
+ */
36
+ struct Dummy_entry_column_index_mixin
37
+ {
38
+ Dummy_entry_column_index_mixin() {}
39
+ template <typename Index>
40
+ Dummy_entry_column_index_mixin([[maybe_unused]] Index columnIndex) {}
41
+ };
42
+
43
+ /**
44
+ * @ingroup persistence_matrix
45
+ *
46
+ * @brief Empty structure.
47
+ * Inherited instead of @ref Entry_field_element, when @ref PersistenceMatrixOptions::is_z2 is true.
48
+ */
49
+ struct Dummy_entry_field_element_mixin
50
+ {
51
+ Dummy_entry_field_element_mixin() {}
52
+ template <class Field_element>
53
+ Dummy_entry_field_element_mixin([[maybe_unused]] Field_element t) {}
54
+ };
55
+
56
+ /**
57
+ * @ingroup persistence_matrix
58
+ *
59
+ * @brief Class managing the column index access of an entry.
60
+ *
61
+ * @tparam Index @ref MatIdx index type.
62
+ */
63
+ template <typename Index>
64
+ class Entry_column_index
65
+ {
66
+ public:
67
+ /**
68
+ * @brief Default constructor. Sets to the column index to -1.
69
+ */
70
+ Entry_column_index() : columnIndex_(-1){};
71
+ /**
72
+ * @brief Stores the given column index.
73
+ *
74
+ * @param columnIndex Column index of the entry.
75
+ */
76
+ Entry_column_index(Index columnIndex) : columnIndex_(columnIndex){};
77
+ /**
78
+ * @brief Copy constructor.
79
+ *
80
+ * @param entry Entry to copy.
81
+ */
82
+ Entry_column_index(const Entry_column_index& entry) : columnIndex_(entry.columnIndex_){};
83
+ /**
84
+ * @brief Move constructor.
85
+ *
86
+ * @param entry Entry to move.
87
+ */
88
+ Entry_column_index(Entry_column_index&& entry) noexcept : columnIndex_(std::exchange(entry.columnIndex_, 0)){};
89
+
90
+ /**
91
+ * @brief Returns the @ref MatIdx column index stored in the entry.
92
+ *
93
+ * @return Column index of the entry.
94
+ */
95
+ Index get_column_index() const { return columnIndex_; };
96
+ /**
97
+ * @brief Sets the column index to the given value.
98
+ *
99
+ * @param columnIndex Column index of the entry.
100
+ */
101
+ void set_column_index(Index columnIndex) { columnIndex_ = columnIndex; }
102
+
103
+ /**
104
+ * @brief Assign operator.
105
+ */
106
+ Entry_column_index& operator=(Entry_column_index other) {
107
+ std::swap(columnIndex_, other.columnIndex_);
108
+ return *this;
109
+ };
110
+
111
+ private:
112
+ Index columnIndex_; /**< Column index. */
113
+ };
114
+
115
+ /**
116
+ * @ingroup persistence_matrix
117
+ *
118
+ * @brief Class managing the value access of an entry.
119
+ *
120
+ * @tparam Field_element Type of an entry value.
121
+ */
122
+ template <class Field_element>
123
+ class Entry_field_element
124
+ {
125
+ public:
126
+ /**
127
+ * @brief Default constructor. Sets to the element to 0.
128
+ */
129
+ Entry_field_element() : element_(0){};
130
+ /**
131
+ * @brief Stores the given element.
132
+ *
133
+ * @param element Value to store.
134
+ */
135
+ Entry_field_element(Field_element element) : element_(element){};
136
+ /**
137
+ * @brief Copy constructor.
138
+ *
139
+ * @param entry Entry to copy.
140
+ */
141
+ Entry_field_element(const Entry_field_element& entry) : element_(entry.element_){};
142
+ /**
143
+ * @brief Move constructor.
144
+ *
145
+ * @param entry Entry to move.
146
+ */
147
+ Entry_field_element(Entry_field_element&& entry) noexcept : element_(std::move(entry.element_)){};
148
+
149
+ /**
150
+ * @brief Returns the value stored in the entry.
151
+ *
152
+ * @return Reference to the value of the entry.
153
+ */
154
+ Field_element& get_element() { return element_; };
155
+ /**
156
+ * @brief Returns the value stored in the entry.
157
+ *
158
+ * @return Const reference to the value of the entry.
159
+ */
160
+ const Field_element& get_element() const { return element_; };
161
+ /**
162
+ * @brief Sets the value.
163
+ *
164
+ * @param element Value to store.
165
+ */
166
+ void set_element(const Field_element& element) { element_ = element; }
167
+
168
+ /**
169
+ * @brief Assign operator.
170
+ */
171
+ Entry_field_element& operator=(Entry_field_element other) {
172
+ std::swap(element_, other.element_);
173
+ return *this;
174
+ };
175
+
176
+ private:
177
+ Field_element element_; /**< Value of the entry. */
178
+ };
179
+
180
+ /**
181
+ * @class Entry entry_types.h gudhi/Persistence_matrix/columns/entry_types.h
182
+ * @ingroup persistence_matrix
183
+ *
184
+ * @brief %Matrix entry class. Stores by default only the row index it belongs to, but can also store its
185
+ * column index when the row access is enabled, as well as its value when they are different from only 0 and 1.
186
+ * Zero-valued entries are never made explicit in the matrix.
187
+ *
188
+ * @tparam Master_matrix An instantiation of @ref Matrix from which all types and options are deduced.
189
+ */
190
+ template <class Master_matrix>
191
+ class 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
195
+ {
196
+ private:
197
+ using col_opt = typename Master_matrix::Entry_column_index_option;
198
+ using field_opt = typename Master_matrix::Entry_field_element_option;
199
+
200
+ public:
201
+ using Master = Master_matrix; /**< Access to options from outside. */
202
+ using Index = typename Master_matrix::Index; /**< Column index type. */
203
+ using ID_index = typename Master_matrix::ID_index; /**< Row index type. */
204
+ using Field_element = typename Master_matrix::Element; /**< Value type. */
205
+
206
+ /**
207
+ * @brief Constructs an entry with all attributes at default values.
208
+ */
209
+ Entry(){};
210
+ /**
211
+ * @brief Constructs an entry with given row index. Other possible attributes are set at default values.
212
+ *
213
+ * @param rowIndex @ref rowindex "Row index" of the entry.
214
+ */
215
+ Entry(ID_index rowIndex) : col_opt(), field_opt(), rowIndex_(rowIndex){};
216
+ /**
217
+ * @brief Constructs an entry with given row and column index. Other possible attributes are set at default values.
218
+ *
219
+ * @param columnIndex Column index of the entry.
220
+ * @param rowIndex @ref rowindex "Row index" of the entry.
221
+ */
222
+ Entry(Index columnIndex, ID_index rowIndex) : col_opt(columnIndex), field_opt(), rowIndex_(rowIndex){};
223
+ /**
224
+ * @brief Copy constructor.
225
+ *
226
+ * @param entry Entry to copy.
227
+ */
228
+ Entry(const Entry& entry)
229
+ : col_opt(static_cast<const col_opt&>(entry)),
230
+ field_opt(static_cast<const field_opt&>(entry)),
231
+ rowIndex_(entry.rowIndex_){};
232
+ /**
233
+ * @brief Move constructor.
234
+ *
235
+ * @param entry Entry to move.
236
+ */
237
+ Entry(Entry&& entry) noexcept
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)){};
241
+
242
+ /**
243
+ * @brief Returns the row index stored in the entry.
244
+ *
245
+ * @return @ref rowindex "Row index" of the entry.
246
+ */
247
+ ID_index get_row_index() const { return rowIndex_; };
248
+ /**
249
+ * @brief Sets the row index stored in the entry.
250
+ *
251
+ * @param rowIndex @ref rowindex "Row index" of the entry.
252
+ */
253
+ void set_row_index(ID_index rowIndex) { rowIndex_ = rowIndex; };
254
+
255
+ /**
256
+ * @brief Assign operator.
257
+ */
258
+ Entry& operator=(Entry other) {
259
+ col_opt::operator=(other);
260
+ field_opt::operator=(other);
261
+ std::swap(rowIndex_, other.rowIndex_);
262
+ return *this;
263
+ };
264
+
265
+ /**
266
+ * @brief Strictly smaller than comparator.
267
+ *
268
+ * @param c1 First entry to compare.
269
+ * @param c2 Second entry to compare.
270
+ * @return true If the row index of the first entry is strictly smaller than the row index of the second entry.
271
+ * @return false Otherwise.
272
+ */
273
+ friend bool operator<(const Entry& c1, const Entry& c2) { return c1.get_row_index() < c2.get_row_index(); }
274
+ /**
275
+ * @brief Equality comparator.
276
+ *
277
+ * @param c1 First entry to compare.
278
+ * @param c2 Second entry to compare.
279
+ * @return true If the row index of the first entry is equal to the row index of the second entry.
280
+ * @return false Otherwise.
281
+ */
282
+ friend bool operator==(const Entry& c1, const Entry& c2) { return c1.get_row_index() == c2.get_row_index(); }
283
+
284
+ /**
285
+ * @brief Converts the entry into a row index.
286
+ *
287
+ * @return The row index of the entry.
288
+ */
289
+ operator ID_index() const { return rowIndex_; }
290
+ /**
291
+ * @brief Converts the entry into a pair of row index and entry value.
292
+ *
293
+ * @return A std::pair with first element the row index and second element the value.
294
+ */
295
+ operator std::pair<ID_index, Field_element>() const {
296
+ if constexpr (Master_matrix::Option_list::is_z2) {
297
+ return {rowIndex_, 1};
298
+ } else {
299
+ return {rowIndex_, field_opt::element_};
300
+ }
301
+ }
302
+
303
+ private:
304
+ ID_index rowIndex_; /**< Row index of the entry. */
305
+ };
306
+
307
+ } // namespace persistence_matrix
308
+ } // namespace Gudhi
309
+
310
+ /**
311
+ * @ingroup persistence_matrix
312
+ *
313
+ * @brief Hash method for @ref Gudhi::persistence_matrix::Entry.
314
+ *
315
+ * The entries are differentiated by their row indices only. For example, two entries with the same row index
316
+ * but different column indices have the same hash value.
317
+ *
318
+ * @tparam Master_matrix Template parameter of @ref Gudhi::persistence_matrix::Entry.
319
+ */
320
+ template <class Master_matrix>
321
+ struct std::hash<Gudhi::persistence_matrix::Entry<Master_matrix> > {
322
+ std::size_t operator()(const Gudhi::persistence_matrix::Entry<Master_matrix>& entry) const {
323
+ return std::hash<unsigned int>()(entry.get_row_index());
324
+ }
325
+ };
326
+
327
+ #endif // PM_MATRIX_ENTRY_H