From 1c0959db6bf21916937e68dc3266444607022519 Mon Sep 17 00:00:00 2001 From: Ulrich Bauer Date: Wed, 25 Nov 2020 21:49:22 +0100 Subject: use apparent pairs only for full barcode --- ripser.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ripser.cpp b/ripser.cpp index 02a3dba..f243728 100644 --- a/ripser.cpp +++ b/ripser.cpp @@ -1223,14 +1223,13 @@ 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(); if (threshold == std::numeric_limits::max()) { - value_t enclosing_radius = std::numeric_limits::infinity(); for (size_t i = 0; i < dist.size(); ++i) { value_t r_i = -std::numeric_limits::infinity(); for (size_t j = 0; j < dist.size(); ++j) r_i = std::max(r_i, dist(i, j)); enclosing_radius = std::min(enclosing_radius, r_i); } - threshold = enclosing_radius; } for (auto d : dist.distances) { @@ -1242,9 +1241,9 @@ int main(int argc, char** argv) { } std::cout << "value range: [" << min << "," << max_finite << "]" << std::endl; - if (threshold >= max) { - std::cout << "distance matrix with " << dist.size() << " points" << std::endl; - ripser(std::move(dist), dim_max, threshold, ratio, + if (threshold == std::numeric_limits::max()) { + std::cout << "distance matrix with " << dist.size() << " points, using threshold at enclosing radius " << enclosing_radius << std::endl; + ripser(std::move(dist), dim_max, enclosing_radius, ratio, modulus) .compute_barcodes(); } else { -- cgit v1.2.3