summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Bauer <mail@ulrich-bauer.org>2020-11-25 22:47:29 +0100
committerUlrich Bauer <mail@ulrich-bauer.org>2020-11-25 22:47:29 +0100
commit9eeaee84d2d6a284bd895f3026c0e1ac2fa4a38a (patch)
tree7f0b29af125c2db486594cb42700ab84d89a1db2
parent513c6f06098a904761c61f685db690be474c94ba (diff)
cleanup
-rw-r--r--ripser.cpp47
1 files changed, 21 insertions, 26 deletions
diff --git a/ripser.cpp b/ripser.cpp
index 8345628..bcc8700 100644
--- a/ripser.cpp
+++ b/ripser.cpp
@@ -712,8 +712,8 @@ public:
greater_diameter_or_smaller_index<diameter_entry_t>>
working_reduction_column, working_coboundary;
- diameter_entry_t pivot = init_coboundary_and_get_pivot(
- column_to_reduce, working_coboundary, dim, pivot_column_index);
+ diameter_entry_t e, pivot = init_coboundary_and_get_pivot(
+ column_to_reduce, working_coboundary, dim, pivot_column_index);
while (true) {
#ifdef INDICATE_PROGRESS
@@ -729,7 +729,6 @@ public:
if (pair != pivot_column_index.end()) {
entry_t other_pivot = pair->first;
index_t index_column_to_add = pair->second;
-
coefficient_t factor =
modulus - get_coefficient(pivot) *
multiplicative_inverse[get_coefficient(other_pivot)] %
@@ -739,38 +738,34 @@ public:
factor, dim, working_reduction_column, working_coboundary);
pivot = get_pivot(working_coboundary);
- } else {
- auto check = get_apparent_facet(pivot, dim + 1);
+ } else if (get_index(e = get_apparent_facet(pivot, dim + 1)) != -1) {
- if (get_index(check) != -1) {
+ set_coefficient(e, modulus - get_coefficient(e));
- set_coefficient(check, modulus - get_coefficient(check));
+ add_simplex_coboundary(e, dim, working_reduction_column,
+ working_coboundary);
- add_simplex_coboundary(check, dim, working_reduction_column,
- working_coboundary);
-
- pivot = get_pivot(working_coboundary);
+ pivot = get_pivot(working_coboundary);
- } else {
+ } else {
#ifdef PRINT_PERSISTENCE_PAIRS
- value_t death = get_diameter(pivot);
- if (death > diameter * ratio) {
+ value_t death = get_diameter(pivot);
+ if (death > diameter * ratio) {
#ifdef INDICATE_PROGRESS
- std::cerr << clear_line << std::flush;
+ std::cerr << clear_line << std::flush;
#endif
- std::cout << " [" << diameter << "," << death << ")" << std::endl;
- }
+ std::cout << " [" << diameter << "," << death << ")" << std::endl;
+ }
#endif
- pivot_column_index.insert({get_entry(pivot), index_column_to_reduce});
-
- while (true) {
- diameter_entry_t e = pop_pivot(working_reduction_column);
- if (get_index(e) == -1) break;
- assert(get_coefficient(e) > 0);
- reduction_matrix.push_back(e);
- }
- break;
+ pivot_column_index.insert({get_entry(pivot), index_column_to_reduce});
+
+ while (true) {
+ diameter_entry_t e = pop_pivot(working_reduction_column);
+ if (get_index(e) == -1) break;
+ assert(get_coefficient(e) > 0);
+ reduction_matrix.push_back(e);
}
+ break;
}
} else {
#ifdef PRINT_PERSISTENCE_PAIRS