multipers 2.2.3__cp312-cp312-win_amd64.whl → 2.3.1__cp312-cp312-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.cp312-win_amd64.pyd +0 -0
  18. multipers/function_rips.pyx +105 -105
  19. multipers/grids.cp312-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.cp312-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.cp312-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.cp312-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.cp312-win_amd64.pyd +0 -0
  152. multipers/point_measure.pyx +322 -320
  153. multipers/simplex_tree_multi.cp312-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.cp312-win_amd64.pyd +0 -0
  158. multipers/slicer.pxd +281 -100
  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,579 +1,579 @@
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): Pawel Dlotko
4
- *
5
- * Copyright (C) 2015 Inria
6
- *
7
- * Modification(s):
8
- * - YYYY/MM Author: Description of the modification
9
- */
10
-
11
- #ifndef BITMAP_CUBICAL_COMPLEX_PERIODIC_BOUNDARY_CONDITIONS_BASE_H_
12
- #define BITMAP_CUBICAL_COMPLEX_PERIODIC_BOUNDARY_CONDITIONS_BASE_H_
13
-
14
- #include <gudhi/Bitmap_cubical_complex_base.h>
15
- #include <gudhi/Debug_utils.h>
16
-
17
- #include <cmath>
18
- #include <limits> // for numeric_limits<>
19
- #include <vector>
20
- #include <stdexcept>
21
- #include <cstddef>
22
-
23
- namespace Gudhi {
24
-
25
- namespace cubical_complex {
26
-
27
- // in this class, we are storing all the elements which are in normal bitmap (i.e. the bitmap without the periodic
28
- // boundary conditions). But, we set up the iterators and the procedures to compute boundary and coboundary in the way
29
- // that it is all right. We assume here that all the cells that are on the left / bottom and so on remains, while all
30
- // the cells on the right / top are not in the Bitmap_cubical_complex_periodic_boundary_conditions_base
31
-
32
- /**
33
- * @brief Cubical complex with periodic boundary conditions represented as a bitmap.
34
- * @ingroup cubical_complex
35
- * @details This is a class implementing a bitmap data structure with periodic boundary conditions. Most of the
36
- * functions are
37
- * identical to the functions from Bitmap_cubical_complex_base.
38
- * The ones that needed to be updated are the constructors and get_boundary_of_a_cell and get_coboundary_of_a_cell.
39
- */
40
- template <typename T>
41
- class Bitmap_cubical_complex_periodic_boundary_conditions_base : public Bitmap_cubical_complex_base<T> {
42
- public:
43
- // constructors that take an extra parameter:
44
-
45
- /**
46
- * Default constructor of Bitmap_cubical_complex_periodic_boundary_conditions_base class.
47
- */
48
- Bitmap_cubical_complex_periodic_boundary_conditions_base() {}
49
- /**
50
- * A constructor of Bitmap_cubical_complex_periodic_boundary_conditions_base class that takes the following
51
- * parameters: (1) vector with numbers of top dimensional cells in all dimensions and (2) vector of booleans. If
52
- * at i-th position of this vector there is true value, that means that periodic boundary conditions are to be
53
- * imposed in this direction. In case of false, the periodic boundary conditions will not be imposed in the direction
54
- * i.
55
- */
56
- Bitmap_cubical_complex_periodic_boundary_conditions_base(
57
- const std::vector<unsigned>& sizes,
58
- const std::vector<bool>& directions_in_which_periodic_b_cond_are_to_be_imposed);
59
- /**
60
- * A constructor of Bitmap_cubical_complex_periodic_boundary_conditions_base class that takes the name of Perseus
61
- * style file as an input. Please consult the documentation about the specification of the file.
62
- */
63
- explicit Bitmap_cubical_complex_periodic_boundary_conditions_base(const char* perseusStyleFile);
64
- /**
65
- * A constructor of Bitmap_cubical_complex_periodic_boundary_conditions_base class that takes the following
66
- * parameters: (1) vector with numbers of top dimensional cells in all dimensions and (2) vector of top dimensional
67
- * cells (ordered lexicographically) and (3) vector of booleans. If at i-th position of this vector there is true
68
- * value, that means that periodic boundary conditions are to be imposed in this direction. In case of false, the
69
- * periodic boundary conditions will not be imposed in the direction i.
70
- */
71
- Bitmap_cubical_complex_periodic_boundary_conditions_base(
72
- const std::vector<unsigned>& dimensions, const std::vector<T>& cells,
73
- const std::vector<bool>& directions_in_which_periodic_b_cond_are_to_be_imposed,
74
- bool input_top_cells);
75
-
76
- /**
77
- * Destructor of the Bitmap_cubical_complex_periodic_boundary_conditions_base class.
78
- **/
79
- virtual ~Bitmap_cubical_complex_periodic_boundary_conditions_base() {}
80
-
81
- // overwritten methods co compute boundary and coboundary
82
- /**
83
- * A version of a function that return boundary of a given cell for an object of
84
- * Bitmap_cubical_complex_periodic_boundary_conditions_base class.
85
- * The boundary elements are guaranteed to be returned so that the
86
- * incidence coefficients are alternating.
87
- */
88
- virtual std::vector<std::size_t> get_boundary_of_a_cell(std::size_t cell) const override;
89
-
90
- /**
91
- * A version of a function that return coboundary of a given cell for an object of
92
- * Bitmap_cubical_complex_periodic_boundary_conditions_base class.
93
- * Note that unlike in the case of boundary, over here the elements are
94
- * not guaranteed to be returned with alternating incidence numbers.
95
- * To compute incidence between cells use compute_incidence_between_cells
96
- * procedure
97
- */
98
- virtual std::vector<std::size_t> get_coboundary_of_a_cell(std::size_t cell) const override;
99
-
100
- /**
101
- * This procedure compute incidence numbers between cubes. For a cube \f$A\f$ of
102
- * dimension n and a cube \f$B \subset A\f$ of dimension n-1, an incidence
103
- * between \f$A\f$ and \f$B\f$ is the integer with which \f$B\f$ appears in the boundary of \f$A\f$.
104
- * Note that first parameter is a cube of dimension n,
105
- * and the second parameter is an adjusted cube in dimension n-1.
106
- * Given \f$A = [b_1,e_1] \times \ldots \ [b_{j-1},e_{j-1}] \times [b_{j},e_{j}] \times [b_{j+1},e_{j+1}] \times \ldots
107
- *\times [b_{n},e_{n}] \f$
108
- * such that \f$ b_{j} \neq e_{j} \f$
109
- * and \f$B = [b_1,e_1] \times \ldots \ [b_{j-1},e_{j-1}] \times [a,a] \times [b_{j+1},e_{j+1}] \times \ldots \times
110
- *[b_{n},e_{n}]s \f$
111
- * where \f$ a = b_{j}\f$ or \f$ a = e_{j}\f$, the incidence between \f$A\f$ and \f$B\f$
112
- * computed by this procedure is given by formula:
113
- * \f$ c\ (-1)^{\sum_{i=1}^{j-1} dim [b_{i},e_{i}]} \f$
114
- * Where \f$ dim [b_{i},e_{i}] = 0 \f$ if \f$ b_{i}=e_{i} \f$ and 1 in other case.
115
- * c is -1 if \f$ a = b_{j}\f$ and 1 if \f$ a = e_{j}\f$.
116
- * @exception std::logic_error In case when the cube \f$B\f$ is not n-1
117
- * dimensional face of a cube \f$A\f$.
118
- **/
119
- virtual int compute_incidence_between_cells(std::size_t coface, std::size_t face) const override {
120
- // first get the counters for coface and face:
121
- std::vector<unsigned> coface_counter = this->compute_counter_for_given_cell(coface);
122
- std::vector<unsigned> face_counter = this->compute_counter_for_given_cell(face);
123
-
124
- // coface_counter and face_counter should agree at all positions except from one:
125
- int number_of_position_in_which_counters_do_not_agree = -1;
126
- std::size_t number_of_full_faces_that_comes_before = 0;
127
- for (std::size_t i = 0; i != coface_counter.size(); ++i) {
128
- if ((coface_counter[i] % 2 == 1) && (number_of_position_in_which_counters_do_not_agree == -1)) {
129
- ++number_of_full_faces_that_comes_before;
130
- }
131
- if (coface_counter[i] != face_counter[i]) {
132
- if (number_of_position_in_which_counters_do_not_agree != -1) {
133
- std::cerr << "Cells given to compute_incidence_between_cells procedure do not form a pair of coface-face.\n";
134
- throw std::logic_error(
135
- "Cells given to compute_incidence_between_cells procedure do not form a pair of coface-face.");
136
- }
137
- number_of_position_in_which_counters_do_not_agree = i;
138
- }
139
- }
140
-
141
- int incidence = 1;
142
- if (number_of_full_faces_that_comes_before % 2) incidence = -1;
143
- // if the face cell is on the right from coface cell:
144
- if ((coface_counter[number_of_position_in_which_counters_do_not_agree] + 1 ==
145
- face_counter[number_of_position_in_which_counters_do_not_agree]) ||
146
- ((coface_counter[number_of_position_in_which_counters_do_not_agree] != 1) &&
147
- (face_counter[number_of_position_in_which_counters_do_not_agree] == 0))) {
148
- incidence *= -1;
149
- }
150
-
151
- return incidence;
152
- }
153
-
154
- // The non-periodic code works for top dimensional cells, but not vertices.
155
- class Vertices_iterator {
156
- public:
157
- typedef std::input_iterator_tag iterator_category;
158
- typedef std::size_t value_type;
159
- typedef std::ptrdiff_t difference_type;
160
- typedef value_type* pointer;
161
- typedef value_type reference;
162
-
163
- Vertices_iterator(Bitmap_cubical_complex_periodic_boundary_conditions_base* b) : counter(b->dimension()), b(b) {}
164
-
165
- Vertices_iterator operator++() {
166
- // first find first element of the counter that can be increased:
167
- std::size_t dim = 0;
168
- while ((dim != this->b->dimension()) && (this->counter[dim] == this->b->sizes[dim] - this->b->directions_in_which_periodic_b_cond_are_to_be_imposed[dim])) ++dim;
169
-
170
- if (dim != this->b->dimension()) {
171
- ++this->counter[dim];
172
- for (std::size_t i = 0; i != dim; ++i) {
173
- this->counter[i] = 0;
174
- }
175
- } else {
176
- ++this->counter[0];
177
- }
178
- return *this;
179
- }
180
-
181
- Vertices_iterator operator++(int) {
182
- Vertices_iterator result = *this;
183
- ++(*this);
184
- return result;
185
- }
186
-
187
- bool operator==(const Vertices_iterator& rhs) const {
188
- if (this->b != rhs.b) return false;
189
- GUDHI_CHECK(this->counter.size() == rhs.counter.size(), "impossible");
190
- for (std::size_t i = 0; i != this->counter.size(); ++i) {
191
- if (this->counter[i] != rhs.counter[i]) return false;
192
- }
193
- return true;
194
- }
195
-
196
- bool operator!=(const Vertices_iterator& rhs) const { return !(*this == rhs); }
197
-
198
- /*
199
- * The operator * returns position of a cube in the structure of cubical complex. This position can be then used as
200
- * an argument of the following functions:
201
- * get_boundary_of_a_cell, get_coboundary_of_a_cell, get_dimension_of_a_cell to get information about the cell
202
- * boundary and coboundary and dimension
203
- * and in function get_cell_data to get a filtration of a cell.
204
- */
205
- std::size_t operator*() const { return this->compute_index_in_bitmap(); }
206
-
207
- std::size_t compute_index_in_bitmap() const {
208
- std::size_t index = 0;
209
- for (std::size_t i = 0; i != this->counter.size(); ++i) {
210
- index += 2 * this->counter[i] * this->b->multipliers[i];
211
- }
212
- return index;
213
- }
214
-
215
- void print_counter() const {
216
- for (std::size_t i = 0; i != this->counter.size(); ++i) {
217
- std::clog << this->counter[i] << " ";
218
- }
219
- }
220
- friend class Bitmap_cubical_complex_periodic_boundary_conditions_base;
221
-
222
- protected:
223
- std::vector<std::size_t> counter;
224
- Bitmap_cubical_complex_periodic_boundary_conditions_base* b;
225
- };
226
-
227
- /*
228
- * Function returning a Vertices_iterator to the first vertex of the bitmap.
229
- */
230
- Vertices_iterator vertices_iterator_begin() {
231
- Vertices_iterator a(this);
232
- return a;
233
- }
234
-
235
- /*
236
- * Function returning a Vertices_iterator to the last vertex of the bitmap.
237
- */
238
- Vertices_iterator vertices_iterator_end() {
239
- Vertices_iterator a(this);
240
- for (std::size_t i = 0; i != this->dimension(); ++i) {
241
- a.counter[i] = this->sizes[i] - this->directions_in_which_periodic_b_cond_are_to_be_imposed[i];
242
- }
243
- a.counter[0]++;
244
- return a;
245
- }
246
-
247
- /*
248
- * @brief Vertices_iterator_range class provides ranges for Vertices_iterator_range
249
- */
250
- class Vertices_range {
251
- public:
252
- Vertices_range(Bitmap_cubical_complex_periodic_boundary_conditions_base* b) : b(b) {}
253
-
254
- Vertices_iterator begin() { return b->vertices_iterator_begin(); }
255
-
256
- Vertices_iterator end() { return b->vertices_iterator_end(); }
257
-
258
- private:
259
- Bitmap_cubical_complex_periodic_boundary_conditions_base* b;
260
- };
261
-
262
- /* Returns a range over all vertices. */
263
- Vertices_range vertices_range() { return Vertices_range(this); }
264
-
265
- /**
266
- * Set cells filtrations given those of the vertices, and based on lower star filtration.
267
- * This is already called by the relevant constructors.
268
- **/
269
- void impose_lower_star_filtration_from_vertices();
270
-
271
- protected:
272
- std::vector<bool> directions_in_which_periodic_b_cond_are_to_be_imposed;
273
-
274
- void set_up_containers(const std::vector<unsigned>& sizes, bool is_pos_inf) {
275
- // The fact that multipliers[0]=1 is relied on by optimizations in other functions
276
- unsigned multiplier = 1;
277
- for (std::size_t i = 0; i != sizes.size(); ++i) {
278
- this->sizes.push_back(sizes[i]);
279
- this->multipliers.push_back(multiplier);
280
-
281
- if (directions_in_which_periodic_b_cond_are_to_be_imposed[i]) {
282
- multiplier *= 2 * sizes[i];
283
- } else {
284
- multiplier *= 2 * sizes[i] + 1;
285
- }
286
- }
287
- // std::reverse( this->sizes.begin() , this->sizes.end() );
288
- if (is_pos_inf)
289
- this->data = std::vector<T>(multiplier, std::numeric_limits<T>::infinity());
290
- else
291
- this->data = std::vector<T>(multiplier, -std::numeric_limits<T>::infinity());
292
- }
293
- Bitmap_cubical_complex_periodic_boundary_conditions_base(const std::vector<unsigned>& sizes);
294
- Bitmap_cubical_complex_periodic_boundary_conditions_base(const std::vector<unsigned>& dimensions,
295
- const std::vector<T>& cells,
296
- bool input_top_cells);
297
-
298
- /**
299
- * Procedures used to construct the data structures in the class.
300
- **/
301
- void construct_complex_based_on_top_dimensional_cells(
302
- const std::vector<unsigned>& dimensions, const std::vector<T>& topDimensionalCells,
303
- const std::vector<bool>& directions_in_which_periodic_b_cond_are_to_be_imposed);
304
- void construct_complex_based_on_vertices(const std::vector<unsigned>& dimensions, const std::vector<T>& vertices,
305
- const std::vector<bool>& directions_in_which_periodic_b_cond_are_to_be_imposed);
306
- };
307
-
308
- template <typename T>
309
- void Bitmap_cubical_complex_periodic_boundary_conditions_base<T>::construct_complex_based_on_top_dimensional_cells(
310
- const std::vector<unsigned>& dimensions, const std::vector<T>& topDimensionalCells,
311
- const std::vector<bool>& directions_in_which_periodic_b_cond_are_to_be_imposed) {
312
- this->directions_in_which_periodic_b_cond_are_to_be_imposed = directions_in_which_periodic_b_cond_are_to_be_imposed;
313
- this->set_up_containers(dimensions, true);
314
-
315
- std::size_t i = 0;
316
- for (auto it = this->top_dimensional_cells_iterator_begin(); it != this->top_dimensional_cells_iterator_end(); ++it) {
317
- this->get_cell_data(*it) = topDimensionalCells[i];
318
- ++i;
319
- }
320
- this->impose_lower_star_filtration();
321
- }
322
-
323
- template <typename T>
324
- void Bitmap_cubical_complex_periodic_boundary_conditions_base<T>::construct_complex_based_on_vertices(
325
- const std::vector<unsigned>& dimensions, const std::vector<T>& vertices,
326
- const std::vector<bool>& directions_in_which_periodic_b_cond_are_to_be_imposed) {
327
- this->directions_in_which_periodic_b_cond_are_to_be_imposed = directions_in_which_periodic_b_cond_are_to_be_imposed;
328
-
329
- std::vector<unsigned> top_cells_sizes;
330
- std::transform (dimensions.begin(), dimensions.end(), directions_in_which_periodic_b_cond_are_to_be_imposed.begin(),
331
- std::back_inserter(top_cells_sizes), [](unsigned i, bool b){ return i - !b;});
332
- this->set_up_containers(top_cells_sizes, false);
333
-
334
- std::size_t i = 0;
335
- for (auto it = this->vertices_iterator_begin(); it != this->vertices_iterator_end(); ++it) {
336
- this->get_cell_data(*it) = vertices[i];
337
- ++i;
338
- }
339
- this->impose_lower_star_filtration_from_vertices();
340
- }
341
-
342
- template <typename T>
343
- Bitmap_cubical_complex_periodic_boundary_conditions_base<T>::Bitmap_cubical_complex_periodic_boundary_conditions_base(
344
- const std::vector<unsigned>& sizes,
345
- const std::vector<bool>& directions_in_which_periodic_b_cond_are_to_be_imposed)
346
- : directions_in_which_periodic_b_cond_are_to_be_imposed(directions_in_which_periodic_b_cond_are_to_be_imposed) {
347
- this->set_up_containers(sizes, true);
348
- }
349
-
350
- template <typename T>
351
- Bitmap_cubical_complex_periodic_boundary_conditions_base<T>::Bitmap_cubical_complex_periodic_boundary_conditions_base(
352
- const char* perseus_style_file) {
353
- // for Perseus style files:
354
-
355
- std::ifstream inFiltration(perseus_style_file);
356
- if(!inFiltration) throw std::ios_base::failure(std::string("Could not open the file ") + perseus_style_file);
357
- unsigned dimensionOfData;
358
- inFiltration >> dimensionOfData;
359
-
360
- this->directions_in_which_periodic_b_cond_are_to_be_imposed = std::vector<bool>(dimensionOfData, false);
361
-
362
- std::vector<unsigned> sizes;
363
- sizes.reserve(dimensionOfData);
364
- for (std::size_t i = 0; i != dimensionOfData; ++i) {
365
- int size_in_this_dimension;
366
- inFiltration >> size_in_this_dimension;
367
- if (size_in_this_dimension < 0) {
368
- this->directions_in_which_periodic_b_cond_are_to_be_imposed[i] = true;
369
- }
370
- sizes.push_back(abs(size_in_this_dimension));
371
- }
372
- this->set_up_containers(sizes, true);
373
-
374
- typename Bitmap_cubical_complex_periodic_boundary_conditions_base<T>::Top_dimensional_cells_iterator
375
- it = this->top_dimensional_cells_iterator_begin();
376
-
377
- while (!inFiltration.eof()) {
378
- double filtrationLevel;
379
- inFiltration >> filtrationLevel;
380
- if (inFiltration.eof()) break;
381
-
382
- #ifdef DEBUG_TRACES
383
- std::clog << "Cell of an index : " << it.compute_index_in_bitmap()
384
- << " and dimension: " << this->get_dimension_of_a_cell(it.compute_index_in_bitmap())
385
- << " get the value : " << filtrationLevel << std::endl;
386
- #endif
387
- this->get_cell_data(*it) = filtrationLevel;
388
- ++it;
389
- }
390
- inFiltration.close();
391
- this->impose_lower_star_filtration();
392
- }
393
-
394
- template <typename T>
395
- Bitmap_cubical_complex_periodic_boundary_conditions_base<T>::Bitmap_cubical_complex_periodic_boundary_conditions_base(
396
- const std::vector<unsigned>& sizes) {
397
- this->directions_in_which_periodic_b_cond_are_to_be_imposed = std::vector<bool>(sizes.size(), false);
398
- this->set_up_containers(sizes, true);
399
- }
400
-
401
- template <typename T>
402
- Bitmap_cubical_complex_periodic_boundary_conditions_base<T>::Bitmap_cubical_complex_periodic_boundary_conditions_base(
403
- const std::vector<unsigned>& dimensions, const std::vector<T>& cells, bool input_top_cells) {
404
- std::vector<bool> directions_in_which_periodic_b_cond_are_to_be_imposed = std::vector<bool>(dimensions.size(), false);
405
- if (input_top_cells) {
406
- this->construct_complex_based_on_top_dimensional_cells(dimensions, cells,
407
- directions_in_which_periodic_b_cond_are_to_be_imposed);
408
- } else {
409
- this->construct_complex_based_on_vertices(dimensions, cells,
410
- directions_in_which_periodic_b_cond_are_to_be_imposed);
411
- }
412
- }
413
-
414
- template <typename T>
415
- Bitmap_cubical_complex_periodic_boundary_conditions_base<T>::Bitmap_cubical_complex_periodic_boundary_conditions_base(
416
- const std::vector<unsigned>& dimensions, const std::vector<T>& cells,
417
- const std::vector<bool>& directions_in_which_periodic_b_cond_are_to_be_imposed,
418
- bool input_top_cells) {
419
- if(input_top_cells) {
420
- this->construct_complex_based_on_top_dimensional_cells(dimensions, cells,
421
- directions_in_which_periodic_b_cond_are_to_be_imposed);
422
- } else {
423
- this->construct_complex_based_on_vertices(dimensions, cells,
424
- directions_in_which_periodic_b_cond_are_to_be_imposed);
425
- }
426
- }
427
-
428
- // ***********************Methods************************ //
429
-
430
- template <typename T>
431
- std::vector<std::size_t> Bitmap_cubical_complex_periodic_boundary_conditions_base<T>::get_boundary_of_a_cell(
432
- std::size_t cell) const {
433
- #ifdef DEBUG_TRACES
434
- std::clog << "Computations of boundary of a cell : " << cell << std::endl;
435
- #endif
436
-
437
- std::vector<std::size_t> boundary_elements;
438
- boundary_elements.reserve(this->dimension() * 2);
439
- std::size_t cell1 = cell;
440
- std::size_t sum_of_dimensions = 0;
441
-
442
- for (std::size_t i = this->multipliers.size(); i != 0; --i) {
443
- unsigned position = cell1 / this->multipliers[i - 1];
444
- cell1 = cell1 % this->multipliers[i - 1];
445
- // this cell have a nonzero length in this direction, therefore we can compute its boundary in this direction.
446
- if (position % 2 == 1) {
447
- // if there are no periodic boundary conditions in this direction, we do not have to do anything.
448
- if (!directions_in_which_periodic_b_cond_are_to_be_imposed[i - 1]) {
449
- if (sum_of_dimensions % 2) {
450
- boundary_elements.push_back(cell - this->multipliers[i - 1]);
451
- boundary_elements.push_back(cell + this->multipliers[i - 1]);
452
- } else {
453
- boundary_elements.push_back(cell + this->multipliers[i - 1]);
454
- boundary_elements.push_back(cell - this->multipliers[i - 1]);
455
- }
456
- #ifdef DEBUG_TRACES
457
- std::clog << cell - this->multipliers[i - 1] << " " << cell + this->multipliers[i - 1] << " ";
458
- #endif
459
- } else {
460
- // in this direction we have to do boundary conditions. Therefore, we need to check if we are not at the end.
461
- if (position != 2 * this->sizes[i - 1] - 1) {
462
- if (sum_of_dimensions % 2) {
463
- boundary_elements.push_back(cell - this->multipliers[i - 1]);
464
- boundary_elements.push_back(cell + this->multipliers[i - 1]);
465
- } else {
466
- boundary_elements.push_back(cell + this->multipliers[i - 1]);
467
- boundary_elements.push_back(cell - this->multipliers[i - 1]);
468
- }
469
- #ifdef DEBUG_TRACES
470
- std::clog << cell - this->multipliers[i - 1] << " " << cell + this->multipliers[i - 1] << " ";
471
- #endif
472
- } else {
473
- if (sum_of_dimensions % 2) {
474
- boundary_elements.push_back(cell - this->multipliers[i - 1]);
475
- boundary_elements.push_back(cell - (2 * this->sizes[i - 1] - 1) * this->multipliers[i - 1]);
476
- } else {
477
- boundary_elements.push_back(cell - (2 * this->sizes[i - 1] - 1) * this->multipliers[i - 1]);
478
- boundary_elements.push_back(cell - this->multipliers[i - 1]);
479
- }
480
- #ifdef DEBUG_TRACES
481
- std::clog << cell - this->multipliers[i - 1] << " "
482
- << cell - (2 * this->sizes[i - 1] - 1) * this->multipliers[i - 1] << " ";
483
- #endif
484
- }
485
- }
486
- ++sum_of_dimensions;
487
- }
488
- }
489
- return boundary_elements;
490
- }
491
-
492
- template <typename T>
493
- std::vector<std::size_t> Bitmap_cubical_complex_periodic_boundary_conditions_base<T>::get_coboundary_of_a_cell(
494
- std::size_t cell) const {
495
- std::vector<unsigned> counter = this->compute_counter_for_given_cell(cell);
496
- std::vector<std::size_t> coboundary_elements;
497
- std::size_t cell1 = cell;
498
- for (std::size_t i = this->multipliers.size(); i != 0; --i) {
499
- unsigned position = cell1 / this->multipliers[i - 1];
500
- cell1 = cell1 % this->multipliers[i - 1];
501
- // if the cell has zero length in this direction, then it will have cbd in this direction.
502
- if (position % 2 == 0) {
503
- if (!this->directions_in_which_periodic_b_cond_are_to_be_imposed[i - 1]) {
504
- // no periodic boundary conditions in this direction
505
- if ((counter[i - 1] != 0) && (cell > this->multipliers[i - 1])) {
506
- coboundary_elements.push_back(cell - this->multipliers[i - 1]);
507
- }
508
- if ((counter[i - 1] != 2 * this->sizes[i - 1]) && (cell + this->multipliers[i - 1] < this->data.size())) {
509
- coboundary_elements.push_back(cell + this->multipliers[i - 1]);
510
- }
511
- } else {
512
- // we want to have periodic boundary conditions in this direction
513
- if (counter[i - 1] != 0) {
514
- coboundary_elements.push_back(cell - this->multipliers[i - 1]);
515
- coboundary_elements.push_back(cell + this->multipliers[i - 1]);
516
- } else {
517
- // in this case counter[i-1] == 0.
518
- coboundary_elements.push_back(cell + this->multipliers[i - 1]);
519
- coboundary_elements.push_back(cell + (2 * this->sizes[i - 1] - 1) * this->multipliers[i - 1]);
520
- }
521
- }
522
- }
523
- }
524
- return coboundary_elements;
525
- }
526
-
527
- // Exact same code as the non-periodic version, duplicated for now to ensure it calls the right version of vertices_iterator_begin.
528
- template <typename T>
529
- void Bitmap_cubical_complex_periodic_boundary_conditions_base<T>::impose_lower_star_filtration_from_vertices() {
530
- // this vector will be used to check which elements have already been taken care of in imposing lower star filtration
531
- std::vector<bool> is_this_cell_considered(this->data.size(), false);
532
-
533
- std::vector<std::size_t> indices_to_consider;
534
- // we assume here that we already have a filtration on the vertices and
535
- // we have to extend it to higher ones.
536
- for (auto it = this->vertices_iterator_begin();
537
- it != this->vertices_iterator_end(); ++it) {
538
- indices_to_consider.push_back(it.compute_index_in_bitmap());
539
- }
540
-
541
- while (indices_to_consider.size()) { // Iteration on the dimension
542
- #ifdef DEBUG_TRACES
543
- std::clog << "indices_to_consider in this iteration \n";
544
- for (auto index : indices_to_consider) {
545
- std::clog << index << " ";
546
- }
547
- #endif
548
- std::vector<std::size_t> new_indices_to_consider;
549
- for (auto index : indices_to_consider) {
550
- std::vector<std::size_t> cbd = this->get_coboundary_of_a_cell(index);
551
- for (auto coboundary : cbd) {
552
- #ifdef DEBUG_TRACES
553
- std::clog << "filtration of a cell : " << coboundary << " is : " << this->data[coboundary]
554
- << " while of a cell: " << index << " is: " << this->data[index]
555
- << std::endl;
556
- #endif
557
- if (this->data[coboundary] < this->data[index]) {
558
- this->data[coboundary] = this->data[index];
559
- #ifdef DEBUG_TRACES
560
- std::clog << "Setting the value of a cell : " << coboundary
561
- << " to : " << this->data[index] << std::endl;
562
- #endif
563
- }
564
- if (is_this_cell_considered[coboundary] == false) {
565
- new_indices_to_consider.push_back(coboundary);
566
- is_this_cell_considered[coboundary] = true;
567
- }
568
- }
569
- }
570
- indices_to_consider.swap(new_indices_to_consider);
571
- }
572
- }
573
- } // namespace cubical_complex
574
-
575
- namespace Cubical_complex = cubical_complex;
576
-
577
- } // namespace Gudhi
578
-
579
- #endif // BITMAP_CUBICAL_COMPLEX_PERIODIC_BOUNDARY_CONDITIONS_BASE_H_
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): Pawel Dlotko
4
+ *
5
+ * Copyright (C) 2015 Inria
6
+ *
7
+ * Modification(s):
8
+ * - YYYY/MM Author: Description of the modification
9
+ */
10
+
11
+ #ifndef BITMAP_CUBICAL_COMPLEX_PERIODIC_BOUNDARY_CONDITIONS_BASE_H_
12
+ #define BITMAP_CUBICAL_COMPLEX_PERIODIC_BOUNDARY_CONDITIONS_BASE_H_
13
+
14
+ #include <gudhi/Bitmap_cubical_complex_base.h>
15
+ #include <gudhi/Debug_utils.h>
16
+
17
+ #include <cmath>
18
+ #include <limits> // for numeric_limits<>
19
+ #include <vector>
20
+ #include <stdexcept>
21
+ #include <cstddef>
22
+
23
+ namespace Gudhi {
24
+
25
+ namespace cubical_complex {
26
+
27
+ // in this class, we are storing all the elements which are in normal bitmap (i.e. the bitmap without the periodic
28
+ // boundary conditions). But, we set up the iterators and the procedures to compute boundary and coboundary in the way
29
+ // that it is all right. We assume here that all the cells that are on the left / bottom and so on remains, while all
30
+ // the cells on the right / top are not in the Bitmap_cubical_complex_periodic_boundary_conditions_base
31
+
32
+ /**
33
+ * @brief Cubical complex with periodic boundary conditions represented as a bitmap.
34
+ * @ingroup cubical_complex
35
+ * @details This is a class implementing a bitmap data structure with periodic boundary conditions. Most of the
36
+ * functions are
37
+ * identical to the functions from Bitmap_cubical_complex_base.
38
+ * The ones that needed to be updated are the constructors and get_boundary_of_a_cell and get_coboundary_of_a_cell.
39
+ */
40
+ template <typename T>
41
+ class Bitmap_cubical_complex_periodic_boundary_conditions_base : public Bitmap_cubical_complex_base<T> {
42
+ public:
43
+ // constructors that take an extra parameter:
44
+
45
+ /**
46
+ * Default constructor of Bitmap_cubical_complex_periodic_boundary_conditions_base class.
47
+ */
48
+ Bitmap_cubical_complex_periodic_boundary_conditions_base() {}
49
+ /**
50
+ * A constructor of Bitmap_cubical_complex_periodic_boundary_conditions_base class that takes the following
51
+ * parameters: (1) vector with numbers of top dimensional cells in all dimensions and (2) vector of booleans. If
52
+ * at i-th position of this vector there is true value, that means that periodic boundary conditions are to be
53
+ * imposed in this direction. In case of false, the periodic boundary conditions will not be imposed in the direction
54
+ * i.
55
+ */
56
+ Bitmap_cubical_complex_periodic_boundary_conditions_base(
57
+ const std::vector<unsigned>& sizes,
58
+ const std::vector<bool>& directions_in_which_periodic_b_cond_are_to_be_imposed);
59
+ /**
60
+ * A constructor of Bitmap_cubical_complex_periodic_boundary_conditions_base class that takes the name of Perseus
61
+ * style file as an input. Please consult the documentation about the specification of the file.
62
+ */
63
+ explicit Bitmap_cubical_complex_periodic_boundary_conditions_base(const char* perseusStyleFile);
64
+ /**
65
+ * A constructor of Bitmap_cubical_complex_periodic_boundary_conditions_base class that takes the following
66
+ * parameters: (1) vector with numbers of top dimensional cells in all dimensions and (2) vector of top dimensional
67
+ * cells (ordered lexicographically) and (3) vector of booleans. If at i-th position of this vector there is true
68
+ * value, that means that periodic boundary conditions are to be imposed in this direction. In case of false, the
69
+ * periodic boundary conditions will not be imposed in the direction i.
70
+ */
71
+ Bitmap_cubical_complex_periodic_boundary_conditions_base(
72
+ const std::vector<unsigned>& dimensions, const std::vector<T>& cells,
73
+ const std::vector<bool>& directions_in_which_periodic_b_cond_are_to_be_imposed,
74
+ bool input_top_cells);
75
+
76
+ /**
77
+ * Destructor of the Bitmap_cubical_complex_periodic_boundary_conditions_base class.
78
+ **/
79
+ virtual ~Bitmap_cubical_complex_periodic_boundary_conditions_base() {}
80
+
81
+ // overwritten methods co compute boundary and coboundary
82
+ /**
83
+ * A version of a function that return boundary of a given cell for an object of
84
+ * Bitmap_cubical_complex_periodic_boundary_conditions_base class.
85
+ * The boundary elements are guaranteed to be returned so that the
86
+ * incidence coefficients are alternating.
87
+ */
88
+ virtual std::vector<std::size_t> get_boundary_of_a_cell(std::size_t cell) const override;
89
+
90
+ /**
91
+ * A version of a function that return coboundary of a given cell for an object of
92
+ * Bitmap_cubical_complex_periodic_boundary_conditions_base class.
93
+ * Note that unlike in the case of boundary, over here the elements are
94
+ * not guaranteed to be returned with alternating incidence numbers.
95
+ * To compute incidence between cells use compute_incidence_between_cells
96
+ * procedure
97
+ */
98
+ virtual std::vector<std::size_t> get_coboundary_of_a_cell(std::size_t cell) const override;
99
+
100
+ /**
101
+ * This procedure compute incidence numbers between cubes. For a cube \f$A\f$ of
102
+ * dimension n and a cube \f$B \subset A\f$ of dimension n-1, an incidence
103
+ * between \f$A\f$ and \f$B\f$ is the integer with which \f$B\f$ appears in the boundary of \f$A\f$.
104
+ * Note that first parameter is a cube of dimension n,
105
+ * and the second parameter is an adjusted cube in dimension n-1.
106
+ * Given \f$A = [b_1,e_1] \times \ldots \ [b_{j-1},e_{j-1}] \times [b_{j},e_{j}] \times [b_{j+1},e_{j+1}] \times \ldots
107
+ *\times [b_{n},e_{n}] \f$
108
+ * such that \f$ b_{j} \neq e_{j} \f$
109
+ * and \f$B = [b_1,e_1] \times \ldots \ [b_{j-1},e_{j-1}] \times [a,a] \times [b_{j+1},e_{j+1}] \times \ldots \times
110
+ *[b_{n},e_{n}]s \f$
111
+ * where \f$ a = b_{j}\f$ or \f$ a = e_{j}\f$, the incidence between \f$A\f$ and \f$B\f$
112
+ * computed by this procedure is given by formula:
113
+ * \f$ c\ (-1)^{\sum_{i=1}^{j-1} dim [b_{i},e_{i}]} \f$
114
+ * Where \f$ dim [b_{i},e_{i}] = 0 \f$ if \f$ b_{i}=e_{i} \f$ and 1 in other case.
115
+ * c is -1 if \f$ a = b_{j}\f$ and 1 if \f$ a = e_{j}\f$.
116
+ * @exception std::logic_error In case when the cube \f$B\f$ is not n-1
117
+ * dimensional face of a cube \f$A\f$.
118
+ **/
119
+ virtual int compute_incidence_between_cells(std::size_t coface, std::size_t face) const override {
120
+ // first get the counters for coface and face:
121
+ std::vector<unsigned> coface_counter = this->compute_counter_for_given_cell(coface);
122
+ std::vector<unsigned> face_counter = this->compute_counter_for_given_cell(face);
123
+
124
+ // coface_counter and face_counter should agree at all positions except from one:
125
+ int number_of_position_in_which_counters_do_not_agree = -1;
126
+ std::size_t number_of_full_faces_that_comes_before = 0;
127
+ for (std::size_t i = 0; i != coface_counter.size(); ++i) {
128
+ if ((coface_counter[i] % 2 == 1) && (number_of_position_in_which_counters_do_not_agree == -1)) {
129
+ ++number_of_full_faces_that_comes_before;
130
+ }
131
+ if (coface_counter[i] != face_counter[i]) {
132
+ if (number_of_position_in_which_counters_do_not_agree != -1) {
133
+ std::cerr << "Cells given to compute_incidence_between_cells procedure do not form a pair of coface-face.\n";
134
+ throw std::logic_error(
135
+ "Cells given to compute_incidence_between_cells procedure do not form a pair of coface-face.");
136
+ }
137
+ number_of_position_in_which_counters_do_not_agree = i;
138
+ }
139
+ }
140
+
141
+ int incidence = 1;
142
+ if (number_of_full_faces_that_comes_before % 2) incidence = -1;
143
+ // if the face cell is on the right from coface cell:
144
+ if ((coface_counter[number_of_position_in_which_counters_do_not_agree] + 1 ==
145
+ face_counter[number_of_position_in_which_counters_do_not_agree]) ||
146
+ ((coface_counter[number_of_position_in_which_counters_do_not_agree] != 1) &&
147
+ (face_counter[number_of_position_in_which_counters_do_not_agree] == 0))) {
148
+ incidence *= -1;
149
+ }
150
+
151
+ return incidence;
152
+ }
153
+
154
+ // The non-periodic code works for top dimensional cells, but not vertices.
155
+ class Vertices_iterator {
156
+ public:
157
+ typedef std::input_iterator_tag iterator_category;
158
+ typedef std::size_t value_type;
159
+ typedef std::ptrdiff_t difference_type;
160
+ typedef value_type* pointer;
161
+ typedef value_type reference;
162
+
163
+ Vertices_iterator(Bitmap_cubical_complex_periodic_boundary_conditions_base* b) : counter(b->dimension()), b(b) {}
164
+
165
+ Vertices_iterator operator++() {
166
+ // first find first element of the counter that can be increased:
167
+ std::size_t dim = 0;
168
+ while ((dim != this->b->dimension()) && (this->counter[dim] == this->b->sizes[dim] - this->b->directions_in_which_periodic_b_cond_are_to_be_imposed[dim])) ++dim;
169
+
170
+ if (dim != this->b->dimension()) {
171
+ ++this->counter[dim];
172
+ for (std::size_t i = 0; i != dim; ++i) {
173
+ this->counter[i] = 0;
174
+ }
175
+ } else {
176
+ ++this->counter[0];
177
+ }
178
+ return *this;
179
+ }
180
+
181
+ Vertices_iterator operator++(int) {
182
+ Vertices_iterator result = *this;
183
+ ++(*this);
184
+ return result;
185
+ }
186
+
187
+ bool operator==(const Vertices_iterator& rhs) const {
188
+ if (this->b != rhs.b) return false;
189
+ GUDHI_CHECK(this->counter.size() == rhs.counter.size(), "impossible");
190
+ for (std::size_t i = 0; i != this->counter.size(); ++i) {
191
+ if (this->counter[i] != rhs.counter[i]) return false;
192
+ }
193
+ return true;
194
+ }
195
+
196
+ bool operator!=(const Vertices_iterator& rhs) const { return !(*this == rhs); }
197
+
198
+ /*
199
+ * The operator * returns position of a cube in the structure of cubical complex. This position can be then used as
200
+ * an argument of the following functions:
201
+ * get_boundary_of_a_cell, get_coboundary_of_a_cell, get_dimension_of_a_cell to get information about the cell
202
+ * boundary and coboundary and dimension
203
+ * and in function get_cell_data to get a filtration of a cell.
204
+ */
205
+ std::size_t operator*() const { return this->compute_index_in_bitmap(); }
206
+
207
+ std::size_t compute_index_in_bitmap() const {
208
+ std::size_t index = 0;
209
+ for (std::size_t i = 0; i != this->counter.size(); ++i) {
210
+ index += 2 * this->counter[i] * this->b->multipliers[i];
211
+ }
212
+ return index;
213
+ }
214
+
215
+ void print_counter() const {
216
+ for (std::size_t i = 0; i != this->counter.size(); ++i) {
217
+ std::clog << this->counter[i] << " ";
218
+ }
219
+ }
220
+ friend class Bitmap_cubical_complex_periodic_boundary_conditions_base;
221
+
222
+ protected:
223
+ std::vector<std::size_t> counter;
224
+ Bitmap_cubical_complex_periodic_boundary_conditions_base* b;
225
+ };
226
+
227
+ /*
228
+ * Function returning a Vertices_iterator to the first vertex of the bitmap.
229
+ */
230
+ Vertices_iterator vertices_iterator_begin() {
231
+ Vertices_iterator a(this);
232
+ return a;
233
+ }
234
+
235
+ /*
236
+ * Function returning a Vertices_iterator to the last vertex of the bitmap.
237
+ */
238
+ Vertices_iterator vertices_iterator_end() {
239
+ Vertices_iterator a(this);
240
+ for (std::size_t i = 0; i != this->dimension(); ++i) {
241
+ a.counter[i] = this->sizes[i] - this->directions_in_which_periodic_b_cond_are_to_be_imposed[i];
242
+ }
243
+ a.counter[0]++;
244
+ return a;
245
+ }
246
+
247
+ /*
248
+ * @brief Vertices_iterator_range class provides ranges for Vertices_iterator_range
249
+ */
250
+ class Vertices_range {
251
+ public:
252
+ Vertices_range(Bitmap_cubical_complex_periodic_boundary_conditions_base* b) : b(b) {}
253
+
254
+ Vertices_iterator begin() { return b->vertices_iterator_begin(); }
255
+
256
+ Vertices_iterator end() { return b->vertices_iterator_end(); }
257
+
258
+ private:
259
+ Bitmap_cubical_complex_periodic_boundary_conditions_base* b;
260
+ };
261
+
262
+ /* Returns a range over all vertices. */
263
+ Vertices_range vertices_range() { return Vertices_range(this); }
264
+
265
+ /**
266
+ * Set cells filtrations given those of the vertices, and based on lower star filtration.
267
+ * This is already called by the relevant constructors.
268
+ **/
269
+ void impose_lower_star_filtration_from_vertices();
270
+
271
+ protected:
272
+ std::vector<bool> directions_in_which_periodic_b_cond_are_to_be_imposed;
273
+
274
+ void set_up_containers(const std::vector<unsigned>& sizes, bool is_pos_inf) {
275
+ // The fact that multipliers[0]=1 is relied on by optimizations in other functions
276
+ unsigned multiplier = 1;
277
+ for (std::size_t i = 0; i != sizes.size(); ++i) {
278
+ this->sizes.push_back(sizes[i]);
279
+ this->multipliers.push_back(multiplier);
280
+
281
+ if (directions_in_which_periodic_b_cond_are_to_be_imposed[i]) {
282
+ multiplier *= 2 * sizes[i];
283
+ } else {
284
+ multiplier *= 2 * sizes[i] + 1;
285
+ }
286
+ }
287
+ // std::reverse( this->sizes.begin() , this->sizes.end() );
288
+ if (is_pos_inf)
289
+ this->data = std::vector<T>(multiplier, std::numeric_limits<T>::infinity());
290
+ else
291
+ this->data = std::vector<T>(multiplier, -std::numeric_limits<T>::infinity());
292
+ }
293
+ Bitmap_cubical_complex_periodic_boundary_conditions_base(const std::vector<unsigned>& sizes);
294
+ Bitmap_cubical_complex_periodic_boundary_conditions_base(const std::vector<unsigned>& dimensions,
295
+ const std::vector<T>& cells,
296
+ bool input_top_cells);
297
+
298
+ /**
299
+ * Procedures used to construct the data structures in the class.
300
+ **/
301
+ void construct_complex_based_on_top_dimensional_cells(
302
+ const std::vector<unsigned>& dimensions, const std::vector<T>& topDimensionalCells,
303
+ const std::vector<bool>& directions_in_which_periodic_b_cond_are_to_be_imposed);
304
+ void construct_complex_based_on_vertices(const std::vector<unsigned>& dimensions, const std::vector<T>& vertices,
305
+ const std::vector<bool>& directions_in_which_periodic_b_cond_are_to_be_imposed);
306
+ };
307
+
308
+ template <typename T>
309
+ void Bitmap_cubical_complex_periodic_boundary_conditions_base<T>::construct_complex_based_on_top_dimensional_cells(
310
+ const std::vector<unsigned>& dimensions, const std::vector<T>& topDimensionalCells,
311
+ const std::vector<bool>& directions_in_which_periodic_b_cond_are_to_be_imposed) {
312
+ this->directions_in_which_periodic_b_cond_are_to_be_imposed = directions_in_which_periodic_b_cond_are_to_be_imposed;
313
+ this->set_up_containers(dimensions, true);
314
+
315
+ std::size_t i = 0;
316
+ for (auto it = this->top_dimensional_cells_iterator_begin(); it != this->top_dimensional_cells_iterator_end(); ++it) {
317
+ this->get_cell_data(*it) = topDimensionalCells[i];
318
+ ++i;
319
+ }
320
+ this->impose_lower_star_filtration();
321
+ }
322
+
323
+ template <typename T>
324
+ void Bitmap_cubical_complex_periodic_boundary_conditions_base<T>::construct_complex_based_on_vertices(
325
+ const std::vector<unsigned>& dimensions, const std::vector<T>& vertices,
326
+ const std::vector<bool>& directions_in_which_periodic_b_cond_are_to_be_imposed) {
327
+ this->directions_in_which_periodic_b_cond_are_to_be_imposed = directions_in_which_periodic_b_cond_are_to_be_imposed;
328
+
329
+ std::vector<unsigned> top_cells_sizes;
330
+ std::transform (dimensions.begin(), dimensions.end(), directions_in_which_periodic_b_cond_are_to_be_imposed.begin(),
331
+ std::back_inserter(top_cells_sizes), [](unsigned i, bool b){ return i - !b;});
332
+ this->set_up_containers(top_cells_sizes, false);
333
+
334
+ std::size_t i = 0;
335
+ for (auto it = this->vertices_iterator_begin(); it != this->vertices_iterator_end(); ++it) {
336
+ this->get_cell_data(*it) = vertices[i];
337
+ ++i;
338
+ }
339
+ this->impose_lower_star_filtration_from_vertices();
340
+ }
341
+
342
+ template <typename T>
343
+ Bitmap_cubical_complex_periodic_boundary_conditions_base<T>::Bitmap_cubical_complex_periodic_boundary_conditions_base(
344
+ const std::vector<unsigned>& sizes,
345
+ const std::vector<bool>& directions_in_which_periodic_b_cond_are_to_be_imposed)
346
+ : directions_in_which_periodic_b_cond_are_to_be_imposed(directions_in_which_periodic_b_cond_are_to_be_imposed) {
347
+ this->set_up_containers(sizes, true);
348
+ }
349
+
350
+ template <typename T>
351
+ Bitmap_cubical_complex_periodic_boundary_conditions_base<T>::Bitmap_cubical_complex_periodic_boundary_conditions_base(
352
+ const char* perseus_style_file) {
353
+ // for Perseus style files:
354
+
355
+ std::ifstream inFiltration(perseus_style_file);
356
+ if(!inFiltration) throw std::ios_base::failure(std::string("Could not open the file ") + perseus_style_file);
357
+ unsigned dimensionOfData;
358
+ inFiltration >> dimensionOfData;
359
+
360
+ this->directions_in_which_periodic_b_cond_are_to_be_imposed = std::vector<bool>(dimensionOfData, false);
361
+
362
+ std::vector<unsigned> sizes;
363
+ sizes.reserve(dimensionOfData);
364
+ for (std::size_t i = 0; i != dimensionOfData; ++i) {
365
+ int size_in_this_dimension;
366
+ inFiltration >> size_in_this_dimension;
367
+ if (size_in_this_dimension < 0) {
368
+ this->directions_in_which_periodic_b_cond_are_to_be_imposed[i] = true;
369
+ }
370
+ sizes.push_back(abs(size_in_this_dimension));
371
+ }
372
+ this->set_up_containers(sizes, true);
373
+
374
+ typename Bitmap_cubical_complex_periodic_boundary_conditions_base<T>::Top_dimensional_cells_iterator
375
+ it = this->top_dimensional_cells_iterator_begin();
376
+
377
+ while (!inFiltration.eof()) {
378
+ double filtrationLevel;
379
+ inFiltration >> filtrationLevel;
380
+ if (inFiltration.eof()) break;
381
+
382
+ #ifdef DEBUG_TRACES
383
+ std::clog << "Cell of an index : " << it.compute_index_in_bitmap()
384
+ << " and dimension: " << this->get_dimension_of_a_cell(it.compute_index_in_bitmap())
385
+ << " get the value : " << filtrationLevel << std::endl;
386
+ #endif
387
+ this->get_cell_data(*it) = filtrationLevel;
388
+ ++it;
389
+ }
390
+ inFiltration.close();
391
+ this->impose_lower_star_filtration();
392
+ }
393
+
394
+ template <typename T>
395
+ Bitmap_cubical_complex_periodic_boundary_conditions_base<T>::Bitmap_cubical_complex_periodic_boundary_conditions_base(
396
+ const std::vector<unsigned>& sizes) {
397
+ this->directions_in_which_periodic_b_cond_are_to_be_imposed = std::vector<bool>(sizes.size(), false);
398
+ this->set_up_containers(sizes, true);
399
+ }
400
+
401
+ template <typename T>
402
+ Bitmap_cubical_complex_periodic_boundary_conditions_base<T>::Bitmap_cubical_complex_periodic_boundary_conditions_base(
403
+ const std::vector<unsigned>& dimensions, const std::vector<T>& cells, bool input_top_cells) {
404
+ std::vector<bool> directions_in_which_periodic_b_cond_are_to_be_imposed = std::vector<bool>(dimensions.size(), false);
405
+ if (input_top_cells) {
406
+ this->construct_complex_based_on_top_dimensional_cells(dimensions, cells,
407
+ directions_in_which_periodic_b_cond_are_to_be_imposed);
408
+ } else {
409
+ this->construct_complex_based_on_vertices(dimensions, cells,
410
+ directions_in_which_periodic_b_cond_are_to_be_imposed);
411
+ }
412
+ }
413
+
414
+ template <typename T>
415
+ Bitmap_cubical_complex_periodic_boundary_conditions_base<T>::Bitmap_cubical_complex_periodic_boundary_conditions_base(
416
+ const std::vector<unsigned>& dimensions, const std::vector<T>& cells,
417
+ const std::vector<bool>& directions_in_which_periodic_b_cond_are_to_be_imposed,
418
+ bool input_top_cells) {
419
+ if(input_top_cells) {
420
+ this->construct_complex_based_on_top_dimensional_cells(dimensions, cells,
421
+ directions_in_which_periodic_b_cond_are_to_be_imposed);
422
+ } else {
423
+ this->construct_complex_based_on_vertices(dimensions, cells,
424
+ directions_in_which_periodic_b_cond_are_to_be_imposed);
425
+ }
426
+ }
427
+
428
+ // ***********************Methods************************ //
429
+
430
+ template <typename T>
431
+ std::vector<std::size_t> Bitmap_cubical_complex_periodic_boundary_conditions_base<T>::get_boundary_of_a_cell(
432
+ std::size_t cell) const {
433
+ #ifdef DEBUG_TRACES
434
+ std::clog << "Computations of boundary of a cell : " << cell << std::endl;
435
+ #endif
436
+
437
+ std::vector<std::size_t> boundary_elements;
438
+ boundary_elements.reserve(this->dimension() * 2);
439
+ std::size_t cell1 = cell;
440
+ std::size_t sum_of_dimensions = 0;
441
+
442
+ for (std::size_t i = this->multipliers.size(); i != 0; --i) {
443
+ unsigned position = cell1 / this->multipliers[i - 1];
444
+ cell1 = cell1 % this->multipliers[i - 1];
445
+ // this cell have a nonzero length in this direction, therefore we can compute its boundary in this direction.
446
+ if (position % 2 == 1) {
447
+ // if there are no periodic boundary conditions in this direction, we do not have to do anything.
448
+ if (!directions_in_which_periodic_b_cond_are_to_be_imposed[i - 1]) {
449
+ if (sum_of_dimensions % 2) {
450
+ boundary_elements.push_back(cell - this->multipliers[i - 1]);
451
+ boundary_elements.push_back(cell + this->multipliers[i - 1]);
452
+ } else {
453
+ boundary_elements.push_back(cell + this->multipliers[i - 1]);
454
+ boundary_elements.push_back(cell - this->multipliers[i - 1]);
455
+ }
456
+ #ifdef DEBUG_TRACES
457
+ std::clog << cell - this->multipliers[i - 1] << " " << cell + this->multipliers[i - 1] << " ";
458
+ #endif
459
+ } else {
460
+ // in this direction we have to do boundary conditions. Therefore, we need to check if we are not at the end.
461
+ if (position != 2 * this->sizes[i - 1] - 1) {
462
+ if (sum_of_dimensions % 2) {
463
+ boundary_elements.push_back(cell - this->multipliers[i - 1]);
464
+ boundary_elements.push_back(cell + this->multipliers[i - 1]);
465
+ } else {
466
+ boundary_elements.push_back(cell + this->multipliers[i - 1]);
467
+ boundary_elements.push_back(cell - this->multipliers[i - 1]);
468
+ }
469
+ #ifdef DEBUG_TRACES
470
+ std::clog << cell - this->multipliers[i - 1] << " " << cell + this->multipliers[i - 1] << " ";
471
+ #endif
472
+ } else {
473
+ if (sum_of_dimensions % 2) {
474
+ boundary_elements.push_back(cell - this->multipliers[i - 1]);
475
+ boundary_elements.push_back(cell - (2 * this->sizes[i - 1] - 1) * this->multipliers[i - 1]);
476
+ } else {
477
+ boundary_elements.push_back(cell - (2 * this->sizes[i - 1] - 1) * this->multipliers[i - 1]);
478
+ boundary_elements.push_back(cell - this->multipliers[i - 1]);
479
+ }
480
+ #ifdef DEBUG_TRACES
481
+ std::clog << cell - this->multipliers[i - 1] << " "
482
+ << cell - (2 * this->sizes[i - 1] - 1) * this->multipliers[i - 1] << " ";
483
+ #endif
484
+ }
485
+ }
486
+ ++sum_of_dimensions;
487
+ }
488
+ }
489
+ return boundary_elements;
490
+ }
491
+
492
+ template <typename T>
493
+ std::vector<std::size_t> Bitmap_cubical_complex_periodic_boundary_conditions_base<T>::get_coboundary_of_a_cell(
494
+ std::size_t cell) const {
495
+ std::vector<unsigned> counter = this->compute_counter_for_given_cell(cell);
496
+ std::vector<std::size_t> coboundary_elements;
497
+ std::size_t cell1 = cell;
498
+ for (std::size_t i = this->multipliers.size(); i != 0; --i) {
499
+ unsigned position = cell1 / this->multipliers[i - 1];
500
+ cell1 = cell1 % this->multipliers[i - 1];
501
+ // if the cell has zero length in this direction, then it will have cbd in this direction.
502
+ if (position % 2 == 0) {
503
+ if (!this->directions_in_which_periodic_b_cond_are_to_be_imposed[i - 1]) {
504
+ // no periodic boundary conditions in this direction
505
+ if ((counter[i - 1] != 0) && (cell > this->multipliers[i - 1])) {
506
+ coboundary_elements.push_back(cell - this->multipliers[i - 1]);
507
+ }
508
+ if ((counter[i - 1] != 2 * this->sizes[i - 1]) && (cell + this->multipliers[i - 1] < this->data.size())) {
509
+ coboundary_elements.push_back(cell + this->multipliers[i - 1]);
510
+ }
511
+ } else {
512
+ // we want to have periodic boundary conditions in this direction
513
+ if (counter[i - 1] != 0) {
514
+ coboundary_elements.push_back(cell - this->multipliers[i - 1]);
515
+ coboundary_elements.push_back(cell + this->multipliers[i - 1]);
516
+ } else {
517
+ // in this case counter[i-1] == 0.
518
+ coboundary_elements.push_back(cell + this->multipliers[i - 1]);
519
+ coboundary_elements.push_back(cell + (2 * this->sizes[i - 1] - 1) * this->multipliers[i - 1]);
520
+ }
521
+ }
522
+ }
523
+ }
524
+ return coboundary_elements;
525
+ }
526
+
527
+ // Exact same code as the non-periodic version, duplicated for now to ensure it calls the right version of vertices_iterator_begin.
528
+ template <typename T>
529
+ void Bitmap_cubical_complex_periodic_boundary_conditions_base<T>::impose_lower_star_filtration_from_vertices() {
530
+ // this vector will be used to check which elements have already been taken care of in imposing lower star filtration
531
+ std::vector<bool> is_this_cell_considered(this->data.size(), false);
532
+
533
+ std::vector<std::size_t> indices_to_consider;
534
+ // we assume here that we already have a filtration on the vertices and
535
+ // we have to extend it to higher ones.
536
+ for (auto it = this->vertices_iterator_begin();
537
+ it != this->vertices_iterator_end(); ++it) {
538
+ indices_to_consider.push_back(it.compute_index_in_bitmap());
539
+ }
540
+
541
+ while (indices_to_consider.size()) { // Iteration on the dimension
542
+ #ifdef DEBUG_TRACES
543
+ std::clog << "indices_to_consider in this iteration \n";
544
+ for (auto index : indices_to_consider) {
545
+ std::clog << index << " ";
546
+ }
547
+ #endif
548
+ std::vector<std::size_t> new_indices_to_consider;
549
+ for (auto index : indices_to_consider) {
550
+ std::vector<std::size_t> cbd = this->get_coboundary_of_a_cell(index);
551
+ for (auto coboundary : cbd) {
552
+ #ifdef DEBUG_TRACES
553
+ std::clog << "filtration of a cell : " << coboundary << " is : " << this->data[coboundary]
554
+ << " while of a cell: " << index << " is: " << this->data[index]
555
+ << std::endl;
556
+ #endif
557
+ if (this->data[coboundary] < this->data[index]) {
558
+ this->data[coboundary] = this->data[index];
559
+ #ifdef DEBUG_TRACES
560
+ std::clog << "Setting the value of a cell : " << coboundary
561
+ << " to : " << this->data[index] << std::endl;
562
+ #endif
563
+ }
564
+ if (is_this_cell_considered[coboundary] == false) {
565
+ new_indices_to_consider.push_back(coboundary);
566
+ is_this_cell_considered[coboundary] = true;
567
+ }
568
+ }
569
+ }
570
+ indices_to_consider.swap(new_indices_to_consider);
571
+ }
572
+ }
573
+ } // namespace cubical_complex
574
+
575
+ namespace Cubical_complex = cubical_complex;
576
+
577
+ } // namespace Gudhi
578
+
579
+ #endif // BITMAP_CUBICAL_COMPLEX_PERIODIC_BOUNDARY_CONDITIONS_BASE_H_