summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Bauer <mail@ulrich-bauer.org>2018-02-15 11:00:13 +0100
committerUlrich Bauer <mail@ulrich-bauer.org>2018-02-15 11:00:13 +0100
commit23a262f1b59eacd7a3ef01589101e64290cd7128 (patch)
treeb00fc3c125fd57f363f62c6bdbb96ae028589dfe
parenta962f06a93df50941c813d187730b849b8fd84d6 (diff)
threshold at enclosing radius
-rw-r--r--ripser.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/ripser.cpp b/ripser.cpp
index 70a092a..7858c55 100644
--- a/ripser.cpp
+++ b/ripser.cpp
@@ -785,9 +785,8 @@ public:
else
x = std::max(x, y);
}
- return all_cofaces ||
- !(k > 0 &&
- parent.get_next_vertex(max_vertex_below, idx_below, k) > get_index(x));
+ return all_cofaces || !(k > 0 && parent.get_next_vertex(max_vertex_below, idx_below,
+ k) > get_index(x));
continue_outer:;
}
return false;
@@ -1151,6 +1150,15 @@ int main(int argc, char** argv) {
max = -std::numeric_limits<value_t>::infinity(), max_finite = max;
int num_edges = 0;
+ value_t enclosing_radius = std::numeric_limits<value_t>::infinity();
+ for (index_t i = 0; i < dist.size(); ++i) {
+ value_t r_i = -std::numeric_limits<value_t>::infinity();
+ for (index_t j = 0; j < dist.size(); ++j) r_i = std::max(r_i, dist(i, j));
+ enclosing_radius = std::min(enclosing_radius, r_i);
+ }
+
+ if (threshold == std::numeric_limits<value_t>::max()) threshold = enclosing_radius;
+
for (auto d : dist.distances) {
min = std::min(min, d);
max = std::max(max, d);