summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Bauer <mail@ulrich-bauer.org>2020-11-25 11:27:11 +0100
committerUlrich Bauer <mail@ulrich-bauer.org>2020-11-25 11:27:11 +0100
commitbb7bcaaa103562b2668f0c10a4041343616d797d (patch)
treed21437598123a40667e5fd22c20fed0e98c87285
parent3e5137e14496bde8758320ae428d8f2837a0d9ca (diff)
clean up apparent pairs enumeration
-rw-r--r--ripser.cpp18
1 files changed, 3 insertions, 15 deletions
diff --git a/ripser.cpp b/ripser.cpp
index 69ce97b..02a3dba 100644
--- a/ripser.cpp
+++ b/ripser.cpp
@@ -491,21 +491,14 @@ public:
diameter_entry_t get_apparent_facet(const diameter_entry_t simplex, const index_t dim) {
simplex_boundary_enumerator facets(simplex, dim, *this);
-
- simplex_coboundary_enumerator cofacets(0, dim - 1, *this);
-
while (facets.has_next()) {
diameter_entry_t facet = facets.next();
-
if (get_diameter(facet) == get_diameter(simplex)) {
- cofacets.init(facet, dim - 1);
-
+ simplex_coboundary_enumerator cofacets(facet, dim - 1, *this);
while (cofacets.has_next()) {
auto cofacet = cofacets.next();
-
- if (get_diameter(cofacet) == get_diameter(simplex)) {
+ if (get_diameter(cofacet) == get_diameter(simplex))
return (get_index(cofacet) == get_index(simplex)) ? facet : std::make_pair(0,-1);
- }
}
}
}
@@ -514,19 +507,14 @@ public:
diameter_entry_t get_apparent_cofacet(const diameter_entry_t simplex, const index_t dim) {
simplex_coboundary_enumerator cofacets(simplex, dim, *this);
-
while (cofacets.has_next()) {
diameter_entry_t cofacet = cofacets.next();
-
if (get_diameter(cofacet) == get_diameter(simplex)) {
simplex_boundary_enumerator facets(cofacet, dim + 1, *this);
-
while (facets.has_next()) {
auto facet = facets.next();
-
- if (get_diameter(facet) == get_diameter(simplex)) {
+ if (get_diameter(facet) == get_diameter(simplex))
return (get_index(facet) == get_index(simplex)) ? cofacet : std::make_pair(0,-1);
- }
}
}
}