From 23a262f1b59eacd7a3ef01589101e64290cd7128 Mon Sep 17 00:00:00 2001 From: Ulrich Bauer Date: Thu, 15 Feb 2018 11:00:13 +0100 Subject: [PATCH] threshold at enclosing radius --- ripser.cpp | 14 +++++++++++--- 1 file 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 @@ template <> class ripser::simplex_coboundary_enumerator 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::infinity(), max_finite = max; int num_edges = 0; + value_t enclosing_radius = std::numeric_limits::infinity(); + for (index_t i = 0; i < dist.size(); ++i) { + value_t r_i = -std::numeric_limits::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::max()) threshold = enclosing_radius; + for (auto d : dist.distances) { min = std::min(min, d); max = std::max(max, d);