multipers 2.2.3__cp310-cp310-win_amd64.whl → 2.3.1__cp310-cp310-win_amd64.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 -31
  2. multipers/_signed_measure_meta.py +430 -430
  3. multipers/_slicer_meta.py +211 -212
  4. multipers/data/MOL2.py +458 -458
  5. multipers/data/UCR.py +18 -18
  6. multipers/data/graphs.py +466 -466
  7. multipers/data/immuno_regions.py +27 -27
  8. multipers/data/pytorch2simplextree.py +90 -90
  9. multipers/data/shape3d.py +101 -101
  10. multipers/data/synthetic.py +113 -111
  11. multipers/distances.py +198 -198
  12. multipers/filtration_conversions.pxd.tp +84 -84
  13. multipers/filtrations/__init__.py +18 -0
  14. multipers/{ml/convolutions.py → filtrations/density.py} +563 -520
  15. multipers/filtrations/filtrations.py +289 -0
  16. multipers/filtrations.pxd +224 -224
  17. multipers/function_rips.cp310-win_amd64.pyd +0 -0
  18. multipers/function_rips.pyx +105 -105
  19. multipers/grids.cp310-win_amd64.pyd +0 -0
  20. multipers/grids.pyx +350 -350
  21. multipers/gudhi/Persistence_slices_interface.h +132 -132
  22. multipers/gudhi/Simplex_tree_interface.h +239 -245
  23. multipers/gudhi/Simplex_tree_multi_interface.h +516 -561
  24. multipers/gudhi/cubical_to_boundary.h +59 -59
  25. multipers/gudhi/gudhi/Bitmap_cubical_complex.h +450 -450
  26. multipers/gudhi/gudhi/Bitmap_cubical_complex_base.h +1070 -1070
  27. multipers/gudhi/gudhi/Bitmap_cubical_complex_periodic_boundary_conditions_base.h +579 -579
  28. multipers/gudhi/gudhi/Debug_utils.h +45 -45
  29. multipers/gudhi/gudhi/Fields/Multi_field.h +484 -484
  30. multipers/gudhi/gudhi/Fields/Multi_field_operators.h +455 -455
  31. multipers/gudhi/gudhi/Fields/Multi_field_shared.h +450 -450
  32. multipers/gudhi/gudhi/Fields/Multi_field_small.h +531 -531
  33. multipers/gudhi/gudhi/Fields/Multi_field_small_operators.h +507 -507
  34. multipers/gudhi/gudhi/Fields/Multi_field_small_shared.h +531 -531
  35. multipers/gudhi/gudhi/Fields/Z2_field.h +355 -355
  36. multipers/gudhi/gudhi/Fields/Z2_field_operators.h +376 -376
  37. multipers/gudhi/gudhi/Fields/Zp_field.h +420 -420
  38. multipers/gudhi/gudhi/Fields/Zp_field_operators.h +400 -400
  39. multipers/gudhi/gudhi/Fields/Zp_field_shared.h +418 -418
  40. multipers/gudhi/gudhi/Flag_complex_edge_collapser.h +337 -337
  41. multipers/gudhi/gudhi/Matrix.h +2107 -2107
  42. multipers/gudhi/gudhi/Multi_critical_filtration.h +1038 -1038
  43. multipers/gudhi/gudhi/Multi_persistence/Box.h +171 -171
  44. multipers/gudhi/gudhi/Multi_persistence/Line.h +282 -282
  45. multipers/gudhi/gudhi/Off_reader.h +173 -173
  46. multipers/gudhi/gudhi/One_critical_filtration.h +1433 -1431
  47. multipers/gudhi/gudhi/Persistence_matrix/Base_matrix.h +769 -769
  48. multipers/gudhi/gudhi/Persistence_matrix/Base_matrix_with_column_compression.h +686 -686
  49. multipers/gudhi/gudhi/Persistence_matrix/Boundary_matrix.h +842 -842
  50. multipers/gudhi/gudhi/Persistence_matrix/Chain_matrix.h +1350 -1350
  51. multipers/gudhi/gudhi/Persistence_matrix/Id_to_index_overlay.h +1105 -1105
  52. multipers/gudhi/gudhi/Persistence_matrix/Position_to_index_overlay.h +859 -859
  53. multipers/gudhi/gudhi/Persistence_matrix/RU_matrix.h +910 -910
  54. multipers/gudhi/gudhi/Persistence_matrix/allocators/entry_constructors.h +139 -139
  55. multipers/gudhi/gudhi/Persistence_matrix/base_pairing.h +230 -230
  56. multipers/gudhi/gudhi/Persistence_matrix/base_swap.h +211 -211
  57. multipers/gudhi/gudhi/Persistence_matrix/boundary_cell_position_to_id_mapper.h +60 -60
  58. multipers/gudhi/gudhi/Persistence_matrix/boundary_face_position_to_id_mapper.h +60 -60
  59. multipers/gudhi/gudhi/Persistence_matrix/chain_pairing.h +136 -136
  60. multipers/gudhi/gudhi/Persistence_matrix/chain_rep_cycles.h +190 -190
  61. multipers/gudhi/gudhi/Persistence_matrix/chain_vine_swap.h +616 -616
  62. multipers/gudhi/gudhi/Persistence_matrix/columns/chain_column_extra_properties.h +150 -150
  63. multipers/gudhi/gudhi/Persistence_matrix/columns/column_dimension_holder.h +106 -106
  64. multipers/gudhi/gudhi/Persistence_matrix/columns/column_utilities.h +219 -219
  65. multipers/gudhi/gudhi/Persistence_matrix/columns/entry_types.h +327 -327
  66. multipers/gudhi/gudhi/Persistence_matrix/columns/heap_column.h +1140 -1140
  67. multipers/gudhi/gudhi/Persistence_matrix/columns/intrusive_list_column.h +934 -934
  68. multipers/gudhi/gudhi/Persistence_matrix/columns/intrusive_set_column.h +934 -934
  69. multipers/gudhi/gudhi/Persistence_matrix/columns/list_column.h +980 -980
  70. multipers/gudhi/gudhi/Persistence_matrix/columns/naive_vector_column.h +1092 -1092
  71. multipers/gudhi/gudhi/Persistence_matrix/columns/row_access.h +192 -192
  72. multipers/gudhi/gudhi/Persistence_matrix/columns/set_column.h +921 -921
  73. multipers/gudhi/gudhi/Persistence_matrix/columns/small_vector_column.h +1093 -1093
  74. multipers/gudhi/gudhi/Persistence_matrix/columns/unordered_set_column.h +1012 -1012
  75. multipers/gudhi/gudhi/Persistence_matrix/columns/vector_column.h +1244 -1244
  76. multipers/gudhi/gudhi/Persistence_matrix/matrix_dimension_holders.h +186 -186
  77. multipers/gudhi/gudhi/Persistence_matrix/matrix_row_access.h +164 -164
  78. multipers/gudhi/gudhi/Persistence_matrix/ru_pairing.h +156 -156
  79. multipers/gudhi/gudhi/Persistence_matrix/ru_rep_cycles.h +376 -376
  80. multipers/gudhi/gudhi/Persistence_matrix/ru_vine_swap.h +540 -540
  81. multipers/gudhi/gudhi/Persistent_cohomology/Field_Zp.h +118 -118
  82. multipers/gudhi/gudhi/Persistent_cohomology/Multi_field.h +173 -173
  83. multipers/gudhi/gudhi/Persistent_cohomology/Persistent_cohomology_column.h +128 -128
  84. multipers/gudhi/gudhi/Persistent_cohomology.h +745 -745
  85. multipers/gudhi/gudhi/Points_off_io.h +171 -171
  86. multipers/gudhi/gudhi/Simple_object_pool.h +69 -69
  87. multipers/gudhi/gudhi/Simplex_tree/Simplex_tree_iterators.h +463 -463
  88. multipers/gudhi/gudhi/Simplex_tree/Simplex_tree_node_explicit_storage.h +83 -83
  89. multipers/gudhi/gudhi/Simplex_tree/Simplex_tree_siblings.h +106 -106
  90. multipers/gudhi/gudhi/Simplex_tree/Simplex_tree_star_simplex_iterators.h +277 -277
  91. multipers/gudhi/gudhi/Simplex_tree/hooks_simplex_base.h +62 -62
  92. multipers/gudhi/gudhi/Simplex_tree/indexing_tag.h +27 -27
  93. multipers/gudhi/gudhi/Simplex_tree/serialization_utils.h +62 -62
  94. multipers/gudhi/gudhi/Simplex_tree/simplex_tree_options.h +157 -157
  95. multipers/gudhi/gudhi/Simplex_tree.h +2794 -2794
  96. multipers/gudhi/gudhi/Simplex_tree_multi.h +152 -163
  97. multipers/gudhi/gudhi/distance_functions.h +62 -62
  98. multipers/gudhi/gudhi/graph_simplicial_complex.h +104 -104
  99. multipers/gudhi/gudhi/persistence_interval.h +253 -253
  100. multipers/gudhi/gudhi/persistence_matrix_options.h +170 -170
  101. multipers/gudhi/gudhi/reader_utils.h +367 -367
  102. multipers/gudhi/mma_interface_coh.h +256 -255
  103. multipers/gudhi/mma_interface_h0.h +223 -231
  104. multipers/gudhi/mma_interface_matrix.h +291 -282
  105. multipers/gudhi/naive_merge_tree.h +536 -575
  106. multipers/gudhi/scc_io.h +310 -289
  107. multipers/gudhi/truc.h +957 -888
  108. multipers/io.cp310-win_amd64.pyd +0 -0
  109. multipers/io.pyx +714 -711
  110. multipers/ml/accuracies.py +90 -90
  111. multipers/ml/invariants_with_persistable.py +79 -79
  112. multipers/ml/kernels.py +176 -176
  113. multipers/ml/mma.py +713 -714
  114. multipers/ml/one.py +472 -472
  115. multipers/ml/point_clouds.py +352 -346
  116. multipers/ml/signed_measures.py +1589 -1589
  117. multipers/ml/sliced_wasserstein.py +461 -461
  118. multipers/ml/tools.py +113 -113
  119. multipers/mma_structures.cp310-win_amd64.pyd +0 -0
  120. multipers/mma_structures.pxd +127 -127
  121. multipers/mma_structures.pyx +4 -8
  122. multipers/mma_structures.pyx.tp +1083 -1085
  123. multipers/multi_parameter_rank_invariant/diff_helpers.h +84 -93
  124. multipers/multi_parameter_rank_invariant/euler_characteristic.h +97 -97
  125. multipers/multi_parameter_rank_invariant/function_rips.h +322 -322
  126. multipers/multi_parameter_rank_invariant/hilbert_function.h +769 -769
  127. multipers/multi_parameter_rank_invariant/persistence_slices.h +148 -148
  128. multipers/multi_parameter_rank_invariant/rank_invariant.h +369 -369
  129. multipers/multiparameter_edge_collapse.py +41 -41
  130. multipers/multiparameter_module_approximation/approximation.h +2298 -2295
  131. multipers/multiparameter_module_approximation/combinatory.h +129 -129
  132. multipers/multiparameter_module_approximation/debug.h +107 -107
  133. multipers/multiparameter_module_approximation/format_python-cpp.h +286 -286
  134. multipers/multiparameter_module_approximation/heap_column.h +238 -238
  135. multipers/multiparameter_module_approximation/images.h +79 -79
  136. multipers/multiparameter_module_approximation/list_column.h +174 -174
  137. multipers/multiparameter_module_approximation/list_column_2.h +232 -232
  138. multipers/multiparameter_module_approximation/ru_matrix.h +347 -347
  139. multipers/multiparameter_module_approximation/set_column.h +135 -135
  140. multipers/multiparameter_module_approximation/structure_higher_dim_barcode.h +36 -36
  141. multipers/multiparameter_module_approximation/unordered_set_column.h +166 -166
  142. multipers/multiparameter_module_approximation/utilities.h +403 -419
  143. multipers/multiparameter_module_approximation/vector_column.h +223 -223
  144. multipers/multiparameter_module_approximation/vector_matrix.h +331 -331
  145. multipers/multiparameter_module_approximation/vineyards.h +464 -464
  146. multipers/multiparameter_module_approximation/vineyards_trajectories.h +649 -649
  147. multipers/multiparameter_module_approximation.cp310-win_amd64.pyd +0 -0
  148. multipers/multiparameter_module_approximation.pyx +218 -217
  149. multipers/pickle.py +90 -53
  150. multipers/plots.py +342 -334
  151. multipers/point_measure.cp310-win_amd64.pyd +0 -0
  152. multipers/point_measure.pyx +322 -320
  153. multipers/simplex_tree_multi.cp310-win_amd64.pyd +0 -0
  154. multipers/simplex_tree_multi.pxd +133 -133
  155. multipers/simplex_tree_multi.pyx +115 -48
  156. multipers/simplex_tree_multi.pyx.tp +1947 -1935
  157. multipers/slicer.cp310-win_amd64.pyd +0 -0
  158. multipers/slicer.pxd +301 -120
  159. multipers/slicer.pxd.tp +218 -214
  160. multipers/slicer.pyx +1570 -507
  161. multipers/slicer.pyx.tp +931 -914
  162. multipers/tensor/tensor.h +672 -672
  163. multipers/tensor.pxd +13 -13
  164. multipers/test.pyx +44 -44
  165. multipers/tests/__init__.py +57 -57
  166. multipers/torch/diff_grids.py +217 -217
  167. multipers/torch/rips_density.py +310 -304
  168. {multipers-2.2.3.dist-info → multipers-2.3.1.dist-info}/LICENSE +21 -21
  169. {multipers-2.2.3.dist-info → multipers-2.3.1.dist-info}/METADATA +21 -11
  170. multipers-2.3.1.dist-info/RECORD +182 -0
  171. {multipers-2.2.3.dist-info → multipers-2.3.1.dist-info}/WHEEL +1 -1
  172. multipers/tests/test_diff_helper.py +0 -73
  173. multipers/tests/test_hilbert_function.py +0 -82
  174. multipers/tests/test_mma.py +0 -83
  175. multipers/tests/test_point_clouds.py +0 -49
  176. multipers/tests/test_python-cpp_conversion.py +0 -82
  177. multipers/tests/test_signed_betti.py +0 -181
  178. multipers/tests/test_signed_measure.py +0 -89
  179. multipers/tests/test_simplextreemulti.py +0 -221
  180. multipers/tests/test_slicer.py +0 -221
  181. multipers-2.2.3.dist-info/RECORD +0 -189
  182. {multipers-2.2.3.dist-info → multipers-2.3.1.dist-info}/top_level.txt +0 -0
@@ -1,419 +1,403 @@
1
- /* This file is part of the MMA Library -
2
- * https://gitlab.inria.fr/dloiseau/multipers - which is released under MIT. See
3
- * file LICENSE for full license details. Author(s): Hannah Schreiber
4
- *
5
- * Copyright (C) 2022 Inria
6
- *
7
- * Modification(s):
8
- * - YYYY/MM Author: Description of the modification
9
- */
10
-
11
- #ifndef UTILITIES_H
12
- #define UTILITIES_H
13
-
14
- #include <cassert>
15
- #include <gudhi/Simplex_tree_multi.h>
16
- #include <gudhi/One_critical_filtration.h>
17
- #include <gudhi/Multi_persistence/Box.h>
18
- #include <limits>
19
- #include <vector>
20
-
21
- namespace Gudhi::multiparameter::mma {
22
-
23
- constexpr const bool verbose = false;
24
-
25
- using index = unsigned int;
26
- using value_type = double;
27
- using filtration_type = Gudhi::multi_filtration::
28
- One_critical_filtration<value_type>;
29
- using multifiltration_type = std::vector<filtration_type>;
30
- using python_filtration_type = std::vector<value_type>;
31
- using python_multifiltration_type = std::vector<python_filtration_type>;
32
-
33
- using dimension_type = int;
34
- using persistence_pair = std::pair<value_type, value_type>;
35
- using boundary_type = std::vector<index>;
36
- using boundary_matrix = std::vector<boundary_type>;
37
- using permutation_type = std::vector<std::size_t>;
38
- using point_type = Gudhi::multi_filtration::
39
- One_critical_filtration<value_type>;
40
- using corner_type = Gudhi::multi_filtration::
41
- One_critical_filtration<value_type>;
42
- using corners_type =
43
- std::pair<std::vector<corner_type>, std::vector<corner_type>>;
44
- // using python_bar =
45
- // std::pair<std::vector<value_type>,
46
- // std::vector<value_type>>; // This type is for python
47
- using multipers_barcode = std::vector<std::vector<value_type>>;
48
- const value_type inf = std::numeric_limits<value_type>::infinity();
49
- const value_type negInf = -1 * inf;
50
- using interval_type = std::pair<point_type, point_type>;
51
-
52
- // template<typename T>
53
- // bool is_smaller(const std::vector<T>& x, const std::vector<T>& y)
54
- // {
55
- // for (unsigned int i = 0; i < std::min(x.size(), y.size()); i++)
56
- // if (x[i] > y[i]) return false;
57
- // return true;
58
- // }
59
- // template<typename T>
60
- // bool is_greater(const std::vector<T>& x, const std::vector<T>& y)
61
- // {
62
- // for (unsigned int i = 0; i < std::min(x.size(), y.size()); i++)
63
- // if (x[i] < y[i]) return false;
64
- // return true;
65
- // }
66
-
67
- struct Bar {
68
- Bar() : dim(-1), birth(-1), death(-1) {}
69
-
70
- Bar(dimension_type dim, int birth, int death)
71
- : dim(dim), birth(birth), death(death) {}
72
-
73
- dimension_type dim;
74
- int birth;
75
- int death;
76
- };
77
-
78
- using barcode_type = std::vector<Bar>;
79
-
80
- struct Diagram_point {
81
- Diagram_point() : dim(-1), birth(-1), death(-1) {}
82
-
83
- Diagram_point(dimension_type dim, value_type birth, value_type death)
84
- : dim(dim), birth(birth), death(death) {}
85
-
86
- dimension_type dim;
87
- value_type birth;
88
- value_type death;
89
- };
90
- using diagram_type = std::vector<Diagram_point>;
91
-
92
- template <typename filtration_type = filtration_type>
93
- struct MultiDiagram_point {
94
- public:
95
- MultiDiagram_point() : dim(-1), birth({}), death({}) {}
96
-
97
- MultiDiagram_point(dimension_type dim, filtration_type birth,
98
- filtration_type death)
99
- : dim(dim), birth(birth), death(death) {}
100
- dimension_type get_dimension() const { return dim; }
101
- const filtration_type& get_birth() const { return birth; }
102
- const filtration_type& get_death() const { return death; }
103
-
104
- private:
105
- dimension_type dim;
106
- filtration_type birth;
107
- filtration_type death;
108
- };
109
- template <typename filtration_type, typename value_type>
110
- struct MultiDiagram { // for python interface
111
- static_assert(std::is_same<typename filtration_type::value_type, value_type>::value,
112
- "filtration_type and value_type must be the same");
113
- public:
114
- using iterator =
115
- typename std::vector<MultiDiagram_point<filtration_type>>::const_iterator;
116
- MultiDiagram() {}
117
- MultiDiagram(std::vector<MultiDiagram_point<filtration_type>> &m)
118
- : multiDiagram(m) {}
119
-
120
- using python_bar =
121
- std::pair<std::vector<typename filtration_type::value_type>,
122
- std::vector<typename filtration_type::value_type>>; // This type is for python
123
- std::vector<python_bar> get_points(
124
- const dimension_type dimension = -1) const { // dump for python interface
125
- std::vector<python_bar> out;
126
- out.reserve(multiDiagram.size());
127
- for (const MultiDiagram_point<filtration_type> &pt : multiDiagram) {
128
- if (dimension == -1 || pt.get_dimension() == dimension) {
129
- if (pt.get_birth().size() > 0 && pt.get_death().size() > 0 &&
130
- !pt.get_birth().is_plus_inf() && !pt.get_death().is_minus_inf())
131
- out.push_back({pt.get_birth(), pt.get_death()});
132
- }
133
- }
134
- /* out.shrink_to_fit(); */
135
- return out;
136
- }
137
- std::vector<std::vector<double>> to_multipers(
138
- const dimension_type dimension = -1) const { // dump for python interface
139
- std::vector<std::vector<double>> out;
140
- out.reserve(multiDiagram.size());
141
- for (const MultiDiagram_point<filtration_type> &pt : multiDiagram) {
142
- if (dimension == -1 || pt.get_dimension() == dimension) {
143
- const auto &b = pt.get_birth().template as_type<double>();
144
- const auto &d = pt.get_death().template as_type<double>();
145
- assert(!(b.is_plus_inf() || b.is_minus_inf() || d.is_plus_inf() ||
146
- d.is_minus_inf()));
147
- out.push_back({b[0], d[0], b[1], d[1]});
148
- }
149
- }
150
- out.shrink_to_fit();
151
- return out;
152
- }
153
- iterator begin() const { return this->multiDiagram.begin(); }
154
- iterator end() const { return this->multiDiagram.end(); }
155
- unsigned int size() { return this->multiDiagram.size(); }
156
- void set(std::vector<MultiDiagram_point<filtration_type>> &m) {
157
- this->multiDiagram.swap(m);
158
- }
159
- std::vector<MultiDiagram_point<filtration_type>> &getref() {
160
- return this->multiDiagram;
161
- }
162
- MultiDiagram_point<filtration_type> &operator[](unsigned int i) {
163
- return this->multiDiagram[i];
164
- }
165
- MultiDiagram_point<filtration_type> &at(const unsigned int i) {
166
- return multiDiagram[i];
167
- }
168
-
169
- private:
170
- std::vector<MultiDiagram_point<filtration_type>> multiDiagram;
171
- };
172
- template <typename filtration_type, typename value_type > struct MultiDiagrams {
173
- static_assert(std::is_same<typename filtration_type::value_type, value_type>::value,
174
- "filtration_type and value_type must be the same");
175
- public:
176
- using iterator =
177
- typename std::vector<MultiDiagram<filtration_type, value_type>>::const_iterator;
178
- using nciterator =
179
- typename std::vector<MultiDiagram<filtration_type, value_type>>::iterator;
180
- MultiDiagrams() {}
181
- MultiDiagrams(unsigned int size) : multiDiagrams(size) {}
182
-
183
- std::vector<std::vector<std::vector<double>>> to_multipers() {
184
- unsigned int nsummands = this->multiDiagrams.front().size();
185
- unsigned int nlines = this->multiDiagrams.size();
186
- // std::vector<std::vector<std::vector<double>>> out(nsummands,
187
- // std::vector<std::vector<double>>(nlines, std::vector<double>(5)));
188
- std::vector<std::vector<std::vector<double>>> out(nsummands);
189
- for (unsigned int i = 0; i < nsummands; i++) {
190
- out[i].reserve(nlines);
191
- for (unsigned int j = 0; j < nlines; j++) {
192
- const MultiDiagram_point<filtration_type> &pt =
193
- this->multiDiagrams[j][i];
194
- /* if(pt.get_birth().is_plus_inf() || pt.get_death().is_minus_inf()) */
195
- /* out[i].push_back({0, 0, 0, 0,static_cast<value_type>(j)}); */
196
- /* else */
197
- double a, b, c, d;
198
- double inf = std::numeric_limits<double>::infinity();
199
- if (pt.get_birth().is_plus_inf()) {
200
- a = 0;
201
- b = 0;
202
- } else if (pt.get_birth().is_minus_inf()) {
203
- a = -inf;
204
- b = -inf;
205
- } else {
206
- a = pt.get_birth()[0];
207
- b = pt.get_birth()[1];
208
- }
209
- if (pt.get_death().is_plus_inf()) {
210
- c = inf;
211
- d = inf;
212
- }
213
- if (pt.get_death().is_minus_inf()) {
214
- c = 0;
215
- d = 0;
216
- } else {
217
- c = pt.get_death()[0];
218
- d = pt.get_death()[1];
219
- }
220
- /* out[i].push_back({pt.get_birth()[0], pt.get_death()[0],
221
- * pt.get_birth()[1], pt.get_death()[1],static_cast<value_type>(j)}); */
222
- out[i].push_back({a, c, b, d, static_cast<double>(j)});
223
- }
224
- }
225
- return out;
226
- }
227
- using __for_python_plot_type =
228
- std::pair<std::vector<std::pair<double, double>>,
229
- std::vector<unsigned int>>;
230
- __for_python_plot_type _for_python_plot(dimension_type dimension = -1,
231
- value_type min_persistence = 0) {
232
- __for_python_plot_type out;
233
- auto &bars = out.first;
234
- auto &summand_idx = out.second;
235
- bars.reserve(this->multiDiagrams.size() * this->multiDiagrams[0].size() *
236
- 2);
237
- summand_idx.reserve(this->multiDiagrams.size() *
238
- this->multiDiagrams[0].size());
239
- for (const MultiDiagram<filtration_type, value_type> &multiDiagram :
240
- this->multiDiagrams) {
241
- unsigned int count = 0;
242
- for (const MultiDiagram_point<filtration_type> &bar : multiDiagram) {
243
- const auto &birth = bar.get_birth().template as_type<double>();
244
- const auto &death = bar.get_death().template as_type<double>();
245
- if ((dimension == -1 || bar.get_dimension() == dimension) &&
246
- birth.size() > 1 && death.size() > 1 &&
247
- (death[0] > birth[0] + min_persistence)) {
248
- // Checking >1 ensure that filtration is not inf or -inf or nan.
249
- bars.push_back({birth[0], death[0]});
250
- bars.push_back({birth[1], death[1]});
251
- summand_idx.push_back(count);
252
- }
253
- count++;
254
- }
255
- }
256
- return out;
257
- }
258
- MultiDiagram<filtration_type, value_type> &operator[](const unsigned int i) {
259
- return multiDiagrams[i];
260
- }
261
- MultiDiagram<filtration_type, value_type> &at(const unsigned int i) {
262
- return multiDiagrams[i];
263
- }
264
- iterator begin() const {
265
- return this->multiDiagrams.begin();
266
- } // cython bug : iterators like bc in bcs crash)
267
- iterator end() const { return this->multiDiagrams.end(); }
268
-
269
- using python_bar =
270
- std::pair<std::vector<value_type>,
271
- std::vector<value_type>>; // This type is for python
272
- using barcodes = std::vector<std::vector<python_bar>>;
273
- barcodes get_points() {
274
- unsigned int nsummands = this->multiDiagrams.front().size();
275
- unsigned int nlines = this->multiDiagrams.size();
276
- // std::vector<std::vector<std::vector<double>>> out(nsummands,
277
- // std::vector<std::vector<double>>(nlines, std::vector<double>(5)));
278
- barcodes out(nlines, std::vector<python_bar>(nsummands));
279
- for (unsigned int i = 0; i < nlines; i++) {
280
- for (unsigned int j = 0; j < nsummands; j++) {
281
- const MultiDiagram_point<filtration_type> &pt =
282
- this->multiDiagrams[i][j];
283
- out[i][j] = {pt.get_birth(), pt.get_death()};
284
- }
285
- }
286
- return out;
287
- }
288
-
289
- unsigned int size() const { return this->multiDiagrams.size(); }
290
-
291
- private:
292
- std::vector<MultiDiagram<filtration_type, value_type>> multiDiagrams;
293
- /* inline bool _is_inf(const std::vector<value_type> &truc) const{ */
294
- /* for (const auto coord : truc) */
295
- /* if (coord != inf) return false; */
296
- /* return true; */
297
- /* } */
298
- /* inline bool _is_negInf(const std::vector<value_type> &truc) const{ */
299
- /* for (const auto coord : truc) */
300
- /* if (coord != negInf) return false; */
301
- /* return true; */
302
- /* } */
303
- };
304
-
305
- void inline threshold_up(point_type &point,
306
- const Gudhi::multi_persistence::Box<value_type> &box,
307
- const point_type &basepoint) {
308
- Gudhi::multi_filtration::One_critical_filtration
309
- point_(point);
310
- // if (is_smaller(point, box.get_upper_corner())) return;
311
- if (point_ <= box.get_upper_corner())
312
- return;
313
-
314
- // if (verbose && Debug::debug) Debug::disp_vect(point);
315
-
316
- if (basepoint[0] == negInf) [[unlikely]]
317
- return;
318
-
319
- // ie. point at infinity, assumes [basepoint,0] is smaller than box.second
320
- if (point.back() == inf) [[unlikely]] {
321
- // if (verbose) std::cout << " Infinite point" << std::endl;
322
-
323
- value_type threshold = box.get_upper_corner().back();
324
- for (unsigned int i = 0; i < point.size(); i++) {
325
- threshold = std::min(threshold, box.get_upper_corner()[i] - basepoint[i]);
326
- }
327
- for (unsigned int i = 0; i < point.size() - 1; i++)
328
- point[i] = basepoint[i] + threshold;
329
- point.back() = threshold;
330
-
331
- return;
332
- }
333
-
334
- // if (!is_greater(point, box.get_lower_corner())) {
335
- if (box.get_lower_corner() <= point_) {
336
- point[0] = inf; // puts point to infinity
337
- // if (verbose) std::cout << "buggy point" << std::endl;
338
- return;
339
- }
340
- // in this last case, at least 1 coord of point is is_greater than a coord of
341
- // box.second
342
-
343
- value_type threshold = point[0] - box.get_upper_corner()[0];
344
- for (std::size_t i = 1; i < point.size(); i++) {
345
- threshold = std::max(threshold, point[i] - box.get_upper_corner()[i]);
346
- }
347
-
348
- // if (verbose)
349
- // std::cout << "Thresholding the point with "<< threshold << " at
350
- // ";
351
-
352
- for (std::size_t i = 0; i < point.size(); i++)
353
- point[i] -= threshold;
354
-
355
- // if (verbose && Debug::debug) Debug::disp_vect(point);
356
- }
357
-
358
- /**
359
- * @brief Threshold a point to the positive cone of b=box.first
360
- * (ie. the set \f$\{x \in \mathbb R^n \mid x \ge b\})
361
- * along the slope 1 line crossing this point.
362
- *
363
- * @param point The point to threshold.
364
- * @param box box.fist is the point defining where to threshold.
365
- * @param basepoint Basepoint of the slope 1 line crossing the point.
366
- * Meant to handle infinite cases (when the point have infinite coordinates,
367
- * we cannot infer the line).
368
- */
369
-
370
- void inline threshold_down(point_type &point,
371
- const Gudhi::multi_persistence::Box<value_type> &box,
372
- const point_type &basepoint) {
373
- if (basepoint[0] == negInf) [[unlikely]]
374
- return;
375
-
376
- if (point.back() == inf)
377
- [[unlikely]] { // ie. point at infinity -> feature never appearing
378
- return;
379
- }
380
-
381
- // if (is_greater(point, box.get_lower_corner())) return;
382
- if (point >= box.get_lower_corner())
383
- return;
384
-
385
- // if (!is_smaller(point, box.get_upper_corner())) {
386
- if (!(point <= box.get_upper_corner())) {
387
- point[0] = inf; // puts point to infinity
388
- return;
389
- }
390
-
391
- value_type threshold = box.get_lower_corner()[0] - point[0];
392
- for (unsigned int i = 1; i < point.size(); i++) {
393
- threshold = std::max(threshold, box.get_lower_corner()[i] - point[i]);
394
- }
395
- for (unsigned int i = 0; i < point.size(); i++)
396
- point[i] += threshold;
397
- }
398
-
399
- } // namespace Gudhi::multiparameter::mma
400
-
401
- //// Different implementations of the matrix columns. Set seems to be the
402
- /// fastest / in our tests. / using Vineyard_matrix_type =
403
- /// RU_matrix<Heap_column>; / using Vineyard_matrix_type =
404
- /// RU_matrix<List_column>; / using Vineyard_matrix_type =
405
- /// RU_matrix<Vector_column>; / using Vineyard_matrix_type =
406
- /// RU_matrix<Unordered_set_column>;
407
- // #include "ru_matrix.h"
408
- ///*#include "heap_column.h"*/
409
- ///*#include "list_column.h"*/
410
- //// #include "list_column_2.h"
411
- ///*#include "vector_column.h"*/
412
- // #include "set_column.h"
413
- ///*#include "unordered_set_column.h"*/
414
- //
415
- // namespace Gudhi::multiparameter::mma {
416
- // using Vineyard_matrix_type = RU_matrix<Set_column>;
417
- //}
418
-
419
- #endif // UTILITIES_H
1
+ /* This file is part of the MMA Library -
2
+ * https://gitlab.inria.fr/dloiseau/multipers - which is released under MIT. See
3
+ * file LICENSE for full license details. Author(s): Hannah Schreiber
4
+ *
5
+ * Copyright (C) 2022 Inria
6
+ *
7
+ * Modification(s):
8
+ * - YYYY/MM Author: Description of the modification
9
+ */
10
+
11
+ #ifndef UTILITIES_H
12
+ #define UTILITIES_H
13
+
14
+ #include <cassert>
15
+ #include <gudhi/Simplex_tree_multi.h>
16
+ #include <gudhi/One_critical_filtration.h>
17
+ #include <gudhi/Multi_persistence/Box.h>
18
+ #include <limits>
19
+ #include <vector>
20
+
21
+ namespace Gudhi::multiparameter::mma {
22
+
23
+ constexpr const bool verbose = false;
24
+
25
+ using index = unsigned int;
26
+ using value_type = double;
27
+ using filtration_type = Gudhi::multi_filtration::One_critical_filtration<value_type>;
28
+ using multifiltration_type = std::vector<filtration_type>;
29
+ using python_filtration_type = std::vector<value_type>;
30
+ using python_multifiltration_type = std::vector<python_filtration_type>;
31
+
32
+ using dimension_type = int;
33
+ using persistence_pair = std::pair<value_type, value_type>;
34
+ using boundary_type = std::vector<index>;
35
+ using boundary_matrix = std::vector<boundary_type>;
36
+ using permutation_type = std::vector<std::size_t>;
37
+ using point_type = Gudhi::multi_filtration::One_critical_filtration<value_type>;
38
+ using corner_type = Gudhi::multi_filtration::One_critical_filtration<value_type>;
39
+ using corners_type = std::pair<std::vector<corner_type>, std::vector<corner_type>>;
40
+ // using python_bar =
41
+ // std::pair<std::vector<value_type>,
42
+ // std::vector<value_type>>; // This type is for python
43
+ using multipers_barcode = std::vector<std::vector<value_type>>;
44
+ const value_type inf = std::numeric_limits<value_type>::infinity();
45
+ const value_type negInf = -1 * inf;
46
+ using interval_type = std::pair<point_type, point_type>;
47
+
48
+ // template<typename T>
49
+ // bool is_smaller(const std::vector<T>& x, const std::vector<T>& y)
50
+ // {
51
+ // for (unsigned int i = 0; i < std::min(x.size(), y.size()); i++)
52
+ // if (x[i] > y[i]) return false;
53
+ // return true;
54
+ // }
55
+ // template<typename T>
56
+ // bool is_greater(const std::vector<T>& x, const std::vector<T>& y)
57
+ // {
58
+ // for (unsigned int i = 0; i < std::min(x.size(), y.size()); i++)
59
+ // if (x[i] < y[i]) return false;
60
+ // return true;
61
+ // }
62
+
63
+ struct Bar {
64
+ Bar() : dim(-1), birth(-1), death(-1) {}
65
+
66
+ Bar(dimension_type dim, int birth, int death) : dim(dim), birth(birth), death(death) {}
67
+
68
+ dimension_type dim;
69
+ int birth;
70
+ int death;
71
+ };
72
+
73
+ using barcode_type = std::vector<Bar>;
74
+
75
+ struct Diagram_point {
76
+ Diagram_point() : dim(-1), birth(-1), death(-1) {}
77
+
78
+ Diagram_point(dimension_type dim, value_type birth, value_type death) : dim(dim), birth(birth), death(death) {}
79
+
80
+ dimension_type dim;
81
+ value_type birth;
82
+ value_type death;
83
+ };
84
+
85
+ using diagram_type = std::vector<Diagram_point>;
86
+
87
+ template <typename filtration_type = filtration_type>
88
+ struct MultiDiagram_point {
89
+ public:
90
+ MultiDiagram_point() : dim(-1), birth({}), death({}) {}
91
+
92
+ MultiDiagram_point(dimension_type dim, filtration_type birth, filtration_type death)
93
+ : dim(dim), birth(birth), death(death) {}
94
+
95
+ dimension_type get_dimension() const { return dim; }
96
+
97
+ const filtration_type &get_birth() const { return birth; }
98
+
99
+ const filtration_type &get_death() const { return death; }
100
+
101
+ private:
102
+ dimension_type dim;
103
+ filtration_type birth;
104
+ filtration_type death;
105
+ };
106
+
107
+ template <typename filtration_type, typename value_type>
108
+ struct MultiDiagram { // for python interface
109
+ static_assert(std::is_same_v<typename filtration_type::value_type, value_type>,
110
+ "filtration_type and value_type must be the same");
111
+
112
+ public:
113
+ using iterator = typename std::vector<MultiDiagram_point<filtration_type>>::const_iterator;
114
+
115
+ MultiDiagram() {}
116
+
117
+ MultiDiagram(std::vector<MultiDiagram_point<filtration_type>> &m) : multiDiagram(m) {}
118
+
119
+ using python_bar = std::pair<std::vector<typename filtration_type::value_type>,
120
+ std::vector<typename filtration_type::value_type>>; // This type is for python
121
+
122
+ std::vector<python_bar> get_points(const dimension_type dimension = -1) const { // dump for python interface
123
+ std::vector<python_bar> out;
124
+ out.reserve(multiDiagram.size());
125
+ for (const MultiDiagram_point<filtration_type> &pt : multiDiagram) {
126
+ if (dimension == -1 || pt.get_dimension() == dimension) {
127
+ if (pt.get_birth().size() > 0 && pt.get_death().size() > 0 && !pt.get_birth().is_plus_inf() &&
128
+ !pt.get_death().is_minus_inf())
129
+ out.push_back({pt.get_birth(), pt.get_death()});
130
+ }
131
+ }
132
+ /* out.shrink_to_fit(); */
133
+ return out;
134
+ }
135
+
136
+ std::vector<std::vector<double>> to_multipers(
137
+ const dimension_type dimension = -1) const { // dump for python interface
138
+ std::vector<std::vector<double>> out;
139
+ out.reserve(multiDiagram.size());
140
+ for (const MultiDiagram_point<filtration_type> &pt : multiDiagram) {
141
+ if (dimension == -1 || pt.get_dimension() == dimension) {
142
+ const auto &b = pt.get_birth().template as_type<double>();
143
+ const auto &d = pt.get_death().template as_type<double>();
144
+ assert(!(b.is_plus_inf() || b.is_minus_inf() || d.is_plus_inf() || d.is_minus_inf()));
145
+ out.push_back({b[0], d[0], b[1], d[1]});
146
+ }
147
+ }
148
+ out.shrink_to_fit();
149
+ return out;
150
+ }
151
+
152
+ iterator begin() const { return this->multiDiagram.begin(); }
153
+
154
+ iterator end() const { return this->multiDiagram.end(); }
155
+
156
+ unsigned int size() { return this->multiDiagram.size(); }
157
+
158
+ void set(std::vector<MultiDiagram_point<filtration_type>> &m) { this->multiDiagram.swap(m); }
159
+
160
+ std::vector<MultiDiagram_point<filtration_type>> &getref() { return this->multiDiagram; }
161
+
162
+ MultiDiagram_point<filtration_type> &operator[](unsigned int i) { return this->multiDiagram[i]; }
163
+
164
+ MultiDiagram_point<filtration_type> &at(const unsigned int i) { return multiDiagram[i]; }
165
+
166
+ private:
167
+ std::vector<MultiDiagram_point<filtration_type>> multiDiagram;
168
+ };
169
+
170
+ template <typename filtration_type, typename value_type>
171
+ struct MultiDiagrams {
172
+ static_assert(std::is_same_v<typename filtration_type::value_type, value_type>,
173
+ "filtration_type and value_type must be the same");
174
+
175
+ public:
176
+ using iterator = typename std::vector<MultiDiagram<filtration_type, value_type>>::const_iterator;
177
+ using nciterator = typename std::vector<MultiDiagram<filtration_type, value_type>>::iterator;
178
+
179
+ MultiDiagrams() {}
180
+
181
+ MultiDiagrams(unsigned int size) : multiDiagrams(size) {}
182
+
183
+ std::vector<std::vector<std::vector<double>>> to_multipers() {
184
+ unsigned int nsummands = this->multiDiagrams.front().size();
185
+ unsigned int nlines = this->multiDiagrams.size();
186
+ // std::vector<std::vector<std::vector<double>>> out(nsummands,
187
+ // std::vector<std::vector<double>>(nlines, std::vector<double>(5)));
188
+ std::vector<std::vector<std::vector<double>>> out(nsummands);
189
+ for (unsigned int i = 0; i < nsummands; i++) {
190
+ out[i].reserve(nlines);
191
+ for (unsigned int j = 0; j < nlines; j++) {
192
+ const MultiDiagram_point<filtration_type> &pt = this->multiDiagrams[j][i];
193
+ /* if(pt.get_birth().is_plus_inf() || pt.get_death().is_minus_inf()) */
194
+ /* out[i].push_back({0, 0, 0, 0,static_cast<value_type>(j)}); */
195
+ /* else */
196
+ double a, b, c, d;
197
+ double inf = std::numeric_limits<double>::infinity();
198
+ if (pt.get_birth().is_plus_inf()) {
199
+ a = 0;
200
+ b = 0;
201
+ } else if (pt.get_birth().is_minus_inf()) {
202
+ a = -inf;
203
+ b = -inf;
204
+ } else {
205
+ a = pt.get_birth()[0];
206
+ b = pt.get_birth()[1];
207
+ }
208
+ if (pt.get_death().is_plus_inf()) {
209
+ c = inf;
210
+ d = inf;
211
+ }
212
+ if (pt.get_death().is_minus_inf()) {
213
+ c = 0;
214
+ d = 0;
215
+ } else {
216
+ c = pt.get_death()[0];
217
+ d = pt.get_death()[1];
218
+ }
219
+ /* out[i].push_back({pt.get_birth()[0], pt.get_death()[0],
220
+ * pt.get_birth()[1], pt.get_death()[1],static_cast<value_type>(j)}); */
221
+ out[i].push_back({a, c, b, d, static_cast<double>(j)});
222
+ }
223
+ }
224
+ return out;
225
+ }
226
+
227
+ using __for_python_plot_type = std::pair<std::vector<std::pair<double, double>>, std::vector<unsigned int>>;
228
+
229
+ __for_python_plot_type _for_python_plot(dimension_type dimension = -1, value_type min_persistence = 0) {
230
+ __for_python_plot_type out;
231
+ auto &bars = out.first;
232
+ auto &summand_idx = out.second;
233
+ bars.reserve(this->multiDiagrams.size() * this->multiDiagrams[0].size() * 2);
234
+ summand_idx.reserve(this->multiDiagrams.size() * this->multiDiagrams[0].size());
235
+ for (const MultiDiagram<filtration_type, value_type> &multiDiagram : this->multiDiagrams) {
236
+ unsigned int count = 0;
237
+ for (const MultiDiagram_point<filtration_type> &bar : multiDiagram) {
238
+ const auto &birth = bar.get_birth().template as_type<double>();
239
+ const auto &death = bar.get_death().template as_type<double>();
240
+ if ((dimension == -1 || bar.get_dimension() == dimension) && birth.size() > 1 && death.size() > 1 &&
241
+ (death[0] > birth[0] + min_persistence)) {
242
+ // Checking >1 ensure that filtration is not inf or -inf or nan.
243
+ bars.push_back({birth[0], death[0]});
244
+ bars.push_back({birth[1], death[1]});
245
+ summand_idx.push_back(count);
246
+ }
247
+ count++;
248
+ }
249
+ }
250
+ return out;
251
+ }
252
+
253
+ MultiDiagram<filtration_type, value_type> &operator[](const unsigned int i) { return multiDiagrams[i]; }
254
+
255
+ MultiDiagram<filtration_type, value_type> &at(const unsigned int i) { return multiDiagrams[i]; }
256
+
257
+ iterator begin() const { return this->multiDiagrams.begin(); } // cython bug : iterators like bc in bcs crash)
258
+
259
+ iterator end() const { return this->multiDiagrams.end(); }
260
+
261
+ using python_bar = std::pair<std::vector<value_type>,
262
+ std::vector<value_type>>; // This type is for python
263
+ using barcodes = std::vector<std::vector<python_bar>>;
264
+
265
+ barcodes get_points() {
266
+ unsigned int nsummands = this->multiDiagrams.front().size();
267
+ unsigned int nlines = this->multiDiagrams.size();
268
+ // std::vector<std::vector<std::vector<double>>> out(nsummands,
269
+ // std::vector<std::vector<double>>(nlines, std::vector<double>(5)));
270
+ barcodes out(nlines, std::vector<python_bar>(nsummands));
271
+ for (unsigned int i = 0; i < nlines; i++) {
272
+ for (unsigned int j = 0; j < nsummands; j++) {
273
+ const MultiDiagram_point<filtration_type> &pt = this->multiDiagrams[i][j];
274
+ out[i][j] = {pt.get_birth(), pt.get_death()};
275
+ }
276
+ }
277
+ return out;
278
+ }
279
+
280
+ unsigned int size() const { return this->multiDiagrams.size(); }
281
+
282
+ private:
283
+ std::vector<MultiDiagram<filtration_type, value_type>> multiDiagrams;
284
+ /* inline bool _is_inf(const std::vector<value_type> &truc) const{ */
285
+ /* for (const auto coord : truc) */
286
+ /* if (coord != inf) return false; */
287
+ /* return true; */
288
+ /* } */
289
+ /* inline bool _is_negInf(const std::vector<value_type> &truc) const{ */
290
+ /* for (const auto coord : truc) */
291
+ /* if (coord != negInf) return false; */
292
+ /* return true; */
293
+ /* } */
294
+ };
295
+
296
+ void inline threshold_up(point_type &point,
297
+ const Gudhi::multi_persistence::Box<value_type> &box,
298
+ const point_type &basepoint) {
299
+ Gudhi::multi_filtration::One_critical_filtration point_(point);
300
+ // if (is_smaller(point, box.get_upper_corner())) return;
301
+ if (point_ <= box.get_upper_corner()) return;
302
+
303
+ // if (verbose && Debug::debug) Debug::disp_vect(point);
304
+
305
+ if (basepoint[0] == negInf) [[unlikely]]
306
+ return;
307
+
308
+ // ie. point at infinity, assumes [basepoint,0] is smaller than box.second
309
+ if (point.back() == inf) [[unlikely]] {
310
+ // if (verbose) std::cout << " Infinite point" << std::endl;
311
+
312
+ value_type threshold = box.get_upper_corner().back();
313
+ for (unsigned int i = 0; i < point.size(); i++) {
314
+ threshold = std::min(threshold, box.get_upper_corner()[i] - basepoint[i]);
315
+ }
316
+ for (unsigned int i = 0; i < point.size() - 1; i++) point[i] = basepoint[i] + threshold;
317
+ point.back() = threshold;
318
+
319
+ return;
320
+ }
321
+
322
+ // if (!is_greater(point, box.get_lower_corner())) {
323
+ if (box.get_lower_corner() <= point_) {
324
+ point[0] = inf; // puts point to infinity
325
+ // if (verbose) std::cout << "buggy point" << std::endl;
326
+ return;
327
+ }
328
+ // in this last case, at least 1 coord of point is is_greater than a coord of
329
+ // box.second
330
+
331
+ value_type threshold = point[0] - box.get_upper_corner()[0];
332
+ for (std::size_t i = 1; i < point.size(); i++) {
333
+ threshold = std::max(threshold, point[i] - box.get_upper_corner()[i]);
334
+ }
335
+
336
+ // if (verbose)
337
+ // std::cout << "Thresholding the point with "<< threshold << " at
338
+ // ";
339
+
340
+ for (std::size_t i = 0; i < point.size(); i++) point[i] -= threshold;
341
+
342
+ // if (verbose && Debug::debug) Debug::disp_vect(point);
343
+ }
344
+
345
+ /**
346
+ * @brief Threshold a point to the positive cone of b=box.first
347
+ * (ie. the set \f$\{x \in \mathbb R^n \mid x \ge b\})
348
+ * along the slope 1 line crossing this point.
349
+ *
350
+ * @param point The point to threshold.
351
+ * @param box box.fist is the point defining where to threshold.
352
+ * @param basepoint Basepoint of the slope 1 line crossing the point.
353
+ * Meant to handle infinite cases (when the point have infinite coordinates,
354
+ * we cannot infer the line).
355
+ */
356
+
357
+ void inline threshold_down(point_type &point,
358
+ const Gudhi::multi_persistence::Box<value_type> &box,
359
+ const point_type &basepoint) {
360
+ if (basepoint[0] == negInf) [[unlikely]]
361
+ return;
362
+
363
+ if (point.back() == inf) [[unlikely]] { // ie. point at infinity -> feature never appearing
364
+ return;
365
+ }
366
+
367
+ // if (is_greater(point, box.get_lower_corner())) return;
368
+ if (point >= box.get_lower_corner()) return;
369
+
370
+ // if (!is_smaller(point, box.get_upper_corner())) {
371
+ if (!(point <= box.get_upper_corner())) {
372
+ point[0] = inf; // puts point to infinity
373
+ return;
374
+ }
375
+
376
+ value_type threshold = box.get_lower_corner()[0] - point[0];
377
+ for (unsigned int i = 1; i < point.size(); i++) {
378
+ threshold = std::max(threshold, box.get_lower_corner()[i] - point[i]);
379
+ }
380
+ for (unsigned int i = 0; i < point.size(); i++) point[i] += threshold;
381
+ }
382
+
383
+ } // namespace Gudhi::multiparameter::mma
384
+
385
+ //// Different implementations of the matrix columns. Set seems to be the
386
+ /// fastest / in our tests. / using Vineyard_matrix_type =
387
+ /// RU_matrix<Heap_column>; / using Vineyard_matrix_type =
388
+ /// RU_matrix<List_column>; / using Vineyard_matrix_type =
389
+ /// RU_matrix<Vector_column>; / using Vineyard_matrix_type =
390
+ /// RU_matrix<Unordered_set_column>;
391
+ // #include "ru_matrix.h"
392
+ ///*#include "heap_column.h"*/
393
+ ///*#include "list_column.h"*/
394
+ //// #include "list_column_2.h"
395
+ ///*#include "vector_column.h"*/
396
+ // #include "set_column.h"
397
+ ///*#include "unordered_set_column.h"*/
398
+ //
399
+ // namespace Gudhi::multiparameter::mma {
400
+ // using Vineyard_matrix_type = RU_matrix<Set_column>;
401
+ //}
402
+
403
+ #endif // UTILITIES_H