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.
- multipers/__init__.py +33 -0
- multipers/_signed_measure_meta.py +453 -0
- multipers/_slicer_meta.py +211 -0
- multipers/array_api/__init__.py +45 -0
- multipers/array_api/numpy.py +41 -0
- multipers/array_api/torch.py +58 -0
- multipers/data/MOL2.py +458 -0
- multipers/data/UCR.py +18 -0
- multipers/data/__init__.py +1 -0
- multipers/data/graphs.py +466 -0
- multipers/data/immuno_regions.py +27 -0
- multipers/data/minimal_presentation_to_st_bf.py +0 -0
- multipers/data/pytorch2simplextree.py +91 -0
- multipers/data/shape3d.py +101 -0
- multipers/data/synthetic.py +113 -0
- multipers/distances.py +202 -0
- multipers/filtration_conversions.pxd +229 -0
- multipers/filtration_conversions.pxd.tp +84 -0
- multipers/filtrations/__init__.py +18 -0
- multipers/filtrations/density.py +574 -0
- multipers/filtrations/filtrations.py +361 -0
- multipers/filtrations.pxd +224 -0
- multipers/function_rips.cpython-310-x86_64-linux-gnu.so +0 -0
- multipers/function_rips.pyx +105 -0
- multipers/grids.cpython-310-x86_64-linux-gnu.so +0 -0
- multipers/grids.pyx +433 -0
- multipers/gudhi/Persistence_slices_interface.h +132 -0
- multipers/gudhi/Simplex_tree_interface.h +239 -0
- multipers/gudhi/Simplex_tree_multi_interface.h +551 -0
- multipers/gudhi/cubical_to_boundary.h +59 -0
- multipers/gudhi/gudhi/Bitmap_cubical_complex.h +450 -0
- multipers/gudhi/gudhi/Bitmap_cubical_complex_base.h +1070 -0
- multipers/gudhi/gudhi/Bitmap_cubical_complex_periodic_boundary_conditions_base.h +579 -0
- multipers/gudhi/gudhi/Debug_utils.h +45 -0
- multipers/gudhi/gudhi/Fields/Multi_field.h +484 -0
- multipers/gudhi/gudhi/Fields/Multi_field_operators.h +455 -0
- multipers/gudhi/gudhi/Fields/Multi_field_shared.h +450 -0
- multipers/gudhi/gudhi/Fields/Multi_field_small.h +531 -0
- multipers/gudhi/gudhi/Fields/Multi_field_small_operators.h +507 -0
- multipers/gudhi/gudhi/Fields/Multi_field_small_shared.h +531 -0
- multipers/gudhi/gudhi/Fields/Z2_field.h +355 -0
- multipers/gudhi/gudhi/Fields/Z2_field_operators.h +376 -0
- multipers/gudhi/gudhi/Fields/Zp_field.h +420 -0
- multipers/gudhi/gudhi/Fields/Zp_field_operators.h +400 -0
- multipers/gudhi/gudhi/Fields/Zp_field_shared.h +418 -0
- multipers/gudhi/gudhi/Flag_complex_edge_collapser.h +337 -0
- multipers/gudhi/gudhi/Matrix.h +2107 -0
- multipers/gudhi/gudhi/Multi_critical_filtration.h +1038 -0
- multipers/gudhi/gudhi/Multi_persistence/Box.h +174 -0
- multipers/gudhi/gudhi/Multi_persistence/Line.h +282 -0
- multipers/gudhi/gudhi/Off_reader.h +173 -0
- multipers/gudhi/gudhi/One_critical_filtration.h +1441 -0
- multipers/gudhi/gudhi/Persistence_matrix/Base_matrix.h +769 -0
- multipers/gudhi/gudhi/Persistence_matrix/Base_matrix_with_column_compression.h +686 -0
- multipers/gudhi/gudhi/Persistence_matrix/Boundary_matrix.h +842 -0
- multipers/gudhi/gudhi/Persistence_matrix/Chain_matrix.h +1350 -0
- multipers/gudhi/gudhi/Persistence_matrix/Id_to_index_overlay.h +1105 -0
- multipers/gudhi/gudhi/Persistence_matrix/Position_to_index_overlay.h +859 -0
- multipers/gudhi/gudhi/Persistence_matrix/RU_matrix.h +910 -0
- multipers/gudhi/gudhi/Persistence_matrix/allocators/entry_constructors.h +139 -0
- multipers/gudhi/gudhi/Persistence_matrix/base_pairing.h +230 -0
- multipers/gudhi/gudhi/Persistence_matrix/base_swap.h +211 -0
- multipers/gudhi/gudhi/Persistence_matrix/boundary_cell_position_to_id_mapper.h +60 -0
- multipers/gudhi/gudhi/Persistence_matrix/boundary_face_position_to_id_mapper.h +60 -0
- multipers/gudhi/gudhi/Persistence_matrix/chain_pairing.h +136 -0
- multipers/gudhi/gudhi/Persistence_matrix/chain_rep_cycles.h +190 -0
- multipers/gudhi/gudhi/Persistence_matrix/chain_vine_swap.h +616 -0
- multipers/gudhi/gudhi/Persistence_matrix/columns/chain_column_extra_properties.h +150 -0
- multipers/gudhi/gudhi/Persistence_matrix/columns/column_dimension_holder.h +106 -0
- multipers/gudhi/gudhi/Persistence_matrix/columns/column_utilities.h +219 -0
- multipers/gudhi/gudhi/Persistence_matrix/columns/entry_types.h +327 -0
- multipers/gudhi/gudhi/Persistence_matrix/columns/heap_column.h +1140 -0
- multipers/gudhi/gudhi/Persistence_matrix/columns/intrusive_list_column.h +934 -0
- multipers/gudhi/gudhi/Persistence_matrix/columns/intrusive_set_column.h +934 -0
- multipers/gudhi/gudhi/Persistence_matrix/columns/list_column.h +980 -0
- multipers/gudhi/gudhi/Persistence_matrix/columns/naive_vector_column.h +1092 -0
- multipers/gudhi/gudhi/Persistence_matrix/columns/row_access.h +192 -0
- multipers/gudhi/gudhi/Persistence_matrix/columns/set_column.h +921 -0
- multipers/gudhi/gudhi/Persistence_matrix/columns/small_vector_column.h +1093 -0
- multipers/gudhi/gudhi/Persistence_matrix/columns/unordered_set_column.h +1012 -0
- multipers/gudhi/gudhi/Persistence_matrix/columns/vector_column.h +1244 -0
- multipers/gudhi/gudhi/Persistence_matrix/matrix_dimension_holders.h +186 -0
- multipers/gudhi/gudhi/Persistence_matrix/matrix_row_access.h +164 -0
- multipers/gudhi/gudhi/Persistence_matrix/ru_pairing.h +156 -0
- multipers/gudhi/gudhi/Persistence_matrix/ru_rep_cycles.h +376 -0
- multipers/gudhi/gudhi/Persistence_matrix/ru_vine_swap.h +540 -0
- multipers/gudhi/gudhi/Persistent_cohomology/Field_Zp.h +118 -0
- multipers/gudhi/gudhi/Persistent_cohomology/Multi_field.h +173 -0
- multipers/gudhi/gudhi/Persistent_cohomology/Persistent_cohomology_column.h +128 -0
- multipers/gudhi/gudhi/Persistent_cohomology.h +745 -0
- multipers/gudhi/gudhi/Points_off_io.h +171 -0
- multipers/gudhi/gudhi/Simple_object_pool.h +69 -0
- multipers/gudhi/gudhi/Simplex_tree/Simplex_tree_iterators.h +463 -0
- multipers/gudhi/gudhi/Simplex_tree/Simplex_tree_node_explicit_storage.h +83 -0
- multipers/gudhi/gudhi/Simplex_tree/Simplex_tree_siblings.h +106 -0
- multipers/gudhi/gudhi/Simplex_tree/Simplex_tree_star_simplex_iterators.h +277 -0
- multipers/gudhi/gudhi/Simplex_tree/hooks_simplex_base.h +62 -0
- multipers/gudhi/gudhi/Simplex_tree/indexing_tag.h +27 -0
- multipers/gudhi/gudhi/Simplex_tree/serialization_utils.h +62 -0
- multipers/gudhi/gudhi/Simplex_tree/simplex_tree_options.h +157 -0
- multipers/gudhi/gudhi/Simplex_tree.h +2794 -0
- multipers/gudhi/gudhi/Simplex_tree_multi.h +152 -0
- multipers/gudhi/gudhi/distance_functions.h +62 -0
- multipers/gudhi/gudhi/graph_simplicial_complex.h +104 -0
- multipers/gudhi/gudhi/persistence_interval.h +253 -0
- multipers/gudhi/gudhi/persistence_matrix_options.h +170 -0
- multipers/gudhi/gudhi/reader_utils.h +367 -0
- multipers/gudhi/mma_interface_coh.h +256 -0
- multipers/gudhi/mma_interface_h0.h +223 -0
- multipers/gudhi/mma_interface_matrix.h +293 -0
- multipers/gudhi/naive_merge_tree.h +536 -0
- multipers/gudhi/scc_io.h +310 -0
- multipers/gudhi/truc.h +1403 -0
- multipers/io.cpython-310-x86_64-linux-gnu.so +0 -0
- multipers/io.pyx +644 -0
- multipers/ml/__init__.py +0 -0
- multipers/ml/accuracies.py +90 -0
- multipers/ml/invariants_with_persistable.py +79 -0
- multipers/ml/kernels.py +176 -0
- multipers/ml/mma.py +713 -0
- multipers/ml/one.py +472 -0
- multipers/ml/point_clouds.py +352 -0
- multipers/ml/signed_measures.py +1589 -0
- multipers/ml/sliced_wasserstein.py +461 -0
- multipers/ml/tools.py +113 -0
- multipers/mma_structures.cpython-310-x86_64-linux-gnu.so +0 -0
- multipers/mma_structures.pxd +128 -0
- multipers/mma_structures.pyx +2786 -0
- multipers/mma_structures.pyx.tp +1094 -0
- multipers/multi_parameter_rank_invariant/diff_helpers.h +84 -0
- multipers/multi_parameter_rank_invariant/euler_characteristic.h +97 -0
- multipers/multi_parameter_rank_invariant/function_rips.h +322 -0
- multipers/multi_parameter_rank_invariant/hilbert_function.h +769 -0
- multipers/multi_parameter_rank_invariant/persistence_slices.h +148 -0
- multipers/multi_parameter_rank_invariant/rank_invariant.h +369 -0
- multipers/multiparameter_edge_collapse.py +41 -0
- multipers/multiparameter_module_approximation/approximation.h +2330 -0
- multipers/multiparameter_module_approximation/combinatory.h +129 -0
- multipers/multiparameter_module_approximation/debug.h +107 -0
- multipers/multiparameter_module_approximation/euler_curves.h +0 -0
- multipers/multiparameter_module_approximation/format_python-cpp.h +286 -0
- multipers/multiparameter_module_approximation/heap_column.h +238 -0
- multipers/multiparameter_module_approximation/images.h +79 -0
- multipers/multiparameter_module_approximation/list_column.h +174 -0
- multipers/multiparameter_module_approximation/list_column_2.h +232 -0
- multipers/multiparameter_module_approximation/ru_matrix.h +347 -0
- multipers/multiparameter_module_approximation/set_column.h +135 -0
- multipers/multiparameter_module_approximation/structure_higher_dim_barcode.h +36 -0
- multipers/multiparameter_module_approximation/unordered_set_column.h +166 -0
- multipers/multiparameter_module_approximation/utilities.h +403 -0
- multipers/multiparameter_module_approximation/vector_column.h +223 -0
- multipers/multiparameter_module_approximation/vector_matrix.h +331 -0
- multipers/multiparameter_module_approximation/vineyards.h +464 -0
- multipers/multiparameter_module_approximation/vineyards_trajectories.h +649 -0
- multipers/multiparameter_module_approximation.cpython-310-x86_64-linux-gnu.so +0 -0
- multipers/multiparameter_module_approximation.pyx +235 -0
- multipers/pickle.py +90 -0
- multipers/plots.py +456 -0
- multipers/point_measure.cpython-310-x86_64-linux-gnu.so +0 -0
- multipers/point_measure.pyx +395 -0
- multipers/simplex_tree_multi.cpython-310-x86_64-linux-gnu.so +0 -0
- multipers/simplex_tree_multi.pxd +134 -0
- multipers/simplex_tree_multi.pyx +10840 -0
- multipers/simplex_tree_multi.pyx.tp +2009 -0
- multipers/slicer.cpython-310-x86_64-linux-gnu.so +0 -0
- multipers/slicer.pxd +3034 -0
- multipers/slicer.pxd.tp +234 -0
- multipers/slicer.pyx +20481 -0
- multipers/slicer.pyx.tp +1088 -0
- multipers/tensor/tensor.h +672 -0
- multipers/tensor.pxd +13 -0
- multipers/test.pyx +44 -0
- multipers/tests/__init__.py +62 -0
- multipers/torch/__init__.py +1 -0
- multipers/torch/diff_grids.py +240 -0
- multipers/torch/rips_density.py +310 -0
- multipers-2.3.3b6.dist-info/METADATA +128 -0
- multipers-2.3.3b6.dist-info/RECORD +182 -0
- multipers-2.3.3b6.dist-info/WHEEL +5 -0
- multipers-2.3.3b6.dist-info/licenses/LICENSE +21 -0
- multipers-2.3.3b6.dist-info/top_level.txt +1 -0
- 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
|