diff options
author | Marc Glisse <marc.glisse@inria.fr> | 2020-11-13 13:59:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-13 13:59:05 +0100 |
commit | d0636be036ba4a5f0e8681d3d4804aaf33ee5eb3 (patch) | |
tree | e976dcec6ff5684ac9f94e1e2f14a2dd20161159 /src/Bottleneck_distance/include/gudhi/Bottleneck.h | |
parent | a6fe8d15a755c4843b2981cf6e1ba00b6eccd81b (diff) | |
parent | 53376fde3f35576af18fac33d731e8398da7522e (diff) |
Merge pull request #405 from mglisse/botneg
Bottleneck distance for one point or negative coordinates
Diffstat (limited to 'src/Bottleneck_distance/include/gudhi/Bottleneck.h')
-rw-r--r-- | src/Bottleneck_distance/include/gudhi/Bottleneck.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/Bottleneck_distance/include/gudhi/Bottleneck.h b/src/Bottleneck_distance/include/gudhi/Bottleneck.h index e466828a..c916898d 100644 --- a/src/Bottleneck_distance/include/gudhi/Bottleneck.h +++ b/src/Bottleneck_distance/include/gudhi/Bottleneck.h @@ -35,8 +35,12 @@ namespace persistence_diagram { inline double bottleneck_distance_approx(Persistence_graph& g, double e) { double b_lower_bound = 0.; - double b_upper_bound = g.diameter_bound(); - const double alpha = std::pow(g.size(), 1. / 5.); + double b_upper_bound = g.max_dist_to_diagonal(); + int siz = g.size(); + if (siz <= 1) + // The value of alpha would be wrong in this case + return b_upper_bound; + const double alpha = std::pow(siz, 1. / 5.); Graph_matching m(g); Graph_matching biggest_unperfect(g); while (b_upper_bound - b_lower_bound > 2 * e) { |