diff options
author | Ulrich Bauer <mail@ulrich-bauer.org> | 2020-12-17 17:41:12 +0100 |
---|---|---|
committer | Ulrich Bauer <mail@ulrich-bauer.org> | 2020-12-17 17:41:12 +0100 |
commit | cc57969ebd89dc9f0eff78f5f48d1fffb3233899 (patch) | |
tree | 2568ceef0c49c19ee1126dede233837ad320a87a | |
parent | 320b8248566a3b9108aa5ac7e751ec40d48690ee (diff) |
enclosing radius output when no threshold is specified
-rw-r--r-- | ripser.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -1090,14 +1090,13 @@ 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(); if (threshold == std::numeric_limits<value_t>::max()) { - value_t enclosing_radius = std::numeric_limits<value_t>::infinity(); for (size_t i = 0; i < dist.size(); ++i) { value_t r_i = -std::numeric_limits<value_t>::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) { @@ -1109,10 +1108,12 @@ 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<compressed_lower_distance_matrix>(std::move(dist), dim_max, threshold, ratio, - modulus) + if (threshold == std::numeric_limits<value_t>::max()) { + std::cout << "distance matrix with " << dist.size() + << " points, using threshold at enclosing radius " << enclosing_radius + << std::endl; + ripser<compressed_lower_distance_matrix>(std::move(dist), dim_max, enclosing_radius, + ratio, modulus) .compute_barcodes(); } else { std::cout << "sparse distance matrix with " << dist.size() << " points and " @@ -1124,5 +1125,6 @@ int main(int argc, char** argv) { .compute_barcodes(); } exit(0); + } } |