summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Glisse <marc.glisse@inria.fr>2020-05-13 19:32:21 +0200
committerMarc Glisse <marc.glisse@inria.fr>2020-05-13 19:32:21 +0200
commit7bbc1ae35d492123c517a54a9595188938e52dff (patch)
tree7bdedef5adcfb6d648e3c7d9ff57a39ae5ee50bd
parentb2118cde83056b43cea095f5208d37744c9f088f (diff)
More size_t
-rw-r--r--src/python/include/Persistent_cohomology_interface.h28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/python/include/Persistent_cohomology_interface.h b/src/python/include/Persistent_cohomology_interface.h
index cec18546..e5a3dfba 100644
--- a/src/python/include/Persistent_cohomology_interface.h
+++ b/src/python/include/Persistent_cohomology_interface.h
@@ -13,6 +13,7 @@
#include <gudhi/Persistent_cohomology.h>
+#include <cstdlib>
#include <vector>
#include <utility> // for std::pair
#include <algorithm> // for sort
@@ -81,32 +82,31 @@ persistent_cohomology::Persistent_cohomology<FilteredComplex, persistent_cohomol
persistent_cohomology::Field_Zp>::get_persistent_pairs();
// Gather all top-dimensional cells and store their simplex handles
- std::vector<int> max_splx; for (auto splx : stptr_->top_dimensional_cells_range()){
- max_splx.push_back(splx);
- }
+ std::vector<std::size_t> max_splx;
+ for (auto splx : stptr_->top_dimensional_cells_range())
+ max_splx.push_back(splx);
// Sort these simplex handles and compute the ordering function
- // This function allows to go directly from the simplex handle to the position of the corresponding top-dimensional cell in the input data
- std::unordered_map<int, int> order;
- //std::sort(max_splx.begin(), max_splx.end());
+ // This function allows to go directly from the simplex handle to the position of the corresponding top-dimensional cell in the input data
+ std::unordered_map<std::size_t, int> order;
+ //std::sort(max_splx.begin(), max_splx.end());
for (unsigned int i = 0; i < max_splx.size(); i++) order.emplace(max_splx[i], i);
std::vector<std::vector<int>> persistence_pairs;
for (auto pair : pairs) {
int h = stptr_->dimension(get<0>(pair));
// Recursively get the top-dimensional cell / coface associated to the persistence generator
- int face0 = stptr_->get_top_dimensional_coface_of_a_cell(get<0>(pair));
+ std::size_t face0 = stptr_->get_top_dimensional_coface_of_a_cell(get<0>(pair));
// Retrieve the index of the corresponding top-dimensional cell in the input data
int splx0 = order[face0];
int splx1 = -1;
- if (isfinite(stptr_->filtration(get<1>(pair)))){
- // Recursively get the top-dimensional cell / coface associated to the persistence generator
- int face1 = stptr_->get_top_dimensional_coface_of_a_cell(get<1>(pair));
- // Retrieve the index of the corresponding top-dimensional cell in the input data
- splx1 = order[face1];
+ if (get<1>(pair) != stptr_->null_simplex()){
+ // Recursively get the top-dimensional cell / coface associated to the persistence generator
+ std::size_t face1 = stptr_->get_top_dimensional_coface_of_a_cell(get<1>(pair));
+ // Retrieve the index of the corresponding top-dimensional cell in the input data
+ splx1 = order[face1];
}
- std::vector<int> vect{ h, splx0, splx1};
- persistence_pairs.push_back(vect);
+ persistence_pairs.push_back({ h, splx0, splx1 });
}
return persistence_pairs;
}