summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Bauer <mail@ulrich-bauer.org>2019-08-19 12:49:33 +0200
committerUlrich Bauer <mail@ulrich-bauer.org>2019-08-19 12:49:33 +0200
commit3c6186b8450ef1c357b21042d9e963060a904edc (patch)
tree148a114386bb98d8532953b3c2055beee76119c4
parent3fd98444e764f490752aac427011180c19e69e31 (diff)
code cleanup pop_pivot
-rw-r--r--ripser.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/ripser.cpp b/ripser.cpp
index 9418141..4d8e8f3 100644
--- a/ripser.cpp
+++ b/ripser.cpp
@@ -521,13 +521,13 @@ public:
if (get_coefficient(pivot) == 0)
pivot = column.top();
else if (get_index(column.top()) != get_index(pivot))
- break;
+ return pivot;
else
set_coefficient(pivot,
(get_coefficient(pivot) + get_coefficient(column.top())) % modulus);
column.pop();
}
- if (get_coefficient(pivot) == 0) pivot = -1;
+ return (get_coefficient(pivot) == 0) ? -1 : pivot;
#else
while (!column.empty()) {
pivot = column.top();
@@ -535,9 +535,8 @@ public:
if (column.empty() || get_index(column.top()) != get_index(pivot)) return pivot;
column.pop();
}
- pivot = -1;
+ return -1;
#endif
- return pivot;
}
template <typename Column> diameter_entry_t get_pivot(Column& column) {