summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Bauer <mail@ulrich-bauer.org>2020-11-25 21:49:22 +0100
committerUlrich Bauer <mail@ulrich-bauer.org>2020-11-25 21:49:22 +0100
commit1c0959db6bf21916937e68dc3266444607022519 (patch)
tree63f67bd19eb38255b3141784ded860ee5348edf3
parentbb7bcaaa103562b2668f0c10a4041343616d797d (diff)
use apparent pairs only for full barcode
-rw-r--r--ripser.cpp9
1 files 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<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) {
@@ -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<compressed_lower_distance_matrix>(std::move(dist), dim_max, threshold, ratio,
+ 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 {